Shopify Integration
Set up Anacoic on your Shopify store in under 10 minutes
Shopify Integration Guide
This guide walks you through setting up Anacoic server-side tracking on your Shopify store. No coding required for basic setup.
Prerequisites
- Shopify store (any plan)
- Anacoic account
- Meta Pixel ID (if tracking Facebook ads)
Method 1: Theme Editor (Recommended)
The quickest way to install Anacoic on Shopify.
Step 1: Get Your Anacoic Snippet
- Log in to your Anacoic Dashboard
- Create a new gateway (or use existing)
- Go to the Installation tab
- Copy the One-Line snippet:
<script src="https://edge.anacoic.com/v1/tracker.js"
data-gateway="YOUR_GATEWAY_ID"
data-emq="optimize"></script>
Step 2: Add to Shopify Theme
- In Shopify Admin, go to Online Store → Themes
- Click Customize on your active theme
- Click the Theme settings (gear icon) in the left sidebar
- Select Custom code or Custom CSS/JS (varies by theme)
- Paste your Anacoic snippet in the Head section
- Click Save
Step 3: Verify Installation
- Visit your store homepage
- Open browser DevTools (F12)
- Go to Network tab
- Filter for “anacoic” or “edge.anacoic”
- Refresh the page
- You should see a request to
edge.anacoic.com/track
Method 2: Shopify Custom Liquid
For more control over where the tracker loads.
Add to Theme.liquid
- Go to Online Store → Themes → Edit code
- Find
layout/theme.liquid - Find the
<head>section - Paste your snippet right before
</head>:
<!-- Anacoic Tracking -->
<script src="https://edge.anacoic.com/v1/tracker.js"
data-gateway="YOUR_GATEWAY_ID"
data-emq="optimize"></script>
- Click Save
Method 3: Google Tag Manager
If you already use GTM on your Shopify store.
Create the Tag
- Open Google Tag Manager
- Click Tags → New
- Name it “Anacoic Base Tracker”
- Tag Type: Custom HTML
- Paste your One-Line snippet
- Trigger: All Pages
- Save and Submit
Test in Preview Mode
- Click Preview in GTM
- Enter your store URL
- Check that the Anacoic tag fires on page load
Tracking Purchase Events
To achieve high EMQ scores (8+), you need to pass customer data with purchase events.
Using Shopify’s dataLayer (Shopify Plus)
If you have Shopify Plus with checkout customization:
// On order confirmation page
anacoic.track({
event_name: 'Purchase',
event_id: '{{ order.id }}_' + Date.now(),
user: {
email: '{{ customer.email }}',
phone: '{{ customer.phone }}'
},
custom_data: {
value: {{ order.total_price | money_without_currency }},
currency: '{{ shop.currency }}',
transaction_id: '{{ order.id }}'
}
});
Using Additional Scripts
For standard Shopify plans, add to Settings → Checkout → Additional scripts:
<script src="https://edge.anacoic.com/v1/tracker.js"
data-gateway="YOUR_GATEWAY_ID"
data-emq="optimize"></script>
<script>
// Wait for tracker to load
setTimeout(function() {
if (window.anacoic) {
window.anacoic.track({
event_name: 'Purchase',
user: {
email: '{{ order.email }}'
},
custom_data: {
value: {{ order.total_price | divided_by: 100.0 }},
currency: '{{ order.currency }}'
}
});
}
}, 1000);
</script>
Achieving High EMQ Scores
EMQ Score Breakdown
| Data Point | Points | How to Pass |
|---|---|---|
| +2.5 | user.email from customer object | |
| Phone | +2.0 | user.phone from customer object |
| Facebook Browser ID | +1.5 | Auto-captured from cookie |
| Facebook Click ID | +1.5 | Auto-captured from URL |
| IP + User Agent | +1.0 | Auto-captured at edge |
| External ID | +1.0 | Shopify customer ID |
Optimal Implementation
anacoic.track({
event_name: 'Purchase',
user: {
email: '{{ customer.email }}', // +2.5 points
phone: '{{ customer.phone }}', // +2.0 points
external_id: '{{ customer.id }}' // +1.0 point
},
custom_data: {
value: {{ order.total_price }},
currency: '{{ shop.currency }}'
}
});
// Expected EMQ Score: 8.0-9.5
Common Shopify Issues
Issue: Events Not Firing
Solution: Check theme’s Content Security Policy
Some themes block external scripts. Add this to your CSP:
script-src 'self' https://edge.anacoic.com;
connect-src 'self' https://edge.anacoic.com;
Issue: Customer Data Not Available
Solution: Check liquid object availability
Not all customer data is available on all pages:
{{ customer }}- Only available when logged in{{ order }}- Only available on order/confirmation pages{{ checkout }}- Only available during checkout
Issue: Duplicate Events
Solution: Use unique event IDs
Always include a unique event_id:
event_id: '{{ order.id }}_' + Date.now()
Shopify-Specific Features
Automatic Customer Detection
The Anacoic tracker can auto-detect logged-in Shopify customers:
<script>
window.anacoic_config = {
gateway_id: 'YOUR_GATEWAY_ID',
emq: 'optimize',
auto_identify: true // Detects Shopify customer object
};
</script>
<script src="https://edge.anacoic.com/v1/tracker.js"></script>
Product View Tracking
Track product views for dynamic ads:
// On product page
anacoic.track({
event_name: 'ViewContent',
custom_data: {
content_name: '{{ product.title }}',
content_type: 'product',
content_ids: ['{{ product.id }}'],
value: {{ product.price | divided_by: 100.0 }},
currency: '{{ shop.currency }}'
}
});
Next Steps
- Configure Meta CAPI integration
- Set up Agent Gateway for AI discoverability
- Add custom domain for maximum reliability
Getting Help
- Shopify-specific questions: Contact support
- General tracking help: See Troubleshooting