Skip to content
FunnelGuard

Fix guide by FunnelsGuard

Matomo tracking with wrong site ID: how to find and fix it

TRK-247Low impactCould addBy FunnelGuardPublished Updated
On this page

What this issue is

Matomo is an analytics tool. Every website you track in it gets a number called the site ID (idSite). The tracking code on your pages includes that number so Matomo knows which site a visit belongs to.

The problem happens when the number in the code does not match the site you meant. Common causes: a tracking snippet copied from another client's site, a staging site cloned to production, a site deleted and re-created in Matomo (which gives it a new ID), or a plugin or tag setting typed in by hand with a typo.

Where the site ID sits in a standard Matomo snippetjavascript
var _paq = window._paq = window._paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
  var u = "//analytics.example.com/";
  _paq.push(['setTrackerUrl', u + 'matomo.php']);
  _paq.push(['setSiteId', '2']); // <- must match the ID in Matomo
  var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0];
  g.async = true; g.src = u + 'matomo.js'; s.parentNode.insertBefore(g, s);
})();

Why it costs you leads or sales

Matomo does not change what visitors see, so the direct impact is low. The cost is bad data. If visits go to another site's reports, your own site looks quiet and the other site gets inflated numbers. If the ID does not exist, Matomo usually rejects the hits and nothing is recorded.

Then decisions go wrong: you pause a campaign that works, or you credit the wrong page for conversions. Goals and e-commerce tracking inherit the same mistake, so lead and sales counts in Matomo can no longer be trusted.

What the reports show

Wrong site ID

  • Your site's reports are empty or flat
  • Another site's reports show visits from your pages
  • Goals and conversions are missing or misplaced
  • Nobody notices until someone compares numbers

Correct site ID

  • Visits appear in the right site's reports
  • Real-time view shows your own test visit
  • Goals and e-commerce match what happened
  • Reports can be compared with other tools

How to check if your site has it

Compare the code with Matomo
  1. Find the right ID in Matomo

    Go to Administration (gear icon) > Websites > Manage. Each site shows its ID next to the name. Note the ID for the site you want.

  2. Find the ID your page sends

    Open your page, view source, and search for setSiteId. In Matomo Tag Manager or older snippets you may see idsite= or piwik.js instead.

  3. Check the network request

    Open browser DevTools > Network, reload, and filter by matomo.php (or piwik.php). Look at the idsite parameter in the request. This is the value Matomo actually receives.

  4. Test in Real-time

    In Matomo, open the Visitors > Real-time report for the site you expect. Visit your page in a private window. If you do not appear, check the other sites in your Matomo too.

  5. Check every environment

    Repeat on staging, production and any subdomains or landing page tools. Cloned sites often keep the old ID.

How to fix it

Change the ID in the one place that outputs the tracker. Remove duplicates, so you do not have two Matomo snippets with different IDs.

Fix the site ID by platform
  1. Open the Matomo plugin settings

    If you use the official Matomo Analytics plugin, go to Matomo Analytics > Settings and check the connected site. For self-hosted Matomo outside WordPress, use the Tracking tab and choose the correct site ID or paste the right snippet.

  2. Check theme and other plugins

    Search your theme's header.php and any header/footer script plugin for an old Matomo snippet. Remove the duplicate.

  3. Clear caches

    Purge your caching plugin and CDN so the corrected code is served.

How to confirm it's fixed

Confirmation checklist
  • Page source shows the correct setSiteId value
  • The matomo.php request has the right idsite and returns a 204 or 200 response
  • Your private-window visit shows in Real-time for the correct site
  • Nothing new appears in the wrong site's Real-time report
  • Only one Matomo snippet runs on each page
  • A test goal or form submission is recorded against the right site

How to prevent it happening again

Prevention habits
  • Keep a list of site names, Matomo IDs and domains in one shared document
  • Never copy a snippet from another client or site without changing the ID
  • Use separate Matomo sites (and IDs) for staging and production
  • Store the ID in one variable or config value
  • After a migration, clone or redesign, re-check the ID before launch
  • Look at Real-time in Matomo after every release that touches the header or tag manager

How FunnelGuard handles this

FunnelGuard does not check this yet. It does not read your Matomo site ID or compare it with your Matomo account. A Matomo check is a possible future addition.

What FunnelGuard does today is run your real customer journeys (lead forms, checkouts, booking and chat buttons) on a schedule and check the tracking hits sent to ad and analytics platforms such as GA4, Google Ads and Meta, plus whether test leads reach your inbox and CRM. That covers the conversions that matter, but not Matomo.

To watch for a wrong Matomo ID yourself, check Visitors > Real-time after each release, and set up a Matomo email report or a dashboard for each site so a sudden drop in visits stands out. Comparing Matomo visit counts with another source, such as server logs or GA4, also shows a gap quickly.

You can start with the Free plan (1 site, 2 journeys, daily checks, no card), or ask for the free read-only website audit.

Questions people ask

Why is my Matomo showing no data?

A common cause is a wrong site ID in the tracking code, so hits go to a different site or to an ID that does not exist. Compare setSiteId in your page source with the ID under Administration > Websites > Manage. Also check that the tracker URL is correct and not blocked.

How do I find my Matomo site ID?

Log in to Matomo, open Administration (gear icon) > Websites > Manage. The ID is listed next to each site's name. It is the number the tracking code must use in setSiteId.

Can I move Matomo data from the wrong site to the right one?

Not with a simple built-in button. Matomo has no standard feature to move visits between sites. Fix the ID so new visits are recorded correctly, and note the date of the change in your reports.

Why do my Matomo visits appear in another website's reports?

The tracking code on your site probably contains the other site's ID, often from a copied snippet or a cloned site. Change setSiteId to the correct number and make sure no second Matomo snippet runs.

How do I check which site ID my page is sending to Matomo?

Open DevTools > Network, reload the page, and filter by matomo.php or piwik.php. Look at the idsite parameter in the request. That is the ID Matomo receives.

Does a wrong Matomo site ID affect my ad tracking?

No, not directly. Ad platform tags such as Google Ads or Meta are separate from Matomo. But your Matomo reports will be wrong, so any decisions based on them can be too.

Does FunnelGuard check my Matomo site ID?

No. FunnelGuard does not check Matomo yet; it is a possible future check. It does monitor your funnel steps and the tracking hits sent to major ad and analytics platforms, so for Matomo use Real-time and report checks.

Does FunnelGuard catch this?

Could add

Not checked yet: could be added to FunnelGuard.

Stop finding out from your customers

FunnelGuard runs your real forms and checkouts on a schedule, checks the tracking and the leads behind them, and alerts you once, with a screenshot. Try any paid plan free for 3 days.