DataSag guides · Updated 27 October 2026
Verify DataSag analytics on Shopify storefront themes
A script tag alone does not confirm that analytics works. Verify the published document, the request to DataSag and the matching visit in the correct project. This guide applies to Shopify storefront themes.
Start with the Shopify storefront themes installation
Back up or duplicate the theme first. Add the tracker to layout/theme.liquid before </head>, using the public key for the storefront project. Save the theme and test the published storefront. This is a theme integration, not a Shopify app installation.
The theme does not control every checkout or customer account document. A storefront pageview does not prove a completed order. Do not claim this snippet measures checkout pages or purchase revenue without a separate supported integration.
Use the public project key from the DataSag project you are inspecting. A test on a preview domain does not confirm that the production domain has the same code or settings.
Verify DataSag analytics in Shopify storefront themes
- Inspect layout/theme.liquid in a backed-up copy of the intended theme. Confirm the snippet sits before the closing head tag, with the correct public project key and no second app or theme installation.
- Publish the intended theme and open the real storefront. Test a product page and collection page directly. An unpublished theme preview can show your change while customers still receive the previous theme.
- Inspect a pageview request on each storefront page. Keep checkout and customer-account documents outside this verification claim unless you have separately implemented and tested their supported measurement paths.
The live storefront theme records the sampled product and collection pages; the result does not claim checkout coverage.
Complete the collection checks
- Open the published website in a normal browser window with the Network panel recording. Use a browser profile where you can control extensions and your consent choice.
- Filter network requests for tracker.js. Confirm it returns JavaScript successfully and that the rendered script has the project's data-datasag-key attribute. The example YOUR_PUBLIC_KEY must be replaced.
- Filter for /api/track and reload once. Inspect a request with eventName null or absent. Its projectKey and path should match the chosen project and the page you opened.
- Open that DataSag project, choose a date range containing today and inspect the matching path. Use the configured report timezone when checking dates.
- Navigate to a second path, then use Back. Compare pageview requests with the route changes rather than counting every request as a pageview.
document.querySelectorAll('script[data-datasag-key]').length
// Expected: 1
document.querySelector('script[data-datasag-key]')?.getAttribute('data-datasag-key')
// Expected: your project's public key
typeof window.datasag?.track
// Expected after the script runs: 'function'What a successful check looks like
One rendered tracker installation, a successful request for the intended page and a corresponding entry in the intended project. Scroll and engagement requests are separate event types.
Record the public path you tested, the browser state, the approximate time and the observed request. Check one direct page load and one later navigation so the result covers more than the homepage.
Common mistake
A successful tracker.js download only proves that a file loaded. It does not validate the project key, consent state or tracking endpoint. Test a real published path before declaring setup complete.
Installation snippet for Shopify storefront themes
The shared installation belongs in layout/theme.liquid before the closing head tag. Use this as the installation reference while checking the procedure above.
<script defer src="https://www.datasag.com/tracker.js" data-datasag-key="YOUR_PUBLIC_KEY"></script>Related Shopify storefront themes guides
- Fix DataSag analytics not working
- Fix duplicate analytics pageviews
- Track custom events
- Track UTM campaigns
- Measure AI referral traffic
- Configure CSP for DataSag analytics
- Exclude your own analytics visits
- Load analytics without blocking rendering
Full Shopify storefront themes setup guide · Search and AI visibility
References
Official Shopify storefront themes documentation covers the integration point. For DataSag data handling, read the privacy policy. Use support if a request fails after these checks.