Event Tracking UA + Upgrading to Google Tag Manager - google-tag-manager

I've got a website where every button has an onclick parameter based [on this article]https://developers.google.com/analytics/devguides/collection/analyticsjs/events. This works fine with universal analytics. But I wonder if it also works with Google Tag Manager without any adjustments. Am I fine or do I need to change code on site to get this? If I do need to change, where should I start, couldn't find any resources

If you use GTM for event tracking, you would need to remove event tracking code on your site because this will result in double-tracking and inflated analytics data. What you can do is to tag everything you want tagged in GTM, but DO NOT publish your container and tags just yet - just work in debug mode so that you can see if/when your tags are firing. Then once everything is working in GTM debug mode, you can then remove your event tracking code and publish your container. Alternatively, if you wanted to just leave the event tracking code in your site and use GTM concurrently, then you would have to make sure you don't tag those events that are already being tracked, but really this isn't ideal and defeats the purpose of GTM.

Related

Google Tag Manager not firing where as it was previously

I've have a website where I configured Google Tag manager. ALl the tags were firing okay on page load and clicks events.
I then started to rename some of tags and triggers and file them in particular folders so they are neat. Now when I go to preview mode in tag manager, none of my tags fire where as they did previously. I've double checked my configuration tag and I have the correct measurement ID etc but just doesn't work.
What surprisingly does work are the events in summary bit in tag manager, so the standard events like scroll depth, window loaded etc seem to register.
I have no blocking triggers on any of my tags. I've also tried to restore my tags to a previous version but that's not helped at all.
Any ideas what else I could check? I think what could have broke the system was me renaming the configuration tag. I've now created another configuration tag and set it to fire on all pages but this does not fire when I navigate around the site. Is there anything else I could check?
First of all, you didn't complete your debugging and you failed to mention what kind of tags stopped working: GA4 or GA UA.
Using the GTM preview, fire a trigger, select it, see if your tag fired. If it didn't, find it in the list while having the trigger selected, select the tag, it will show the tag view and report on what triggers did not fire.
If this is not enough, then add debugging screenshots to your question.

Deleted tags in Tag Manager but events are still coming to Google Analytics

I have deleted some tags in Tag Manager, and published changes. But for some unknown reason I still see events coming in Google Analytics. Have doublechecked all tags, triggers & variables. How is it possible? Any help or guidance is highly appreciated!
There are multiple reasons for it:
Make sure it's not a cached version of GTM. In this case, you could use a custom dimension where you store your GTM version for production users. Then in GA you would be able to easily check if all those who still have the event have the old GTM version.
Go through the site where this event used to fire and try triggering it again, see if it fires for you.
Make sure you're not firing the event elsewhere by mistake. Check the page dimension for these events to check if it fires where you don't expect it.
This should solve the issue in vast majority of cases.

Google Tag manager not firing the collect url

I am fairly new to GTM and trying to figure out something here.
This is the url where i have set up gtm:
http://pizza.de/order/testshop/5283/index.htm
If you see at console, dataLayer is correctly set. So there is no problem with dataLayer, however i don't see the collect.js url firing. I am very sure that the configuration is correct but not able to figure out why the dataLayer is not being pushed to the server.
Any help will with greatly appreciated.
Move your dataLayer.push code to come before the GTM container tag. You are pushing to the dataLayer afterwards, so the GTM container is not able to use it.
From this:https://developers.google.com/tag-manager/devguide?hl=en
Variables pushed to the data layer (i.e. using dataLayer.push()) after the container snippet will not be able to fire tags on page loads with a matching condition.
#nyuen, was for responding late. Was AFK. Unfortunately, that didn't help. I made a small application running on localhost and tried to create the same scenario.
Variables pushed to the data layer (i.e. using dataLayer.push()) after the container snippet will not be able to fire tags on page loads with a matching condition.
The above is correct, but however i realized that it still fires no matter where you place the dataLayer, but its better to follow the documentation.
What I realized is that, gtm.js is responsible to fire analytics.js and analytics.js is responsible to fire the events. In my case, due to some unknown reason, analytics.js was not loading at all. So I had to inject this script and then the events started firing.

Why would Google Tag Manager not fire a tag set to fire on "All pages"?

I'm having a real tricky problem with Google Tag Manager on my site.
On certain paths under my domain, GTM will load (Tag Assistant shows the right container loading, and the GTM console pops up when Debug mode is enabled) but not fire any tags, even tags set to fire on all pages. This is using the default regex for the All Pages rule, ".*" I know this since the Debug console shows all the tags in the container as "Not fired".
On the root of my domain, GTM works just fine and the container loads while tags fire as they should.
I even opened the Chrome console and got the current location with "window.location.href" - it returned the path, minus the hostname, of the page I was on as expected.
What possible situation would cause GTM to load properly on a page, but not fire All Pages tags?
If the GTM container is loading properly but the tags aren't firing, that's because the tags that you want to fire have prerequisites that need to be completed before firing. By prerequisites, I mean that some action has to happen before a user reaches the page you want the tag to fire on for it to fire.
For example, If you are trying to fire a Google Adwords conversion code on a thank-you page. That conversion code won't fire unless someone actually came to your site after clicking on an Adwords ad. If a person came organically, then that tag shouldn't fire, otherwise all your conversion reporting would be over counted.
Hope this helps!
I also have this problem which i found an answer to. After creating your tags and linking the
macros properly, preview in debug mode, it should FIRE. But take note that it wont count on Adword Conversion account.
I think you add a rule dat says gtm.formSubmit it worked for me.
Try it out.

How to use Google Analytics Tag Manager to track off site links

I noticed that Google has released their Tag Manager application making it really easy to make changes to your tags and tracking options. How can I use this tool to track off site links?
Google Tag Manager (GTM) is not a tracking tool, so the short and unhelpful answer is that you can't. However you can deploy Google Analytics via GTM, which I guess is what you mean. I have to say, though, that tracking offsite links turned out a little less straightforward than I expected it to be.
Usually you track external links by virtual pageviews (or events). The usual way in GTM would be to push a variable to the data layer on the click event of the link and then fire a GA tag with a virtual pageview based on a rule based on that event. This failed completely for me when I tested it, presumably because the new page had loaded before the GA tag could fire. So I resorted to a not very elegant workaround:
First I created a standard Google Analytics Tag (tracking type pageview) to make sure the GA code was included in the site. Then I created a custom HMTL Tag with a bit of Javascript (this is assuming you use jQuery in your page):
<script>
$('a').click(function() {
var p = $(this).attr('href');
if (p.search(/.+YOUDOMAIN/) == -1){
_gaq.push(['_trackPageview', "external://" + p]); // mark links as external in the GA interface
}
});
</script>
For all links that do not contain YOURDOMAIN a click event with a pageview is attached to the link. To make sure the all the links are tagged with the click event you set a rule in the tag manager to make sure the script is executed only after the page has loaded you set event based rule in the tag manager where the event is equal to gtm.load (gtm's equivalent of jQuerys domReady).
This works (at least it did in my tests), but since it does not use GTMs intermediary dataLayer it looks rather like a hack to me. If anybody can suggest a proper solution I'd be grateful.

Resources