Adding extra scripts after the initial script ends
-
Hi there,
I need to add the autotrack.js script right after the Google Analytics by Yoast script tag ends.
Can you let me know if there are documented ways to do this? I have tried googling but so far can’t find anything. I could just be blind. Sorry.
For example like so:
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga(‘create’, ‘UA-XXXXX-Y’, ‘auto’);
ga(‘require’, ‘autotrack’); –> I can put this in the Custom code area of this plugin using _gaTracker instead of ga
ga(‘send’, ‘pageview’);
</script>
<script async src=’https://www.google-analytics.com/analytics.js’></script> –> This is the part I’d like to load right in this spot instead of elsewhere on the page. Ideas?
<script async src=’path/to/autotrack.js’></script> –> ideas for this?Any help is much appreciated!
Here is a reference: https://github.com/googleanalytics/autotrack
https://wordpress.org/plugins/google-analytics-for-wordpress/
The topic ‘Adding extra scripts after the initial script ends’ is closed to new replies.