Fathom Analytics

The canonical link is king

Before we dive into this, we want to explain that this isn't a common issue but we've seen it happen in Single Page Applications (SPA) and in other rare situations. For 99% of our users, you don't have to worry about this article.

When Fathom tracks page views, it looks at window.location to determine the full URL of the page.

window.location.hostname // e.g. usefathom.com
window.location.pathname // e.g. /support/cannonical-links

But if you have a canonical link tag in your code, the value there will override everything.

For example, if you had the following code on all of your pages:

<link rel="canonical" href="https://www.yourwebsite.com/">

We would always track https://www.yourwebsite.com/ regardless of whether you were on /about, /contact or any other page. This is because canonical is considered to override everything. You can read more about Canonical Links here.

So if you're navigating round your site and only seeing a single path in your dashboard, chances are you have a canonical link issues.

If you want to ignore canonicals

If there’s a canonical URL in place, as noted above, then by default we use it instead of the current URL. This is what most customers want, and it’s why it’s the default.

If you want to use the current URL, even if there’s canonical (ignoring the canonical), then use data-canonical="false":

<script src="https://cdn.usefathom.com/script.js" data-site="ABCDEFG" data-canonical="false" defer></script>
← Return to support