Use Cases
Custom Event Tracking Track specific interactions like button clicks, video plays, or custom checkout steps. Headless Shopify Use with custom storefronts built on Hydrogen or other frameworks. Theme Customization Full control over when and how events are tracked. Customize for unique business needs. Development/Testing Test tracking in development environments before deploying to production.When to Use Manual Installation
Use Manual Installation if:- You need full control over event tracking
- You have a highly customized theme
- You’re using headless Shopify
- You want to track custom events beyond standard e-commerce
- You want automatic order tracking
- You don’t want to edit theme code
- You want one-click installation
Before You Start
- You have a DATALYR account
- You’ve created a workspace
- You have a Shopify store (any plan)
- You have access to edit your theme code
Step 1: Get Your Tracking Code
- Log in to your DATALYR dashboard
- Go to Settings → Tracking
- Copy your tracking script:
Step 2: Add to Your Shopify Theme
Open Theme Editor
- In your Shopify admin, go to Online Store → Themes
- Find your current theme
- Click Actions → Edit code
Add to theme.liquid
- In the left sidebar, find and click theme.liquid (under Layout)
- Find the
</head>closing tag - Paste your DATALYR tracking script right before
</head>:
- Click Save
Step 3: Verify Tracking Works
- Visit your Shopify storefront in a new browser tab
- Browse a few products
- Go to your DATALYR dashboard
- Click Events in the sidebar
- You should see
page_viewevents within 10 seconds
What Gets Tracked Automatically
Once installed, DATALYR automatically captures:- Page views on all pages
- Visitor IDs (persistent across sessions)
- UTM parameters from ad campaigns
- Ad click IDs (fbclid, gclid, ttclid)
- Referrer and traffic source
- Device and browser information
Track Shopify E-commerce Events
To track product views, add to cart, and purchases, add this code to your theme:Track Product Views
In product.liquid or your product template, add:Track Add to Cart
In your theme, find where “Add to Cart” is handled. Add this to your cart AJAX callback or form submission:Track Purchases
Create a new snippet calleddatalyr-purchase.liquid in your Snippets folder:
- Go to Settings → Checkout
- Scroll to Order status page → Additional scripts
- Add:
{% include 'datalyr-purchase' %}
Track Custom Events
Track button clicks, form submissions, or any custom interaction:Integrate with Shopify Customer Data
Track customer identification for cross-device attribution:Development vs Production
Test in Development Theme
- Create a duplicate of your theme for testing
- Install DATALYR on the duplicate theme first
- Preview and test thoroughly
- Once verified, add to your live theme
Use Different Workspaces
Create separate DATALYR workspaces for:- Development: Test theme with workspace ID
dev_xxxxx - Production: Live theme with workspace ID
prod_xxxxx
Troubleshooting
Not seeing events? Check that:- Your tracking script is in the
<head>section of theme.liquid - You’ve saved the file after editing
- Your workspace ID is correct
- Ad blockers are disabled
- You’re testing on the live storefront (not /admin)
track.datalyr.com in all theme files.
Purchase tracking not working?
Purchase tracking requires checkout access. Test with a real order using a test payment gateway or Shopify Payments in test mode.
Liquid syntax errors?
Make sure to close all Liquid tags properly. Use {% %} for logic and {{ }} for output.
Remove App Installation (If Applicable)
If you previously installed the DATALYR app:- Go to Settings → Apps and sales channels
- Find DATALYR
- Click Uninstall
- Proceed with manual installation
Next Steps
Verify Tracking
Confirm events are tracking
Track Custom Events
Learn event tracking API
Connect Ad Accounts
Link Meta, Google, or TikTok Ads
View Your Dashboard
See your tracking data