Skip to main content
Support home / Script Settings

Multiple site IDs with one website

If you perhaps have multiple areas in your site that different parties are responsible for, and those parties would like to have to their own dashboard to collect and filter their stats on, there is quite a smart and simple method of doing this in Fathom.

Step 1: Create the relevant sites in your Fathom account

First of all, you will want to set up the necessary amount of sites in your Fathom account to obtain each site’s Site ID.

Step 2: Disable automatic tracking in Fathom

Next, you will have to disable automatic tracking for this method to work. You do this by adding data-auto="false" to your script. See our section on this in advanced script settings to read more about this. The reason for doing this is because you want to be able to override the script's Site ID on each page.

Step 3: Add the Site ID switching code

Now in the footer (or in a JS file) of each page that you want to track pageviews on, add the following script:

window.addEventListener('load', (event) => {

Note: Make sure to replace ‘XXXXXXX’ with the relevant Site ID

The above script is letting Fathom know which site to assign the pageview. It's setting the Site ID and then it's firing the "trackPageview" function to log a view in the dashboard.

Step 4: Checking it works

Visit a couple different pages on your website where you know the Site IDs are different, and then check the relevant Fathom dashboards for those Site IDs to ensure a visit has been reported.

If you still have questions or require help with anything, please reach out to us and we'll happily get things sorted out for you.

Can't find what you're looking for?