Tracking 2 Separate Forms with DOM tracking
-
I need help.. I have 2 forms on our site. I need to implement DOM tracking code for each so I can view how many conversions each form had. Right now your tutorial only shows how to specifically track one form OR all forms together…
I tried adding 2 of the “Targeting a Specific Contact Form” code and updating each to have its own ID and Tracking name.. But this did not work…
add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );
function mycustom_wp_footer() {
?>
<script type=”text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if ( ‘0986’ == event.detail.contactFormId ) {
ga( ‘send’, ‘event’, ‘Contact Form’, ‘submit’ );
}
}, false );
</script>
<?php
}add_action( ‘wp_footer’, ‘mycustom_wp_footer’ );
function mycustom_wp_footer() {
?>
<script type=”text/javascript”>
document.addEventListener( ‘wpcf7mailsent’, function( event ) {
if ( ‘0985’ == event.detail.contactFormId ) {
ga( ‘send’, ‘event’, ‘Testimonial Form’, ‘submit’ );
}
}, false );
</script>
<?php
}Please help. Thank you
- The topic ‘Tracking 2 Separate Forms with DOM tracking’ is closed to new replies.