Why isn't my HubSpot tracking code installing correctly?

Topic summary

Issue: After pasting the HubSpot tracking code before the tag in Shopify’s theme.liquid and saving, the code does not appear in the page source.

Details: The user edited theme.liquid (the main layout file) and confirmed it saved, but the snippet isn’t present when viewing source. The goal is to install HubSpot tracking.

Initial troubleshooting: A responder notes this should work and suggests common causes:

  • Editing a different (unpublished) theme.
  • Previewing a theme other than the one being edited.
    They request the site URL to investigate further.

Key context: In Shopify, theme.liquid is the primary template where global scripts (like tracking) are typically inserted before and should be visible in the rendered source.

Status: Unresolved. Next steps are to confirm the active theme being edited/previewed and share the site URL for diagnostics.

Summarized with AI on January 11. AI used: gpt-5.

I am copying and pasting the hubspot tracking code in the theme.liquid coding page and its not working. I paste it before the tag and then save it. it says saved but it’s not appearing on the page source.

What do I do?

1 Like

That should work, seeing how theme.liquid is your “main” theme file.

Are you possibly saving on a different theme or previewing another theme? If not, would you mind sharing the URL of your site so I could take a look?