We have always deployed Google Analytics on All Pages. But lately we want to structure our website to feed different data to Google Analytics based on the domain/projects. I recently tried to deploy Google Analytics and add a Page Load rule that looks at the utag_data.project variable. And based on the variable loads a specific instance of Google Analytics.
The problem we are facing though, as soon as you activate Load Rule for Google Analytics, the event tracking gets disabled.
Is that a known concern? Is it a bug? Is there a workaround? Why does it happen?
Does anyone have any details on the questions above, please let us know. This has been causing some many issues for us :)
Solved! Go to Solution.
09-23-2020 05:10 PM
Hi @irraghav7, welcome to the TLC!
It looks to me as if you've got scoping issues, and you're trying to set the rule based on a variable that isn't yet defined.
Is it possible for you to set up the load rule for the GA tag to look at the URL instead? You can then set up a Lookup Table extension mapped to the Google Account ID to set the UA-xxx string based on URL as well.
09-24-2020 05:51 AM
Thanks for responding Christopher. This does seem like a very sound assessment of the issue. I can definitely try that. The problem I am facing though, the organization has a very complicated structure, and there is a one-project to many-domains implementation. So, www.company.com/main and www.company.com/sub-page will be have utag_project="host" and utag_project="exchange".
Now multiple that over 50+ domains and hundreds of pages over the last 10 years, so I might not even know where some pages are.
09-24-2020 08:25 AM
Hi @irraghav7 ,
Could you please have a look, when you fire utag.link call, the UDO variable which you have given in the load rule is getting populated with the call ?
You could use document.cookie='utagdb=true' to check the variables getting populated in the 'b' data object.
This is the right solution, apparently.
GA is meant to be set as a global tag on all pages (best practice). But, As we are adding load condition and the value is being picked from the data layer, we have to make sure that the utag.link payload contains the load condition values. That is the only way it will work.