How does one update hooks?
Thread Starter
Twig
(@palpatine1976)
It only applies if you have written custom javascript to track events (like onclick) like:
ga('send', args)
This would need to be changed to
__gaTracker('send', args)
If you haven’t written any custom javascript, you don’t need to do anything.
Very grateful for you sharing your knowledge Sith Lord Goz. Just today I realized that the events were not being recorded. : D
The Yoast fell a little in my concept with this attitude. Was supposed to have alerted users of the plugin.
TRADUZIDO PELO GOOGLE TRADUTOR DE:
Muito grato por você compartilhar seu conhecimento Sith Lord Goz. Só hoje percebí que os eventos não estavam mais sendo contabilizados. 😀
A Yoast caiu um pouco no meu conceito com essa atitude. Era pra ter alertado os usuários do plugin.
it is possible to easily restore functionality by writing
var ga = __gaTracker;
into custom code panel? it definitely eliminates javascript errors, but i’m still seeing event tracking flatline.
__gaTracker is ridiculously noisy to write everywhere.
I also ran into this issue with a ga() setting that I used with the Contact Form 7 plugin. When I realized that the contact form didn’t work anymore I saw an “ga is not defined” error in the browsers console. When I checked the analytics snipped I noticed it now used __gaTracker() rather then ga(), I simply tried it and it worked. It was only after some more research I found this thread.
Thanks for posting and yes, I do agree that this should have been spelled out in the release notes.
Cross post to the Contact Form 7 plugin issue I had after this change
https://wordpress.org/support/topic/contact-form-7-and-google-analytics-problem?replies=25#post-6304168
Good catch, thanks for this!
Wow, I understand this is a free plugin, but this is a terrible lack of notification on Yoasts part. I just wasted 40min just trying to figure out why some javascript on my website wasn’t working. I hadn’t updated Yoast’s plugin in a little while. After updating I didn’t notice anything out of the ordinary until a client of mine mentioned random problems with my website. I checked the changelog before finding this thread and there’s absolutely NO reference to this change.
I have the same issue :-/
For some reason I can’t find __gaTracker().
It’s not under window. or document.
Just before I uninstall Yost – anyone has any idea what function I can use to have the Google analytics usability?
Looking at Yost’s code I can’t find where he creates a global variable that can be used on the page:
<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-47749701-1’]);
_gaq.push([‘_gat._forceSSL’]);
_gaq.push([‘_trackPageview’]);
(function () {
var ga = document.createElement(‘script’);
ga.type = ‘text/javascript’;
ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
Thanks!
Tried __gaTracker(‘send’, ‘event’, ‘Contact Form’, ‘Send’); and still doesn’t work.
Is it not allowed to use ‘Contact Form’?
@behemothkind
Your code doesn’t use __gaTracker
Maybe it’s different if you don’t enable universal analytics in Yoast. Try the original one mentioned here:
Tracking Form Submissions with Google Analytics
@john-pierre Cornelissen – that did the trick!
1. I activated universal tracking.
2. Changed my ga() call to __gaTracker.
3. Moved my jQuery.on() to the bottom of the page (using some plug-in).
Works like a charm 🙂
I am actually not using it for contactform7 – just for my own buttons.
Thanks a lot!
@behemothkind glad I could help!