WebmeticDocs
Get startedDetectEnrichPersonalizeIntegrateManagePartnersDevelopers

Shopify

Add the tracking code to your Shopify theme so that Webmetic records the visits to your shop.

There's no Shopify app: you add the code from the dashboard to your theme yourself. At the end you'll have:

  • the tracking code on every page of your Shopify theme
  • your shop with the status Active in Webmetic
  • the message Data received in the Quick check

Before you start

  • Time: The first data arrives after a few minutes. The first companies appear within minutes to hours, depending on how much traffic your website gets.
  • Account: Your shop needs its own domain that's listed under Menu > Websites. Otherwise, Webmetic doesn't count visits to your-shop.myshopify.com toward your domain.
  • Access: You need access to the Shopify admin with permission to edit your theme's code. Otherwise, hand step 2 over to your agency.
  • Rights: Admin rights in Webmetic aren't needed for the tracking code.
  • Plan: The tracking code works on every plan and costs no credits. You can watch session recordings during the trial and on the Growth plan or higher.

If your shop runs on a subdomain such as shop.your-website.com, the main domain under Websites is enough, because Webmetic counts subdomains toward the main domain.

Webmetic records every page your theme serves, with two exceptions:

  • Checkout: The checkout doesn't use your theme. That's why the tracking code doesn't run there, and the checkout pages are missing in Webmetic.
  • Custom pixels: Shopify runs custom pixels in a sandbox, where the tracking code can't see your shop's page. That's why Webmetic doesn't support this route.

1. Copy the tracking code

  1. Open Menu > Tracking code, where HTML snippet is already selected under Choose a method.
  2. Under Copy the snippet, decide whether the Session recording option stays ticked.
  3. Click Copy. The copied code already contains your account ID, so there's nothing to change in it.
The Tracking Code window with HTML snippet, Session recording, and the Copy button
The Tracking Code window with HTML snippet, Session recording, and the Copy button

Session recording captures mouse movement, clicks, and scrolling, and Webmetic hides anything typed into form fields. If your plan includes session recording, leave the box ticked. Otherwise, untick it.

You copy the text for your privacy policy in the Tracking Code window under Privacy notice. You'll also find the text in German and English under Add the privacy notice.

2. Add the code to your theme

  1. In the Shopify admin, open Online Store > Themes.
  2. Duplicate the theme your shop currently uses. Shopify recommends this backup copy before any change to a theme's code.
  3. On the theme your shop uses (not on the copy), click the button with the three dots (⋯), then click Edit code to open the code editor.
  4. In the layout folder, click the file theme.liquid.
  5. Paste the tracking code on a blank line in the <head> section. We recommend the spot directly before </head>, as the dashboard says.
  6. Click Save, and from now on every page the theme serves loads the tracking code.

Theme updates can remove the code

If your code changes aren't compatible with a theme update, Shopify removes them in the updated copy. After every theme update, check that the tracking code is still in theme.liquid.

Check your installation

  1. Open the shop on its own domain in a new browser window and visit a few pages.
  2. In Webmetic, open Menu > Tracking code and click Quick check under Verify installation. Webmetic shows the message Data received.
The quick check with the result Data received
The quick check with the result Data received

The quick check reports data as soon as any website in your account sends data. If you have several websites, also open Menu > Websites and check that your shop shows Active there.

If nothing arrives

If the quick check shows the message No data yet, wait a few minutes and click Check again. If the message stays, confirm these points:

  • The code is in the theme your shop uses, not in the copy.
  • The change in theme.liquid is saved with Save.
  • Your shop's domain is listed under Websites.
  • No cache is still serving the old version of your pages.

Next steps

On this page