Shopify Setup
Set up CleanClicks for Shopify with GA4 first-party analytics, the ecommerce pixel, and server-side order webhooks.
CleanClicks integrates with Shopify through three components: a GA4 first-party proxy (theme snippet), a Custom Pixel (ecommerce events), and a server-side webhook (order backup). Which components you use depends on your plan.
| Component | Plan Required | What It Does |
|---|---|---|
| GA4 First-Party Analytics | Signal+ | Routes all GA4 tracking through your domain |
| Custom Pixel (v2.1.0) | Clarity+ | Tracks 7 ecommerce events in the pixel sandbox |
| Server-Side Webhook | Clarity+ | Captures orders directly from Shopify servers |
Prerequisites
- Your domain must be added and verified in CleanClicks (CNAME active)
- You need admin access to your Shopify store
- For GA4 proxy: a Google Analytics 4 property
Heads up for anyone editing theme code: Shopify's theme code editor uses a Monaco-based editor that can break silently under strict privacy settings. Firefox with ad-blockers, Enhanced Tracking Protection in "Strict" mode, or similar privacy extensions can prevent the editor from loading, loading save buttons, or rendering the file tree. If the editor looks broken or unresponsive, try Chrome or Edge, or temporarily allow
shopify.comandcdn.shopify.comin your privacy extensions. The same applies to installing the Custom Pixel in Step 2.
Step 1: GA4 First-Party Analytics (Signal+)
The theme snippet routes all GA4 traffic through your first-party domain, bypassing ad blockers and improving data quality. It fires storefront ecommerce events (view_item, add_to_cart, begin_checkout, search) directly to GA4.
Configure in CleanClicks
- In your CleanClicks dashboard, go to Configuration → Ecommerce tab
- Enter your GA4 Measurement ID (starts with
G-, found in GA4 Admin > Data Streams) - Toggle Allow Signals if you want demographics data (age, gender, interests)
- Click Save GA4 Proxy Settings
- Copy the generated Theme Snippet
Install the Theme Snippet
- In Shopify Admin, go to Online Store > Themes
- Click ... on your active theme, then Edit code
- Open
theme.liquid - Paste the snippet just before the closing
</head>tag - Click Save
Disable Existing GA4
If you have an existing GA4 setup (gtag.js script, Google & YouTube channel app, or a GA4 theme snippet), you must disable it to avoid duplicate tracking:
- Theme script: Remove or comment out any
gtag.jsorgoogletagmanager.com/gtag/jsscript tags in your theme - Google & YouTube app: Go to the app settings and disable the GA4 tracking (CleanClicks replaces it)
- Google Tag Manager: If using GTM with GA4, remove the GA4 tags from your GTM container
Why? CleanClicks loads its own proxied version of gtag.js. Running two copies sends every event twice.
Configure API Secret for Purchase Events
The Custom Pixel (Step 2) sends GA4 purchase events through the Measurement Protocol. This requires an API Secret:
- In your CleanClicks dashboard, go to Configuration → Vendors → GA4 tab
- Enter your GA4 API Secret (found in GA4 Admin > Data Streams > your stream > Measurement Protocol API secrets)
- Turn off the GA4 Measurement Protocol toggle (the pixel handles purchase events client-side now)
GA4 Signals / Demographics
If you enabled Allow Signals, GA4 demographics data (age, gender, interests) will populate within 24-48 hours. This works by allowing DoubleClick requests to go directly to Google rather than through the proxy.
Step 2: Install the Custom Pixel (Clarity+)
The Custom Pixel v2.1.0 runs in Shopify's sandboxed iframe and tracks the full ecommerce funnel. When GA4 is configured, it also sends a GA4 purchase event via Measurement Protocol on checkout completion.
- In your CleanClicks dashboard, go to Configuration → Ecommerce tab
- Copy the Pixel Code (it's generated per-domain with your configuration baked in)
- In Shopify Admin, go to Settings > Customer events
- Click Add custom pixel
- Name it CleanClicks
- In the Customer privacy section, set Data sale to Does not qualify as data sale and Data collection to Collected from this website or app
- Paste the pixel code into the code editor
- Click Save, then click Connect
Important: You must click both Save and Connect. A saved but unconnected pixel won't fire.
Note: If you've already installed an older version of the pixel, delete it and create a fresh one. Always use the latest code from the dashboard.
What the Pixel Tracks
| Event | Trigger |
|---|---|
page_view | Every page load |
view_item | Product page view |
view_item_list | Collection page view |
add_to_cart | Item added to cart |
begin_checkout | Checkout started |
purchase | Order completed (also sends GA4 MP if configured) |
search | Search performed |
Step 3: Server-Side Webhook (Clarity+)
The webhook captures purchase events directly from Shopify's servers. Even if a customer closes their browser before the confirmation page, the order is still captured.
- In your CleanClicks dashboard, go to Configuration → Ecommerce tab and copy the Webhook URL
- In Shopify Admin, go to Settings > Notifications > scroll to Webhooks
- Click Create webhook
- Event: Order payment
- Format: JSON
- URL: paste the webhook URL
- Click Save
- Copy the signing secret that Shopify generates
- In your CleanClicks dashboard's Configuration → Ecommerce tab, paste the signing secret and save
Testing
After setup, verify each component:
GA4 Theme Snippet
- Visit your store in an Incognito window
- Open GA4 Realtime report
- You should see events flowing through your first-party domain (check the traffic source)
- Browse a product page — look for
view_item
Custom Pixel
- Browse products, add to cart, search
- Check your CleanClicks dashboard Audit tab for all 7 event types
- Complete a test checkout — verify
purchaseappears
Webhook
- Complete a test order
- Check the CleanClicks Audit tab for a server-side purchase event (source:
shopify_webhook) - Verify the event has vendor dispatch results (Google Ads, Meta, etc.)
Testing with a Shopify Dev Store (optional)
If you want to test CleanClicks on a sandbox store before installing on your live store, use a Shopify dev store. Two gotchas that cost real time:
Use the Dev Dashboard, not the Partner Dashboard. Shopify deprecated Partner Dashboard store creation during the 2025/2026 Dev Dashboard migration. If you click "Add store" in your old Partner Dashboard you'll create a dev store that has restrictions you can't lift later. Create stores at dev.shopify.com instead.
Pick the right dev store tier when you create it. The Dev Dashboard offers multiple dev store variants. The default "Basic App Development" tier strips theme editing — the Online Store channel looks installed but the theme editor returns "This feature is unavailable on your plan." You cannot upgrade or transfer a Basic App Development store to lift this, and Shopify support will confirm. Pick a tier that includes full theme editing (the "Advanced"-equivalent option in the current Dev Dashboard flow) before you do anything else. If you're already stuck on a Basic store, create a new one at the right tier — the old store is unrecoverable for theme-based testing.
Troubleshooting
| Issue | Solution |
|---|---|
| GA4 events not appearing | Verify the theme snippet is before </head> in theme.liquid. Check that no other GA4 script is running. |
| Pixel not firing | Make sure you clicked both Save and Connect in Shopify Customer events |
| Purchase not in GA4 | Check that the API Secret is configured in the GA4 vendor tab |
| Duplicate GA4 events | Remove your existing GA4 setup (see "Disable Existing GA4" above) |
| Webhook events missing | Verify the signing secret matches between Shopify and CleanClicks |
Next: WordPress Setup
Last updated 6 days ago
Built with Documentation.AI