Skip to main content

How to Add Our Script to Your Shopify Header

Learn how to add the script to your Shopify site in just a few simple steps

Written by Tony
Updated over 3 weeks ago

📌 1. Open Your Shopify Theme Code

To insert a script into your website header, you’ll need to access your theme files.

  • Log in to your Shopify Dashboard.

  • In the left menu, go to Online Store → Themes.

  • On your active theme, click Actions → Edit Code.

This gives you safe access to your theme files without affecting your store design.


🔧 2. Add the Script Inside the <head>

Once you’re inside the code editor:

  1. In the left sidebar, open the layout folder.

  2. Click theme.liquid.

  3. Look for the <head> section. It will look something like:

    <head>

    ...

    </head>

  4. Paste the script we provided you into this area, for example:

    <head>

    <!-- Paste the script we provided you into this section -->

    </head>

  5. Click Save in the top-right corner.

That’s it — your script is now active on all pages of your store.


🎉 3. Setup Complete!

Your script is now installed!

If you need help or would like us to verify the installation, feel free to contact our support team at [email protected] 🙂


🛠️ Support

If your theme removes custom script attributes (such as data-id or data-domain) — this can happen on some Shopify themes or custom setups — you can use this alternative method to ensure everything is preserved:

<script>
(function () {
var s = document.createElement("script");
s.src = "https://analitas.com/script.js";
s.defer = true;
s.setAttribute("data-id", "⚠️INSERT_YOUR_DATA-ID");
s.setAttribute("data-domain", "⚠️INSERT_YOUR_DOMAIN");
document.head.appendChild(s);
})();
</script>

This method dynamically loads the script and prevents Shopify or third-party apps from stripping the required attributes.

If the issue continues, send us a message at [email protected] and we’ll help you as soon as possible.

Did this answer your question?