Skip to main content

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

  1. In your Shopify admin, go to Online Store > Themes
  2. Click Customize on your active theme
  3. Click the three-dot menu (⋯) and select Edit code

Step 2: Add the Tracking Script

  1. In the left sidebar under Layout, click theme.liquid
  2. Find the closing </head> tag
  3. Paste the following script just before </head>:
<script
defer
data-domain="yourdomain.com"
src="https://ovyxa.com/js/script.js"
></script>
  1. 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:

  1. Go to Settings > Checkout > Order status page > Additional scripts
  2. 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

  1. Visit your live Shopify store
  2. Open the browser Network tab and look for a request to ovyxa.com/js/script.js
  3. 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

  1. In your Shopify admin, go to Settings > Notifications > Webhooks
  2. Click Create webhook
  3. Select event: Order payment and format: JSON
  4. Paste the webhook URL and click Save
  5. Repeat for event: Refund creation
  6. Copy the webhook signing secret shown at the top of the Webhooks page

Step 3: Add the Secret in Ovyxa

  1. Go to your site's Settings > Revenue in Ovyxa
  2. Find the Shopify card and paste the webhook signing secret
  3. 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 EventOvyxa Action
orders/paidRecords a payment with order total
refunds/createRecords a negative (refund) amount

Revenue data will appear on your dashboard alongside visitor metrics, broken down by source, page, country, and device.

Next Steps