I
I
Ivanko2018-03-25 22:27:36
Search Engine Optimization
Ivanko, 2018-03-25 22:27:36

One analytics code for multiple sites?

For example, there are 10 sites - it is impossible to install the same code for Google Analytics and i-metrics so that the statistics in the context of each site can be seen separately in the dashboard as usual?
Or perhaps there are alternatives?
Thanks to.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
F
Felix_vek, 2018-03-26
@ivan99

Good afternoon ,
why not, you can. This is called cross-domain tracking or cross-domain tracking.
For Yandex Metrica, it is enough to place the same code on different sites. after which you should specify the name of these sites in the counter settings in the "Site address" field.
GA is a little more difficult. In addition to placing the same code on the pages of the site, you need to slightly finish the counter code for cross-domain tracking - https://developers.google.com/analytics/devguides/...
In other words, your counter will look like this:

(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','https://www.google-analytics.com/analytics.js','ga');

  ga('create', {
    trackingId: 'UA-XXXXXXXX-1',
          cookieDomain : 'auto',
    allowLinker: true
  });
  ga('require', 'linker');
  ga('linker:autoLink', ['site-1.com', 'site-2.com']);
  ga('send', 'pageview');

P
Puma Thailand, 2018-03-25
@opium

You can do this in Pivik

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question