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

Carlos Teixeira avatar
Written by Carlos Teixeira
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', 'xxxx');

s.setAttribute('data-domain', 'site.com');

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?