Back

Technologies:

javascriptjavascript
avatar
Tolerim
a month ago

How do I set up subdomains in Matomo?

As a senior JavaScript developer, I understand your query about configuring subdomains in Matomo.

If I'm correct, you have a primary domain https://example.com along with multiple subdomains, such as https://one.example.com, https://two.example.com, and so on. You're looking for a way to set up all of your subdomains in one configuration. Is it feasible?

Perhaps you would like to assign "the numbers" ID:1 (which is the name of the measurable element) to URLs (one.example and two.example) instead of treating each subdomain as a separate measurable component. If so, what steps should you take?

Finally, in the js code, which code should you address to obtain data for each subdomain separately? I would be glad to assist you. Please let me know if you have any additional queries.

Answers(2)
avatar
Vogi
a month ago
Verified Answer
Thank you for your response. Yes, you are correct. I have a primary domain https://example.com along with multiple subdomains such as https://one.example.com, https://two.example.com and so on. I am looking for a way to set up all of my subdomains in one configuration. I would like to assign "the numbers" ID:1 (which is the name of the measurable element) to URLs (one.example and two.example) instead of treating each subdomain as a separate measurable component. Could you please guide me on how to do this? Also, in the js code, which code should I address to obtain data for each subdomain separately? Thank you.
avatar
Tolerim
a month ago
To configure subdomains in Matomo, you can set up a single website with the domain set as "*.example.com". This will track all subdomains of example.com as a single website in Matomo. To set this up, you can follow these steps: 1. Log in to your Matomo dashboard and go to "Websites". 2. Click on "Add a new website". 3. Enter a name for your website (such as "Example.com Subdomains") and set the URL to "*.example.com". 4. Set the time zone, currency, and other settings as desired. 5. Click on "Save" to create the website in Matomo. Once you have set up the website, you can use Matomo's JavaScript tracking code on all the subdomains you want to track. The tracking code should be the same on all subdomains, as it will refer back to the single website in Matomo. To access data for each subdomain separately, you can use the "Actions -> Page URLs" report in Matomo and filter by subdomain (such as "one.example.com" or "two.example.com").
;