Shopify Integration
Add Ovyxa analytics to your Shopify store. No app install needed -- just paste a script tag into your theme.
Step 1: Open Your Theme Settings
- In your Shopify admin, go to Online Store > Themes
- Click Customize on your active theme
- Click the three-dot menu (⋯) and select Edit code
Step 2: Add the Tracking Script
- In the left sidebar under Layout, click
theme.liquid - Find the closing
</head>tag - Paste the following script just before
</head>:
<script
defer
data-domain="yourdomain.com"
src="https://ovyxa.com/js/script.js"
></script>
- Click Save
Your theme.liquid should look something like this:
<head>
<!-- ... existing Shopify head content ... -->
<script
defer
data-domain="yourdomain.com"
src="https://ovyxa.com/js/script.js"
></script>
</head>
Step 3: Track Purchase Events (Optional)
To track completed purchases, add this snippet to your order confirmation page:
- Go to Settings > Checkout > Order status page > Additional scripts
- Paste the following:
<script>
if (window.ovyxa) {
window.ovyxa('event', 'Purchase', {
props: {
revenue: '{{ total_price | money_without_currency }}',
currency: '{{ shop.currency }}',
order_id: '{{ order.name }}'
}
})
}
</script>
Cookieless Mode
If you want to avoid cookie consent banners, add the data-cookieless attribute:
<script
defer
data-domain="yourdomain.com"
data-cookieless
src="https://ovyxa.com/js/script.js"
></script>
Tracking Custom Events
Track add-to-cart, newsletter signups, or any other interaction:
<script>
document.querySelector('.add-to-cart-btn')?.addEventListener('click', function() {
window.ovyxa('event', 'AddToCart', { props: { product: 'Widget Pro' } })
})
</script>
Verify Installation
- Visit your live Shopify store
- Open the browser Network tab and look for a request to
ovyxa.com/js/script.js - Check your Ovyxa dashboard to confirm pageviews are appearing
Automatic Revenue Tracking (Webhooks)
For automatic revenue attribution without client-side code, connect Shopify webhooks directly to Ovyxa.
Step 1: Get Your Webhook URL
Go to your site's Settings > Revenue in the Ovyxa dashboard. Find the Shopify card and copy the webhook URL:
https://api.ovyxa.com/api/webhooks/shopify
Step 2: Create Webhooks in Shopify
- In your Shopify admin, go to Settings > Notifications > Webhooks
- Click Create webhook
- Select event: Order payment and format: JSON
- Paste the webhook URL and click Save
- Repeat for event: Refund creation
- Copy the webhook signing secret shown at the top of the Webhooks page
Step 3: Add the Secret in Ovyxa
- Go to your site's Settings > Revenue in Ovyxa
- Find the Shopify card and paste the webhook signing secret
- Click Connect
Step 4: Pass Ovyxa Metadata on Orders
For revenue to be attributed to the right site and visitor, you need to pass ovyxa_site_id as an order note attribute. The simplest approach is to add a hidden field to your cart form:
<input type="hidden" name="attributes[ovyxa_site_id]" value="YOUR_DOMAIN" />
For full visitor attribution, pass the visitor and session IDs from the tracking script:
<script>
document.addEventListener('DOMContentLoaded', function() {
var vid = document.cookie.match(/ovyxa_vid=([^;]+)/);
var sid = document.cookie.match(/ovyxa_sid=([^;]+)/);
var form = document.querySelector('form[action="/cart/add"]');
if (form) {
var addHidden = function(name, value) {
if (!value) return;
var input = document.createElement('input');
input.type = 'hidden';
input.name = 'attributes[' + name + ']';
input.value = value;
form.appendChild(input);
};
addHidden('ovyxa_site_id', 'YOUR_DOMAIN');
if (vid) addHidden('ovyxa_visitor_id', vid[1]);
if (sid) addHidden('ovyxa_session_id', sid[1]);
}
});
</script>
Replace YOUR_DOMAIN with your actual site ID from the Ovyxa dashboard.
Supported Webhook Events
| Shopify Event | Ovyxa Action |
|---|---|
orders/paid | Records a payment with order total |
refunds/create | Records a negative (refund) amount |
Revenue data will appear on your dashboard alongside visitor metrics, broken down by source, page, country, and device.