Custom Tracking Domains


I just might have a easy question but I am struggeling a little with it. If I host my matomo here, all tracking requests go to this domain and some of those might be blocked due to apps and extensions.

Is it possible to create custom tracker domains, so my tracking is going to and then forwards the calls & data to my Matomo instance? Can I achieve this with a CNAME or redirect, or am I missing something here?

I found something related here:

Anyone that can assist with tha?

Best regards

Use symlinks in you webhost/server backend. → (dir) /example → (symlink) /analytics.example/example

But that will not resolve the problem with the blocking, because in the most cases the matomo.js (piwik.js) is blocked. You must also use symlinks for the matomo.js (piwik.js).

not quite sure if I understand this but I the other url for the “first party tracking” is the one of a customer so I would need make a entry in his DNS right? The change of the .js and php should be possible with the white label solution

A solution with CNAME sounds like easy, but is complicated about the SSL certs (both must have one own), and it upranks the website as “cloaking”.

The using of a subdomain is (literally) suboptimal. Few browser rank this as third party and there is no advantage. When you host the website and matomo on the same domain, it is better to use a own subdirectory (url and server). Than the DNS stay untouched. In your case this is irrelevant, but it is simpler with a subdirectory instead a subdomain.

As far as I know only the matomo.js / piwik.js is affected. Not the matomo.php / piwik.php.

Workflow: = your matomo installation.

Your domain setting in the webhost/server backend (example): → (dir) /matomo/

Create a subdirectory: (dir) /matomo/whatever/

Create a symlink: (symlink) /matomo/whatever/whatever.js/matomo/matomo.js

Use this URL path for the matomo JavaScript tracking code:

This points to: /matomo/whatever/whatever.js/matomo/matomo.js

So, the matomo.js is never visible in the URL path.

I think I understand it partially but what if I have a shopify store (client) and do matomo as agency setup for multiple clients (sorry if this is a stupid question). How could I make it happen, that all URLs for his website are on his domain and the tracking data ends up at I think this is kind of what the eTracker Blog article was about right?

I don’t understand your request. Matomo is only a tracking code that is implemented in website-pages. With this tracking code the matomo installation will be requested, respectively the code implement the matomo.js in each website-pages.

When you use symlinks for the matomo.js and the matomo.php you must modificate your tracking code on three points:

<!-- Matomo -->
<script type="text/javascript">
  var _paq = window._paq = window._paq || [];
  (function() {
    var u="//"; ←←← MODIFICATION HERE
    _paq.push(['setTrackerUrl', u+'whatever.php']); ←←← MODIFICATION HERE
    _paq.push(['setSiteId', 1]); ←←← THE TRACKING SIDE ID HERE
    var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
    g.src=u+'whatever.js'; ←←← MODIFICATION HERE
<!-- End Matomo Code -->

The Urls of the website-pages stay untouched.

When you need to modificate the website-domain, use this:

_paq.push(['setCustomUrl', '']);

Read here:

Hi @melbao
I think what @Johannes_Boppre means is the case where there is an e-commerce and analytics are not operated by the same company (analytics are done by web agency).

@Johannes_Boppre, I think you can do either log analytics (just for page views) or develop tracking proxy (in the web site backside language) or “proxy” the web agency tracking assets (scripts + API) as @melbao suggested:

A tracking proxy sounds quite interesting, maybe that is something that could be exposed as API on the analytics backend in a subdirectory and then the domain can point to it.

Tracking Backend:

So now if I load the Tag Manager and send the .php tracking I could use a “first” party subdomain or maybe even a directory

Tracking Proxy: → pointing to
Tracking Proxy → pointing to

I just read that maybe you can get up to 5-10% more traffic coverage if you are having it in the same domain. It is detailed here in the blog article:

It’s about third party cookies. That match only when you use tracking with cookies. It match also with subdomains, because few browser handle subdomains as third party.


Not match:

Or when the domain/subdomain for matomo is listed in a block list.

I am new here, I am doubtful should I ask the doubt here or have to start a new thread?

new thread please.