So I've found a few similar questions, but often either outdated, not exactly what I'm searching for or they don't use Google Tag Manager but write their tags in the <head>.
----------- Current situation -----------
We use Google Tag Manager to inject tags such as Google Analytics on our website. We use multiple tags depending on what needs to happen; such as:
tracking pages
tracking specific clicks
tracking log in or registration events
All the data goes perfectly to Google Analytics
----------- The problem -----------
However, we also receive data from other environments such as localhost:3000 or https://dev.ourdomain.com, which can result in inaccurate data.
----------- What we want -----------
Is a way to separate that data. By either:
Separating Google Analytics in data from production (domain A) and data from development (other domains)
Separate the data before it reaches Google Analytics (like my suggestion below)
Or maybe other suggestions
Between point 1 and 2, I'm more of a fan of the first way, as this would separate existing data into production and development data.
----------- Suggested solution -----------
I've been thinking about using a new property and then, using Google Tag Manager, I would return Google Analytics Settings depending on the current domain. Production would return UA-code-1 and development UA-code-2. The only issue however, is that every Google Analytics tag in GTM must be duplicated. With one containing the Google Analytics Settings for production, the other for development.
I was hoping there was a better way to tackle this, any suggestions?
You can still use single Google Analytics settings variable in your GTM and have a single instance of each tag but you can use some Lookup Table / custom JS variable inside your GA settings variable in place of tracking ID.
I assume you're using GA4, and if not, that would be a good idea since Google is really pushing the move from UA to GA4. You can create multiple properties for each domain, which would each have their own tracking ID. Then, in your index.html file where the installation code is, use some JS code to switch the tracking ID based on environment.
You'll also need separate Google Tag Manager containers for each property. If they all share the same container, you'll see the inaccurate data start to flood your properties.
This takes a bit of work, but will save you the hassle of inaccurate data being tracked in your respective properties.
Related
I'm a consumer data analyst who is not very familiar to coding other than occasional encounters with HTML and Python, and I'm just starting with the coding part of Web Analytics. In particular, I need to learn about checking websites I don't own (therefore I don't have access to their Analytics accounts) for tracking info, but it has been phenomenally hard to find information on which tracking function each component of code stand for, or to what extent it is visible from the page source.
For a project, here is a page I'm trying to check for Google Analytics/Tag Manager/alternative analytics setup, and see what is exactly being tracked on it. Other than the source code, I checked it with Ghostery, which gave me this Tag Manager code page. Is it possible to check tracking info from these two (events, pageviews, URI and how many custom dimensions there is, specifically), and which part of the code includes that info (particularly URI and dimension info - the first two, I have more idea about)?
This is a page I'm also looking into. I can see that this one has Google Analytics/Tag manager, but again, I can't make sure of what is being tracked, and whether the Analytics/Tag Manager setup is looking -potentially- problematic in any way. Here is the Tag Manager page for this one that I obtained through Ghostery.
Any help would be much appreciated...
Looks like what you are looking for is Google Tag Assistant extension for google chrome: https://get.google.com/tagassistant/
you can download it from here: https://chrome.google.com/webstore/detail/tag-assistant-by-google/kejbdjndbnbjgmefkgdddjlbokphdefk?hl=en
When you install it it will appear as icon on any page you visit and it will show you all GA implementations on a page:
You can select tracking ID you are interested in and it will tell you how many Page Views/events were fired for that particular tracking ID only:
Then you can select individual tracking event/page view and see all data that are being sent with that tracking request. Just Click on URLs and click the icon to put the data in table:
Here "cd" stands for Custom Dimension, so here you can clearly see 2 custom dimensions that are being tracked:
Hope this helps, good luck!
i need too track Members and non-members in the website using google tag manager. specifically, it is important to distinguish users prior and after sign up process and not overwrite them as members (even though they entered the website and non-members). i don't want to push the data directly to the google analytic so i need to create tags in google tag manager to be fired.
any suggestion?
cheers
You might want to take a look at Custom Dimensions to track the status of visitors on your site. For more information on Dimensions, you may find more details on Google's Support pages: https://support.google.com/analytics/answer/1033861
This would allow you to segment the data and Reports in Analytics based on those Dimensions.
Otherwise, if you cannot send data to Google Analytics from Tag Manager, you might want to track users by settings cookies according the specific Rules. This article provides a gist of how to set cookies from within Tag Manager: http://www.simoahava.com/analytics/universal-analytics-fire-script-just-per-session/
I am using Google Tag Manager on all my sites now to implement Google Analytics and future proof them for any other scripts.
I am putting GTM in my boilerplate.
Is there any reason this might not be good practice?
Any reason why a website (that needs GA) should avoid Google Tag Manager?
Most websites will require some sort of Javascript code added in the future for affiliate tracking, various analytics and having GTM installed will allow for easy installation of any such JS code easily.
Or, as Google puts it: "Why wait months for site code updates? Google Tag Manager lets you launch new tags any time with a few clicks, so you never miss a measurement or marketing opportunity."
Since GTM does not come with a service level agreement you could (very very tenuously) argue that GTM adds an additional point of failure. And if one wanted to be pedantic one could point out that not all ways of analytics tracking work with GTM (if you track serverside via the measurement protocol).
But real life argument, there is none (IMO).
There might be pages that do not greatly profit from GTM (or any other Tag Management) if all you do is to deploy a single analytics tag to track pageviews. But the second you need to track an event or pass data GTM is already worth it.
This is not meant to be merely opinion based, it's more that in 2,5 years of using GTM on large sites I have been unable to find any scenario where the tag management code has caused any technical problem or interfered with existing code. On the other hand I do not write click handlers or submit handlers anymore, I have a boilerplate template for a container tag in which I just have to replace values for a few macros before I import it to GTM and have tracking up and running, I can set data fields with much less trouble than via the code... so I think there is a real technical argument to make in favour of GTM, and none against it.
I have not been able to find clear answers to the following:
for a client with several country sites (subdomains) I want to use a Google Analytics account per site, plus a roll-up account to collect data of all country sites into one account. I want to use Google Tag Manager to add the analytics to the sites.
To add 2 Universal Analytics tracking IDs in one container for a site, is it needed to change a name somewhere? As you have to do when adding analytics code manually to a site when using an extra roll-up account.
If so, what exactly?
subsequently I want to use autoevent tracking. To track for instance PDF downloads - which are in this case on outbound links. Which is explained in this Justine Cutroni post: http://cutroni.com/blog/2013/10/07/auto-event-tracking-with-google-tag-manager/
But instead of using the standard macro for url path, I would rather see the url title or the linktext, as the url path is indecipherable in this case (a bunch of numbers and letters).
How can that be achieved? Given that the downloads are from dynamic catalogue pages (and thousands of them).
thanks
Why multiple accounts ? This would just work as well with profiles/views. That could potentially save you a bit of headache (if you have multiple trackers you need to push events etc. to all of them - for multiple view you just need a filter in your view settings).
Having said that, you find the settings for the tracker name under "advanced configuration" in the analytics tag template in the Google Tag Manager (both for ga.js and Universal Analytics). Tick the checkbox with the label "Tracker name" and enter the name (you need to rename at least one the trackers).
Is there something special about tracking a google analytics experiment across subdomains?
I have an experiment set up in an account which tracks a top-level domain and several sub-domains. The experiment is implemented in javascript and the experiment Id and variation are set using
cxApi.setChosenVariation(chosenVariation, opt_experimentId)
which is placed above tracking code (included via google tag manager). When creating the experiment I gave two dummy urls as the page variations and chose the 'Insert code manually' option, (although I did not insert the code as advised at https://developers.google.com/analytics/solutions/experiments-client-side :"The Experiment ID is the only information needed to continue and implement the experiment. The JavaScript snippet is not used.").
The experiment tracking is working for the top-level-domain, but not any of the subdomains. This seems strange because the account in which this is set up records all other tracking data successfully for all sub-domains. Does anyone have any idea what I might need to do to get the experiment tracking working in the sub-domains as well?
Thanks