Shopify

Add DataSaaS analytics to your Shopify store. There are two methods depending on your preference and Shopify plan.

Method 1: Theme Code (Recommended)

This is the most reliable method and works with all Shopify plans.

1

Open the theme editor

In your Shopify admin, go to Online Store → Themes. Find your current theme, click Actions (or the three-dot menu), then select Edit code.

2

Open theme.liquid

In the left sidebar under Layout, click on theme.liquid. This is the main layout file that loads on every page of your store.

3

Paste the tracking script

Find the closing </head> tag and paste the DataSaaS script just before it:

<!-- DataSaaS Analytics -->
<script
  defer
  data-website-id="ds_YOUR_WEBSITE_ID"
  data-domain="yourdomain.com"
  src="https://datasaas.co/js/script.min.js"
></script>
</head>
4

Save

Click Save in the top right corner. The script will now load on every page of your Shopify store.

5

Verify

Visit your Shopify store and check your DataSaaS dashboard. You should see your visit appear within seconds.

Method 2: Custom Pixel

Shopify's Custom Pixel feature lets you add tracking without editing theme code. This is useful if you don't want to modify your theme directly.

1

Navigate to Customer events

In your Shopify admin, go to Settings → Customer events.

2

Add a custom pixel

Click Add custom pixel. Name it "DataSaaS Analytics".

3

Paste the pixel code

In the code editor, paste the following JavaScript snippet:

const script = document.createElement('script');
script.defer = true;
script.setAttribute('data-website-id', 'ds_YOUR_WEBSITE_ID');
script.setAttribute('data-domain', 'yourdomain.com');
script.src = 'https://datasaas.co/js/script.min.js';
document.head.appendChild(script);
4

Save and connect

Click Save, then click Connect to activate the pixel.

5

Verify

Visit your store and check your DataSaaS dashboard to confirm events are being received.

Warning

Shopify Custom Pixels run in a sandboxed iframe environment. This means the pixel may have limited access to the parent page's DOM and cookies. If you experience tracking issues with the Custom Pixel method, switch to the Theme Code method for full functionality.

Tip

Remember to replace ds_YOUR_WEBSITE_ID with your actual website ID and yourdomain.comwith your Shopify store's domain. You can find both in your DataSaaS dashboard under website settings.