Support » Plugin: Contact Form 7 » Issue using gtag code

  • I have followed the steps listed here for using Google Analytics: https://contactform7.com/tracking-form-submissions-with-google-analytics/

    Here is my code in my functions file:

    
    <?php
    add_action( 'wp_header', 'mycustom_wp_header' );
     
    function mycustom_wp_header() {
    ?>
    <script type="text/javascript">
    document.addEventListener( 'wpcf7mailsent', function( event ) {
        gtag('event', 'conversion', {'send_to': 'XXXXXXXXXXXX'});
    
    }, false );
    </script>
    <?php
    }
    ?>
    

    I cannot get the gtag to work (track form submissions). I was able to get ga to work fine. Any suggestions would be greatly appreciated, thanks!

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Issue using gtag code’ is closed to new replies.