Please help why subdomains are not tracking?

Hi,

I’m trying to track subdomains like a.domain.com and b.domain.com.

I have tried so many permutations. The only thing that works if I explicitly add every subdomain under Websites > Manage > URLs.

Preference is for Matomo to track every subdomain where we have the tracking script without having to add every subdomain explicitly.

Current setup which is NOT working has this setting under Websites > Manage > URLs

http://domain.com
http://*.domain.com
http://*.*.domain.com

The tracking script is…

<script>
  var _paq = window._paq = window._paq || [];
  /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
  _paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
  _paq.push(["tracker.setCookieDomain", "*.domain.com"]);
  _paq.push(["setDomains", ["*.*.domain.com","*.*.*.domain.com","*.domain.com"]]);
  _paq.push(["enableCrossDomainLinking"]);
  _paq.push(['enableLinkTracking']);
  _paq.push(['trackPageView']);
  (function() {
    var u="https://domaincom.matomo.cloud/";
    _paq.push(['setTrackerUrl', u+'matomo.php']);
    _paq.push(['setSiteId', '1']);
    
  })();
</script>

What am I doing wrong?

Hi there,

The tracking code you have in place looks correct.
As long as the sub-domains you are wanting to track have the tracking code in place, these will be tracked into your Matomo Instance.

I have located a support case that you have sent us, which we have also replied too.
If you are able to respond to that support email, with the sub-domains that are not tracking, we can advise from there.

@goochj03 I replied 2 days ago via email.

Can you please see what the issue is? Just making sure it’s not sitting in spam.

Thank you,