I have seen GA requires a cross-domain tracking setup if Subdomain and main domain is not related.
How to manage verification using Matomo?
store .example.com and
example.com
Do we need just different ID’s or it is an issue when we monitor as we do not like double counts?
Lukas
(Lukas Winkler)
July 10, 2019, 12:05pm
2
It is a very difficult issue.
Do we need just different ID’s as SubDomain is not related to main domain or ID on the main domain will track Subdomain? Is there any added code to prevent this?
Lukas
(Lukas Winkler)
July 10, 2019, 12:19pm
4
Hi,
I am not sure I understand what you want.
If you want to track them into different websites, you can simply use different siteid just as if they were different websites.
If you want to track them into the same website in Matomo (because they are the same) then you need to follow the guides I linked above.
Sorry, please find current ID:
_paq.push([‘setSiteId’, ‘22’]);
Main domain uses 22 and Subdomain will be just put
_paq.push([‘setSiteId’, ‘23’]);
Main question is if ID like 22 tracks additional Subdomain or we add some code to prevent this.
<!-- Matomo -->
<script type="text/javascript">
var _paq = window._paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//XXX";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '22']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->