2

I have a website that sits on multiple domains, and I want to track them universally. For now, I don't care about statistics per-domain, I just want to see overall page views. I also don't care about links between domains - they could be counted as two sessions.

So in the https://analytics.google.com dashboard, I've created a new property, but it required me to enter a "Default URL" (where I picked only one of my domains). Then I found the Tracking Code, which begins with <!-- Global site tag (gtag.js) - Google Analytics -->.

I then read about universal tracking with Tag Manager: https://support.google.com/tagmanager/answer/6164469 so I created a tag of type "Google Analytics: Universal Analytics" with a variable with the tracking id from the Google-Analytics' property, and with Cross Domain Tracking configured with all of my domain names (separated with a comma). The Tag Manager has a button in the title bar that looks like: "GTM-..." - it opens a popup window titled "Install Google Tag Manager" with some code that I need to embed in the head tag: <!-- Google Tag Manager --> and some code to embed in the body tag: <!-- Google Tag Manager (noscript) -->.

Do I need to embed only the gtag code? only the Google Tag Manager code? Or both?

Thanks

  • Welcome to Webmasters! – closetnoc Sep 25 at 1:50
2

Unless you have actual links, linking between the sites, or mechanisms in place that move site visitors between sites (eg site registration taking them to another site upon completion or similar), then cross domain tracking is not needed or going to work. What cross domain tracking does is for instances where visitors travel between sites, it shares the cookie and session information between the two, so that originating referrer traffic for a visit is not lost and sessions are not inflated due to changes in source/medium mid site visit.

If you are using Google Tag Manager and have a Universal Analytics pageview tag setup and configured within it for tracking pageviews, you should be good to go.
If that is the case, you do not also install the gtag.js tracking code snippet as that will result in double counting of pageviews etc. Use either gtag.js or GTM for GA tracking tag setup .. not both.

If you should wish to see which hostname your pageviews are occuring on you can add a Secondary Dimension of hostname to the Behaviour > Site Content > All pages report. Alternatively, create another view and apply a filter that prepends the hostname to the request URI in the reports.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.