Sign inFree trial
Support home / Script Settings

Exclude embed script from SiteGround Optimizer caching

If you have a WordPress site that uses the SiteGround Optimizer plugin and you have followed all of the suggested steps to get the Fathom script collecting visit data on your site, but your dashboard is still not being populated with data, the SiteGround Optimizer plugin is most likely the cause of the issue. This is because it will be caching and minifying the Fathom script, preventing it from working correctly.

Unfortunately, excluding the Fathom script from the SiteGround plugin is not as straightforward as it should be. But don't worry, we have a simple workaround that does exclude the Fathom script and prevents it from being cached and minified by the SiteGround plugin.

Step 1: Download the JSON file

To begin, you need to download this JSON file, which will inform SiteGround to exclude the Fathom script. Unzip the file to get the JSON file from the ZIP file.

Note: If you are using a Custom Domain, make sure you action step 3 and replace the default Fathom script URL with your custom domain script URL

Step 2: Importing the JSON file

Next, go to your site's WordPress admin and follow these steps:

  1. Install and activate the Code Snippets by Code Snippets Pro WordPress plugin
    Code Snippets Plugin Install
  2. In the WordPress Admin sidebar, click on Snippets
  3. On the Snippets page, click Import
  4. Select the first checkbox option and upload the downloaded JSON file by clicking Choose files, select the JSON file and then click Upload files and import
    Importing a snippet
  5. Once the file is uploaded, click on Snippets in the sidebar
  6. You should now see an entry in the table for the file you've just uploaded. Click the toggle button for that file to activate it
    Activate the imported script
  7. Click Purge SG Cache in the top navigation bar

Step 3: Amending the default script URL to a custom domain URL

Note: If you are not using a Custom Domain (i.e. using '' in your script URL), you can skip this step.

If you have set up a custom domain in Fathom for your site, you need to edit the default script URL within Code Snippets to change it to your custom domain URL. To do that, follow these steps:

  1. In the WordPress Admin sidebar, click on Snippets
  2. In the table, find the 'fathom SGO excluder' row and click Edit
  3. Here, you need to replace (see the highlighted code below) with the custom domain URL you are given in your Site Settings.

Editing the code snippet

  1. Click Save Changes
  2. Click Purge SG Cache in the top navigation bar

Step 4: Testing

Head over to your site and refresh the page to ensure that the cache is cleared. Now, check your Fathom dashboard to see if your visit is being displayed.

If there is still no data appearing, you may have missed a step from the above instructions or have another WordPress plugin that is causing issues. We have written more about troubleshooting WordPress plugin issues here.

If data is appearing, congratulations! You can now sit back and watch visit data appear in your dashboard.

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.