Dear support,
i want to track the sending of a contact form 7 form. How can i do this?
onclick=”ga(‘send’, ‘event’, ‘Klick’, ‘Button Klick’, ‘Kontaktformular absenden’);
Hey dondela,
You can use js script to do that: https://contactform7.com/tracking-form-submissions-with-google-analytics/
Then you can use some hooks from Enfold to add custom script: https://kriesi.at/documentation/enfold/add-custom-js-or-php-script/
It should work using this code:
function custom_script_name(){
?>
<script>
document.addEventListener( 'wpcf7mailsent', function( event ) {
ga( 'send', 'event', 'Contact Form', 'submit' );
}, false );
</script>
<?php
}
add_action('wp_head', 'custom_script_name');
Hope it helps.
Best regards,
Nikko
Hey Nikko,
thank you very much for your help.
Is it also possible to track, when a Mailto-Link is clicked? Like this: onclick=”ga(‘send’, ‘event’, ‘Klick’, ‘Klick E-Mail’, ‘Variabel , the E-mail-link which is clicked’);
Hi dondela,
I’m not sure if that’s possible, maybe the plugin author of cf7 can give a better answer on that.
Best regards,
Nikko
Oh, i think this is a misunderstanding. I mean a normal E-Mail Link on a Text, like (Email address hidden if logged out) “>E-Mail schreiben
Not in the contact form 7 form.
Hi dondela,
You can refer on this thread: https://stackoverflow.com/questions/19959569/event-tracking-using-google-universal-analytics
The only issue I can see with that is when that email link is clicked then it tracks it even when the user cancels sending the email.
Best regards,
Nikko