Shopify Purchase Tracking with Tagely: The New Setup (2026)
If your Shopify store tracks purchases with Tagely or ReferDigital using the method from our January 2024 guide, those purchases have probably stopped being recorded. Shopify has changed how checkout pages run tracking code, and the old setup no longer works there.
The fix takes about five minutes, and the steps and code are now in your Tagely account. ReferDigital users need one small extra change, covered below. Page view tracking is not affected.
This guide replaces our earlier Shopify guides.
What changed
Shopify no longer lets you paste scripts into the “Additional scripts” box on the thank you page. Tracking code for checkout now goes in Settings → Customer events as a custom pixel, which Shopify runs inside a restricted sandbox.
Many stores moved the old Tagely code into a custom pixel: the base code, then a tgl('purchase', ...) call on Shopify’s checkout_completed event. That code looks right, but it fails silently:
- The base code loads Tagely’s tracking script inside the sandbox.
- The script’s first job is to read and write its visitor cookie. The sandbox blocks direct cookie access, so the script stops with a security error.
- Your account ID and the purchase are queued for that script to send. Since it has stopped, neither is ever sent.
No error appears in your Shopify admin, so the only sign is that purchases stop showing up in Tagely and ReferDigital.
The new code skips Tagely’s script entirely. It reads the visitor’s Tagely cookies through Shopify’s own cookie feature, which works in the sandbox, and sends the purchase directly to Tagely, linked to the same visitor.
What to do
Log in to Tagely and go to Events Setup. The notice at the top links to the new Shopify Purchase Tracking page, which has the installation steps and your purchase pixel code with your account ID already filled in. Follow those steps, then place a small test order to confirm it works.
ReferDigital users: one extra change
The code on the Shopify Purchase Tracking page records purchases for Tagely analytics. To credit purchases to your ReferDigital campaign, add your campaign ID and the order total to it before saving the pixel.
In the code, find this line:
value: String(checkout.totalPrice?.amount ?? '0.00'),
and add these two lines directly below it:
campaign_id: 'YYY',
order_total: String(checkout.totalPrice?.amount ?? '0.00'),
Replace YYY with your campaign ID from ReferDigital, the same one you used with the old setup. If you only use Tagely for analytics, you don’t need this change.
Cleaning up the old setup
- Remove old thank you page scripts. If you still have Tagely code in Shopify’s old “Additional scripts” area, delete it once the new pixel is working.
- No more
{% if first_time_accessed %}wrapper. Purchases are now de-duplicated by Shopify order ID automatically, so the wrapper from our earlier guide isn’t needed.
And that’s it! Happy tracking!