Tagged: Analytics, event tracking, forms
-
AuthorPosts
-
February 23, 2015 at 3:19 pm #400681
Hi Lads,
Since I wasn’t “smart enuf” to get event tracking with Analytics to work for a client on Enfold theme – They hired someone else :)
Fine with me!? ;-(
Anyway — since we had huge problems with form submissions? It works for admins and shopmanagers (properly all logged in accounts?)
But when visitors try to submit the form… It randomly for not all fails?
I was thinking that since tracking is TURNED off for Admins …. Maybe it’s the tracking that makes the built in form fail?
Could I be barking up the right tree here or should I re-think my theory?
I did play around with the captcha – No diff
I did take off validation for some fields – no diff (I am admin so maybe it all works when I do it)February 24, 2015 at 1:06 am #401127Hi Peter,
That seems to be, just by looking at the source (not logged) you’ll see two tracking codes (http://screencast.com/t/ilxytFuPjN), can you please create me a WordPress administrator account? post it here as a private reply.
Regards,
JosueFebruary 24, 2015 at 1:02 pm #401359This reply has been marked as private.February 25, 2015 at 3:35 pm #402093Hey Peter!
Can you check if it works now (not logged)? i was unable to find the other GA code source so i removed the Enfold one.
Best regards,
JosueFebruary 25, 2015 at 3:58 pm #402111Hi Josue!
WORKS!! – thanks a million
Cheers
Peter
February 25, 2015 at 4:27 pm #402143You are welcome Peter, always glad to help :)
Regards,
JosueFebruary 25, 2015 at 5:16 pm #402183This reply has been marked as private.February 25, 2015 at 5:23 pm #402192Can you post a link to the page where you have this applied?
Best regards,
JosueFebruary 25, 2015 at 6:32 pm #402266This reply has been marked as private.February 26, 2015 at 8:34 pm #402970Hi!
Use this method instead:
https://kriesi.at/support/topic/please-clear-this-up-for-em-ga-tracking-2/#post-349057You can apply the same class to both Forms so every time the form is submitted it will push an event to GA. I’ve also improved the code so the track fires only when the form submission is valid (no errors).
Cheers!
JosueFebruary 26, 2015 at 9:36 pm #402998Hi Josue!
Thanks … So no edit the “ga” to gaTracker? I am using Yoast?
and the entire thing in my Child theme is now:add_theme_support('avia_template_builder_custom_css'); function add_custom_script(){ ?> <script> (function($){ $(window).load(function() { $('.contact_form_1 input[type="submit"]').on('click', function() { if (!$('.contact_form_1 p').hasClass('error')) { gaTracker('send’, 'event', 'Contact', 'Support Request', 'Contact form'); } }); $('.contact_form_2 input[type="submit"]').on('click', function() { if (!$('.contact_form_2 p').hasClass('error')) { gaTracker('send’, 'event', 'Contact', 'Support Request', 'Contact form'); } }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
February 26, 2015 at 10:41 pm #403040Hi!
Yes that should do it, note if you are using the same class in both forms the code should be changed to:
function add_custom_script(){ ?> <script> (function($){ $(window).load(function() { $('._CONTACT_FORM_CLASS_HERE_ input[type="submit"]').on('click', function() { if (!$('._CONTACT_FORM_CLASS_HERE_ p').hasClass('error')) { gaTracker('send’, 'event', 'Contact', 'Support Request', 'Contact form'); } }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'add_custom_script');
Best regards,
JosueFebruary 26, 2015 at 11:28 pm #403061Hi Josue
Cool… Well I kind of have to… Because footer form is button 1 on all pages except the contact page then it’s button 2 and contact form is one
So that make it impossible to differ… Anyway I am happy just to get the tracking to work.
When I submit the form … and check the anlaytics… NADA shows up?
Any ideas?Peter
February 26, 2015 at 11:38 pm #403065There are some unexpected identifiers in the code – http://screencast.com/t/3BiBlduXzApY, try re-writing the quotes in the code in functions.php.
Cheers!
JosueFebruary 26, 2015 at 11:45 pm #403071Nice… Spottet!
Fixed… I will test
February 27, 2015 at 12:38 am #403083Cool, let me know how it goes.
Regards,
JosueFebruary 27, 2015 at 3:25 pm #403446Hi Josue,
Nada … Nothing works… I give up! Avia and GA just will not work together?
Maybe we will swap to another theme – this is too complicatedFebruary 27, 2015 at 6:26 pm #403576Hey!
The code you’ve put is still using “_CONTACT_FORM_CLASS_HERE_”, you need to replace that with the class of the contact form, try putting the default one “avia_ajax_form”:
(function($){ $(window).load(function() { $('.avia_ajax_form input[type="submit"]').on('click', function() { if (!$('.avia_ajax_form p').hasClass('error')) { gaTracker('send', 'event', 'Kontakt', 'Kunde Form', 'Kontakt form'); } }); }); })(jQuery);
I know this can be frustrating sometimes but i can assure you that this method works, i’ve tried it myself and also other users whom i recommended it here.
Best regards,
Josue- This reply was modified 9 years, 9 months ago by Josue.
March 28, 2015 at 7:19 am #419788Hi @Netzie,
Im just a member here to give you a friendy advice is to get the gravity forms plugin is the best for form submissions.
Have done extended testing with sun and cross domains with and Google Tag Manger setup and is just 100%.Havent hade the pleasure to try it with WPMU yet,
But Enfold is supportings this plugins with css so far i know.
I can maby help you out here please read this post.
https://kriesi.at/support/topic/google-analytics-not-working-in-enfold-2/ -
AuthorPosts
- The topic ‘Thinking about analytics… Forms fail’ is closed to new replies.