Tracking Shopify Stores with ClickMagick: The Complete Integration Guide

Why Shopify Analytics Isn't Enough
Shopify's built-in analytics are useful for understanding your store's overall performance, but they have a critical limitation: they only show you what happens inside your Shopify store. They can't tell you which ad campaign, traffic source, or affiliate drove each sale. For e-commerce marketers running paid traffic, this is a massive blind spot.
Integrating ClickMagick with Shopify gives you complete attribution data — from the first ad click to the final purchase — across all your traffic sources. Here's how to set it up correctly.
The ClickMagick-Shopify Integration Architecture
The integration works in three parts: click tracking (ClickMagick records every click on your ad links), session tracking (ClickMagick's first-party tracking script on your Shopify store maintains the click attribution through the shopping session), and conversion tracking (when a purchase is completed, Shopify fires a conversion event that ClickMagick captures and attributes to the original click).
This architecture is important because it solves the most common e-commerce attribution problem: the gap between the ad click and the purchase. Users often click an ad, browse your store, add items to cart, and complete the purchase in a separate session hours or days later. ClickMagick's persistent first-party cookie maintains the attribution across all of these sessions.
Step 1: Install the ClickMagick Tracking Script
Log into your ClickMagick account and navigate to Tools → Tracking Script. Copy your unique tracking script. In Shopify, go to Online Store → Themes → Edit Code → theme.liquid. Paste the ClickMagick tracking script just before the closing </head> tag. This script sets a first-party cookie on your domain that persists for 30 days, maintaining click attribution across sessions.
Step 2: Set Up the Purchase Conversion Goal
In ClickMagick, create a new conversion goal for Shopify purchases. Set the conversion type to "Page Load" and the conversion URL to your Shopify order confirmation page URL pattern (typically /thank_you or /orders/). Set the conversion value to dynamic (ClickMagick will pull the actual order value from the page). This conversion goal will fire every time a customer completes a purchase, attributing the sale to the original click that brought them to your store.
Step 3: Configure UTM Parameters for All Traffic Sources
For ClickMagick to attribute purchases to specific campaigns, you need to pass UTM parameters through all your ad links. Create ClickMagick tracking links for each traffic source with the appropriate UTM parameters: utm_source (facebook, google, email), utm_medium (cpc, social, email), utm_campaign (campaign name), utm_content (ad creative ID). ClickMagick will capture these parameters on click and pass them through to the conversion event.
Step 4: Set Up Server-Side Conversion Tracking
For maximum accuracy, supplement the client-side conversion tracking with server-side tracking via Shopify's webhooks. When an order is created in Shopify, configure a webhook to fire a postback URL to ClickMagick with the order ID, order value, and the ClickMagick click ID (which you stored in a customer metafield during the session). This server-side tracking captures conversions that the client-side script might miss due to ad blockers or browser privacy settings.
Tracking Shopify Subscriptions and Recurring Revenue
If you're selling subscription products via Shopify (using ReCharge or Shopify Subscriptions), you need to track both the initial conversion and recurring billing events separately. Set up a separate ClickMagick conversion goal for recurring billing events with a lower conversion value (since these are retention events, not acquisition events). This gives you accurate LTV data by traffic source — essential for calculating true ROAS on subscription products.
Reading Your Shopify Attribution Data in ClickMagick
Once the integration is live, your ClickMagick dashboard will show you: revenue by traffic source, revenue by campaign, revenue by ad creative, conversion rate by traffic source, average order value by traffic source, and ROAS by campaign. This data is the foundation of profitable Shopify advertising. When you can see that your Google Shopping campaigns generate a 4.2x ROAS while your Facebook prospecting campaigns generate a 1.8x ROAS, you know exactly where to allocate your next dollar of ad spend.
Troubleshooting Common Integration Issues
The most common issue with the ClickMagick-Shopify integration is the tracking script not firing on all pages. Verify the script is installed in theme.liquid (not a specific page template) so it loads on every page of your store. The second most common issue is the conversion goal not firing on the thank you page — check that your conversion URL pattern matches Shopify's actual thank you page URL structure, which can vary based on your theme.
Build complete e-commerce attribution for your Shopify store. Start your ClickMagick free trial and know exactly which campaigns are driving your Shopify revenue.
Frequently Asked Questions
What is the best way to track marketing ROI?
How do I get started with click tracking?
Why is my ad platform ROAS different from my actual revenue?
Ready to Track Every Click and Maximize Your ROI?
ClickMagick is the #1 click tracking and attribution platform trusted by 100,000+ marketers. Start your free 14-day trial today — no credit card required.
Try ClickMagick Free for 14 DaysFound this useful? Share it
Help other marketers find this — every share drives real traffic back to the site.
Ready-to-Post Captions
Click any caption to copy it, then paste directly into your social media post.
Pro tip: Post at peak times — LinkedIn: Tue–Thu 8–10am, Twitter/X: Mon–Fri 9am–3pm, Facebook: Wed 11am–1pm. Engage with comments in the first hour to boost reach.