I have been working on integrating GTM and GA to my website, using Environment Variables to setup GA Property Views for different setups.
I found similar solutions in various blogs, i.e., by setting up Lookup Tables or RegEx Table, with lookups for GA-Tracking-ID.
ISSUE
Lookup Tables adds a prefix vtp_ to the keys present in default GA-settings obj, as shown below:
Due to this, GA doesn't work.
If I use the GA Settings Variable directly, Everything works fine.
This happens on current Dashboard Setups for GTM and GA.
You cannot use a Google Analytics Settings variable as the output of a Lookup Table variable for a simple reason:
The "Google Analytics Settings" field in a tag is the only place where you can use a Google Analytics Settings variable, and it is the only type of variable you can use there.
In other words, if you create a Lookup Table variable that returns Google Analytics Settings variables, there's no place to add that variable to, since the only valid place would be the Google Analytics Settings field which, as noted above, doesn't accept Lookup Table variables.
Trying to add the Lookup Table into the "Tracking ID" field, for example, is a mistake, since the table returns a Google Analytics Settings object rather than a valid tracking ID.
i had the same issue, and i was mapping the lookup values to variables of type google analytics settings:
i changed them to strings then it started working:
Here's how I did it successfully with Dev and Live environments setup.
Enable Environment Name in Built-In Variables
Create a Lookup Table variable in User-Defined Variables as GA Tracking ID - ENV
For the Lookup Table row, change it accordingly. In my case, my environments are only Dev and Live so I put it there.
Create a Google Analytics Settings variable in User-Defined Variables
For the Track ID, select the GA Tracking ID - ENV - that's all the variable config for this to work in minimum.
Then Create a Tag for the Google Analytics
Make sure to select the Google Analytics Settings created.
Related
I would like to ask how could I exclude unwanted referrals from GA4 and Firebase? In my particular case, I would like to exclude checkout.stripe.com from purchase event sources.
I've added checkout.stripe.com to the unwanted referral list (Data Streams -> More tagging settings -> List unwanted referrals)
and specified my domain (Data Streams -> More tagging settings -> Configure your domain).
However without a satisfactory result - still each purchase conversion is assigning to checkout.stripe.com
To configure GA4 in my project I'm using the Angularfire library.
OK, I know how to fix it.
To filter unwanted referral from GA4 use domain instead subdomain. So in this particular case the proper configuration the "Match type" is "contains" and the domain field to "stripe.com".
I've already verified that my GTM and GA are linked correctly, and I've got a couple of virtual pageviews working (i.e. I can see them in the GA realtime report). But, I'd like to attach some metadata to these virtual pageviews, and I thought I'd accomplish this using custom dimensions.
This is how I've got it setup. In my pageview tag (the one that corresponds to a virtual pageview), I've set a couple of custom dimensions, as such:
Index | Dimension
1 | {{D1}}
2 | {{D2}}
where D1, and D2 are dataLayer variable macros.
I've also made sure to create these custom dimensions in my GA properties. Both are user scoped and have names that correspond to the dataLayer variable name (not the macro name).
I've set my GTM container to preview mode and checked the requests being sent, and the dimension looks like it's being sent correctly:
Dimension: {1: "d1 val", 2: "d2 val"}
Lastly, I'm setting these fields accordingly in the dataLayer whenever a fire a virtual pageview event (that triggers the pageview tag with the virtual url).
However, I'm not sure where to look for them in my GA report. They don't appear to be anywhere in the realtime report.
That gets me wondering, are custom dimensions not supported in real time reporting and I simply should just wait for GA to process them? Or should I assume something's wrong with how I'm setting it up?
They are not supported at this time.
Here is a list of the supported realtime dimensions and metrics:
https://developers.google.com/analytics/devguides/reporting/realtime/dimsmets/
I have a webapp that hosts several thousand subdomain sites under a single Google Analytics property. I'm in the process of upgrading my tracking tags from the old ga.js system to the new analytics.js-based system (Universal Analytics).
In my old setup, when the tracking code got instantiated, I would send a site id to GA as a custom variable. Then, when pulling analytics for my users, I would simply filter on site ID as follows:
https://www.googleapis.com/analytics/v3/data/ga?
ids=ga:76149262&
start-date=2015-01-18&
end-date=2015-01-20&
metrics=ga:visits,ga:pageviews,ga:uniquePageviews,ga:pageviewsPerVisit,ga:bounces&dimensions=ga:date&
filters=ga:customVarValue1==f6853365a940330037c3aceff36de412&
max-results=100
In the new Universal Analytics system, there are no custom variables, as these have been replaced by dimensions. No problem. I've created a new dimension called siteHash and I've been submitting it along with each page request. What's more, I'm able to query this with only one tiny modification to my API request above:
https://www.googleapis.com/analytics/v3/data/ga?
ids=ga:76149262&
start-date=2015-01-18&
end-date=2015-01-20&
metrics=ga:visits,ga:pageviews,ga:uniquePageviews,ga:pageviewsPerVisit,ga:bounces&dimensions=ga:date&
filters=ga:dimension1==f6853365a940330037c3aceff36de412&
max-results=100
As you can see, I've just changed ga:customVarValue1 to ga:dimension1, and everything works.
Here's the issue: Once I push this code change to production, a lot of my sites will start to have a mixture of old data and new data. The old data will be tagged with the custom variable and the new data will be tagged with the new dimension. How can I query on both ga:dimension1 and ga:customVarValue1 at the same time within the same query?
I've tried creating an "OR" query as described here: https://developers.google.com/analytics/devguides/reporting/core/v3/reference#OR
This yields a filter parameter that looks like this:
ga:dimension1==f6853365a940330037c3aceff36de412,ga:customVarValue1==f6853365a940330037c3aceff36de412
Unfortunately, doing an API request with this filter yields no data. Does anyone know why? Is there a prohibition on filtering on dimensions and custom variables at the same time?
Assuming this is, for some reason, impossible. Is there any way to convert already collected custom variable data into dimension data? If I were able to do this, I could just query the API and only filter on dimensions since all of the old custom variable data would now be dimension data.
I have two domains, a .nl and a .be domain. Both have their own Google Analytics IDs. Currently I have the analytic code on the website and, depending on the domain, the correct ID is inserted into the code. The tracking works correctly on both sites.
Now I want to implement the Google Tag Manager, to get more flexibility for Javascript.
The struggle is now how get to the same result, without implementing the Google Tag Manager twice (or more if more domains are added).
How can I achieve this? I tried with the rules in combination with a regex on the {{url}}, but without any success.
The best way if you want to prepare for more domains would be a lookup table macro.
First create a url type macro that return the hostname. Then create a macro of the type lookup table - that is a macro that returns a value based on the value of another macro. It should look something like this ( {{url hostname}} is the macro that holds, well, the hostname) :
Then insert the macro name ( {{Google ID}} in the example in the screenshot) in the "Tracking ID" field in you Google Analytics Tag and it will be set according to the domain name. If you want more domains just add a row to the lookup table.
From what I understand, the data passed in POSTs from a form on a site is not tracked by Google Analytics. What about any variables that get passed in the URL, as in ?value=bla
Does value=bla get stored by GA?
If so, is there a way to not track variable info from the URL?
I am aware of the anonymizeIp for IPs.
GA profile settings have a text field where you can enter query parameters that should be ignored. You can also set up an advanced filter to summarily excludes all query parameters (simply google "exclude query parameters google analytics", there a lot of tutorials on how th do this).