Skip to content

Install GoodMetrics on Shopify

Add the GoodMetrics tracking script to your Shopify store — works with every theme, including Online Store 2.0 themes like Dawn.

You can add GoodMetrics to your Shopify store by placing your tracking script in your theme’s layout file. This works with every Shopify theme — both vintage and Online Store 2.0 themes like Dawn — because every theme has a theme.liquid file that controls the <head> on all storefront pages.

First, you’ll need your unique tracking script. If you don’t have it yet, here’s how to retrieve it. It looks like this:

<script id="gmScript" data-gm="XXXXXXXX" src="https://cdn.goodmetrics.io/goodmetrics.min.js"></script>

💡 Your data-gm ID is unique to your store, so copy your own script from your site settings rather than the example above.

💡 Adding the script is a single, low-risk line, so editing your live theme directly is fine. If you’d prefer a safety net, duplicate your theme first (Themes → ⋯ → Duplicate) — you can republish the copy to revert if you ever need to.

  1. From your Shopify admin, go to Online Store → Themes.
  2. Find the theme you want to edit (usually your live theme) and choose ⋯ → Edit code.
  3. In the Layout folder, open theme.liquid.
  4. Find the closing </head> tag (press Ctrl/Cmd + F to search for it) and paste your GoodMetrics script on the line immediately before it.
  5. Choose Save.

Your script now loads on every storefront page.

  1. Visit your storefront.
  2. In GoodMetrics, open the Realtime report.
  3. Confirm that your visit appears in the report.

If you don’t see your visit:

  • Confirm you pasted the script into the published theme (not an unpublished copy) and saved your change.
  • Make sure the script is inside theme.liquid, just before </head>.
  • Still stuck? Contact us and we’ll be happy to help.

This installs GoodMetrics across your entire storefront — your home page, collections, product pages, and cart — so you’ll see your traffic, sources, and on-site behavior in full.

As with any analytics tool added through your theme, the script doesn’t run on Shopify’s checkout, which Shopify serves from a separate system outside your theme.