<?php
// IMPORTANT: This plugin is dynamically updated - MODIFICATIONS WILL BE OVERWRITTEN - see https://app.getguru.com/card/T585Kydc

/**************************************************
 * Name: Elementor
 * Description: Automatically track submissions from Elementor forms
 *************************************************/

if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly
}
?>
<!-- RCFX Integration: Elementor -->
<script type="text/javascript" data-registered="nutshell-plugin">
    document.addEventListener('readystatechange', function(event) {
        if (event.target.readyState === 'complete') {
            /* global jQuery */
            if ( 'undefined' !== typeof jQuery ) {
                document.querySelectorAll('.elementor-form').forEach( node => {
                    jQuery(node).on( 'submit_success', e => {
                        if( 'function' !== typeof mcfx ) {
                            console.warn( '"mcfx" is not defined. Please ensure that the RCFX pixel loads before usage.' );
                        } else {
                            mcfx( tracker => {
                                tracker.capture(e.target);
                            });
                        }
                    });
                });
            }
        }
    });
</script>

<?php // IMPORTANT: This plugin is dynamically updated - MODIFICATIONS WILL BE OVERWRITTEN - see https://app.getguru.com/card/T585Kydc ?>
