Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Google Analytics via Google Tag Manager
- This topic has 4 replies, 2 voices, and was last updated 6 years, 3 months ago by
Ernest Marcinko.
-
AuthorPosts
-
March 3, 2020 at 1:26 am #26088
Chas9000c25
ParticipantHow can I use Google Tag Manager to track Ajax searches in Google Analytics?
The documentation describes how to use a Google Analytics script (outside of Google Tag Manager) to track ajax searches in Google Analytics. I was successfully using those instructions and getting search data logged as pageviews in Google Analytics.
Here’s the code snippet that was working fine….
<script>
(function(i,s,o,g,r,a,m){i[‘GoogleAnalyticsObject’]=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,’script’,’https://www.google-analytics.com/analytics.js’,’ga’);ga(‘create’, ‘UA-12345678-9’, ‘auto’);
ga(‘send’, ‘pageview’);
</script>Then I switched all my scripts over to using Google Tag Manager instead of directly embedding them in the <head> section of the site.
So Google Analytics is now using Google Tag Manager to do all its tracking, instead of a script directly embedded in the site’s <head> section.
If I continue to use the code snippet (above) I would be “going around” Google Tag Manager rather that allowing Google Tag Manager to manage this script.
How can I capture Ajax search terms as pageviews, but through Google Tag Manager rather than through a separate script embedded in the <head> section of the site?
Thanks.
March 3, 2020 at 10:40 am #26096Ernest Marcinko
KeymasterHi,
At the moment this is not possible, but the good new is, that version 4.18 is finishing the testing phrase on our demo site – which supports the GTAG integration method, and implement a more advanced events tracking feature, which looks like this, and results in this.
This will be released within 3 days or sooner, all tests seem to be very promising. If it is okay for you, I suggest waiting for that, then you don’t need any duplicate code segments, the plugin should handle everything natively.
March 3, 2020 at 3:44 pm #26116Chas9000c25
ParticipantNice! Looks promising. I’ll stay tuned for the release. Thanks.
March 5, 2020 at 7:46 pm #26152Chas9000c25
ParticipantHey, I just noticed a new version (4.18) has been released. But when I click “update” I get an error message: “Update Failed: Plugin update failed.” I have the file from CodeCanyon if that helps. Does this release have the Google Tag Manager fix? And if so, how can I update to it? Thanks.
March 6, 2020 at 10:01 am #26160Ernest Marcinko
KeymasterHi,
Check the automatic updates guide, alternatively you can also update manually.
Yes, this release have a complete analytics rework, you can read the new features here.
-
AuthorPosts
- You must be logged in to reply to this topic.