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:
- Install and activate the
Code Snippets
by Code Snippets Pro WordPress plugin - In the WordPress Admin sidebar, click on
Snippets
- On the Snippets page, click
Import
- Select the first checkbox option and upload the downloaded JSON file by clicking
Choose files
, select the JSON file and then clickUpload files and import
- Once the file is uploaded, click on
Snippets
in the sidebar - 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
- 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 'cdn.usefathom.com' 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:
- In the WordPress Admin sidebar, click on
Snippets
- In the table, find the 'fathom SGO excluder' row and click
Edit
- Here, you need to replace
cdn.usefathom.com
(see the highlighted code below) with the custom domain URL you are given in your Site Settings.
- Click
Save Changes
- 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.