I`m trying to track submitted contact forms in google analytics with contact form 7. I tried the following:
I placed the code
on_sent_ok: "ga('send', 'event', 'Contact Form', 'submit');"
in the additional settings. Does not work. This method is supported until the end of 2017. The new method is "DOM events", so...
...I tried it with DOM events. I placed the code
<script> document.addEventListener( 'wpcf7mailsent', function( event ) { ga('send', 'event', 'Contact Form', 'submit'); }, false ); </script>
in the head of the template. Also, does not work.
I also tried a WordPress plugin "Contact Form 7 Google Analytics" and this doesn´t work either. No matter which way I tried: The site doesn´t execute the line:
ga('send', 'event', 'Contact Form', 'submit');
No event appears in the live view of google analytics. I had this problem a few months ago ( Wordpress and Google Analytics Events ) but this is a new site and i think it`s the same problem. There must be reason?
You can find the new site I am talking about here .
I am really happy about any help. Thank you!
Edit: New hint: After submitting a form there is no "thank you message". Nothing happens an the url changes to http://page.xyz/kontakt/#wpcf7-f4-p18-o1 I think this is not normal?
You might want to try the Contact Form 7 Google Analytics Intelligence plugin, https://wordpress.org/plugins/cf7-intelligence . It automates the whole process including goal creation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.