Use this method if you're embedding JS across the whole store (e.g., Google Analytics, custom events):
Steps:
Go to Shopify Admin → Online Store → Themes
Click Actions → Edit code
Open: layout/theme.liquid
Insert your script before the closing </head> or </body> tag:
liquid
CopyEdit<!-- Example: Custom Script -->
<script>
console.log("Custom script loaded");
</script>Click Save
Open the file you want (e.g., product.liquid, product-template.liquid, or main-product.liquid) and add your script there.
liquid
CopyEdit{% if template == 'product' %}
<script>
// Custom product page logic
</script>
{% endif %}Shopify themes (2.0+) may allow Custom Liquid blocks:
Go to Online Store → Themes → Customize
Choose the page template
Click Add block/section → Custom Liquid
Insert your script like this:
liquid
CopyEdit<script>
console.log("This script runs on the homepage only.");
</script>If you're on Shopify Plus, you can customize the checkout:
Go to Settings → Checkout → scroll to Order Status Page
Paste your script under Additional Scripts
For things like Facebook Pixel, Google Analytics, etc., Shopify recommends installing their official apps or integrating via Shopify > Settings > Customer Events.
Managing Cookies or Scripts Added via Google Tag Manager (GTM)
Managing Cookies or Scripts via Google Tag Manager (GTM)According to PDPA regulations, if your website uses third-party scripts that may ...
How to Install the Cookie Banner for Existing Users
How to Install the Cookie Banner for Existing UsersGo to the dashboard at https://app.cookiewow.com/projects and select the domain where ...
How to Install a Cookie Banner for New Users
How to Install a Cookie Banner for New UsersGo to www.cookiewow.com and sign in or register an account .After logging in, you will be red...
Get in touch and we'll help solve it