Implementing Two Analytics Properties in One Container with GTM

I want to implement Google Tag Manager over two domains that contain the same site code / cms / code, but with a different content language. So I want to use one container (one GTM code) with two tags in it. One tag contains the UA snippet for domainA.com and the other for domainB.com.

Here's the problem. How can I tell GTM that the analytics tag for domainA.com will only fire on www.domainA.com, domainA.com with and without https and / or http. Same case for domain B

I was thinking about using the firing rule with regex ^ (https?: //)? (www.)? mysite.com

Will the above option work with GTM and is this best practice? Or should I use two different containers so that domainA en domainB has its own unique GTM tag?

+3


source to share


1 answer


Create a url macro of type "hostname". Create a lookup table macro that assigns a property ID according to the value of "hostname". Include this macro in your Universal Analytics template tag. Use the default "all pages" rule (it will run on both http and https pages without issue). If you want to use the same configuration for both domains, that's a lot less than creating tags twice with different IDs and rulesets.



+4


source







All Articles