Skip to main content
Support home / Integrations

Shopify

Adding the Fathom script to your Shopify website is a quick and easy process. Here's how you set up your Shopify site to work with our analytics:

Setting up the script

  1. Copy your Fathom Analytics script from your site settings.
  2. Sign in to your Shopify account.
  3. In the sidebar, click on Sales channels > Online Store > Themes.
  4. Click the ellipsis menu on your current theme and select Edit code.
    Editing a theme's code
  5. Within the Layout section, select the theme.liquid file.
  6. Paste your Fathom Analytics script just above the closing </head> tag.
    Editing a theme's code
  7. Click Save.
  8. To check the script is working, head over to your site and then check your Fathom dashboard to see if your visit was recorded.

Collecting data for purchases

If you would like to capture sales data, you can do so using events. Here's how:

  1. First of all, in Fathom, copy your Fathom Analytics script from your site settings.
  2. Go to your Shopify account and open the Order status page.
  3. Scroll down to the Order status page section and add the following code to the Additional scripts field:

Note: Make sure to replace the dummy Site ID and Event Name in the example with your own Site ID and Event Name

<script src="https://cdn.usefathom.com/script.js" data-site="YOUR-SITE-ID" defer></script>
<script>
{% if first_time_accessed %}
window.addEventListener('load', (event) => {
fathom.trackEvent('YOUR-EVENT-NAME', {
_value: {{ checkout.total_price }},
});
});
{% endif %}
</script>
  1. Click Save and your event will now start collecting data on each successful order, including the order price.
  2. To check if your event is working, create a successful order and navigate to the order confirmation page. Once you have done that, check your Fathom dashboard to see if the event completion and the relevant value was recorded.


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?