Google Analytics - Tracking multiple websites (top

2019-03-31 06:00发布

I have 10 top-level domains e.g. example1.com, example2.com, example3.com, etc, and each domain has its own, unique website (not redirects). My goal is to have one Google Analytics account and one web property for all 10 websites, a master profile (the default) that shows me metrics of all websites combined, and 10 individual profiles for each website to limit the view to just that website... as if it had its own Google Analytics account. After much research and reading, I think I determined that all I would need to do is add the following code to each website:

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX']);
_gaq.push(['_setDomainName', 'example1.com']);
_gaq.push(['_trackPageview']);

(function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

Where the only thing that would change on each website would be the _setDomainName to match whatever the website's address is e.g. example2.com, example3.com, etc.

Also, one website is actually at a sub-domain of a top-level domain (anothersite.example4.com), so I'm guessing I'd put exactly that in the _setDomainName variable in that instance (regardless of whether it's a top-level domain or sub-domain.

Can someone confirm that I interpreted this correctly? Am I missing anything and is this a good way to set that up if I own all 10 web properties and want to later create an account for each website administrator to view metrics for their website only?

1条回答
等我变得足够好
2楼-- · 2019-03-31 06:44

If you do it the way you suggested, you would have to set up some filters:

  • one on each of the 10 domains to filter just incoming data for that domain

  • one on the "master" profile that includes the domain name in the page URL to keep the pageviews from combining on like named pages across domains (i.e, example1.com/contact.html and example2.com/contact.html)

This is all in addition to a "raw" profile in case the filters cause complete data loss.

11 filters in total.

That's a lot to get right since filters must be exact and they affect all incoming data.

A different suggestion would be to add multiple trackers. Track your "master" as one property and each of the other domains on their own property with their own GA tracking code as such:

_gaq.push(
  ['_setAccount', 'UA-XXXXX-1'],
  ['_trackPageview'],
  ['b._setAccount', 'UA-XXXXX-2'],
  ['b._trackPageview']
 );    

This keeps every domain from cross pollinating another except for the "master" property where all the data gets dumped.

Create another "raw" profile of the "master" for safe keeping.

Put a filter on the "master" for domain name so you can distinguish which domain the page came from in the reports. See Modify your cross-domain profile with a filter to show the full domain in your content reports.

Now you have everything properly cordoned off, you can give access to the unfiltered data to each website administrator without having to fool with too many filters.

Summary:

Master property: 2 profiles, master (filtered to include domain name) and raw (unfiltered)

One property for each domain: 1 profile in each (no filters)

Tut on Tracking Multiple Domains Individually and as a Group in Google Analytics

查看更多
登录 后发表回答