Вопрос

And how to set it up?

When I go to Adming -> +New Account, I need to enter a) Website name, b) Website URL, and c) Account name. I would like to use the code on a network of 25 sites, and there is no option not to enter a URL. When I enter it, it displays in the Analytics code that I get afterwards.

When I looked at a Google Analytics code on one of my sites, which is over one year old, it looks something like this:

<script type="text/javascript"> var _gaq = _gaq || []; _gaq.push(['_setAccount', 'UA-01234567- 1']); _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>

When I am getting a code right now (which is suppose to be the code for a network of sites), it looks like this:

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-41928014-1', 'test.com');
ga('send', 'pageview');
</script>

it contains a URL / domain name in it.

In general I know that I need to set up an account, and apply filters (to have access to data for individual domains), but I am not sure how to do it step by step (especially with the test.com in the analytics code, as in the example above). Maybe there is a different / better way to do it?

Thank you.

Это было полезно?

Решение

'test.com' is optional an optional parameter in that it only provides a reference for subdomain tracking, so you can leave that off and put the code on all your sites; however, if you have subdomain for those 25 sites, you'll run into problems not being able to track (see documentation https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#cookieName)

I take it that you are trying to have a Roll-up profile for all of your sites? That's great and all, but I would highly recommend creating a separate property for each, as if your sites' get a lot of traffic, you could run into sampling.

Have you heard of Google Tag Manager - http://www.google.com/tagmanager/ ? I would look into this if you have that many properties, as it will make updating any changes to those tags far easier and take much less of your time.

Ideally, you set it up like this:

1) create a container (apply this container code to all your websites)

2) create 25 Google Analytics Tags in GTM and setup a rule that if {{url}} equals test1.com, then use test1 Google Analytics tag.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top