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 loader (code in your theme), a Custom Pixel (ecommerce events), and an order webhook (server-side order backup). All three are available on the Signal and Clarity plans.
All three are set up from the guided Shopify setup in your CleanClicks dashboard, under Configuration → Ecommerce tab, in the Shopify card. The guided setup has four cards: 1 · Your Shopify store, 2 · Add the CleanClicks pixel, 3 · Add the order webhook, and 4 · GA4 first-party loader (optional). It opens each Shopify admin page for you. CleanClicks does not install or change anything in your store; you make each change yourself.
| Component | Plan Required | What It Does |
|---|---|---|
| GA4 First-Party Analytics | Signal or Clarity | Routes GA4 through your own domain to keep the sessions ad blockers hide |
| Custom Pixel | Signal or Clarity | Tracks 7 ecommerce events in the pixel sandbox |
| Server-Side Webhook | Signal or 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 or Clarity)
This step is optional. The GA4 first-party loader sends GA4 requests through your own first-party domain. It sends the storefront ecommerce events view_item, view_item_list, add_to_cart, begin_checkout, and search. Depending on your theme, it may not send add_to_cart or begin_checkout. If you turned on Google Signals, some GA4 requests go straight to Google.
The loader works only while GA4 first-party mode is on for your site. When it is on, card 4 opens with "It sends this store's page views and product views to Google Analytics through your own domain". If card 4 says only "Optional.", first-party mode is off for your site: contact support before you install the loader.
Get the Loader Code in CleanClicks
The guided Shopify setup shows one card at a time, and card 4 comes last. If you want GA4 purchase events, connect GA4 and save its API Secret first (see "Configure API Secret for Purchase Events" below), because the pixel code carries your GA4 purchase settings as they were when the code was generated. Then do Step 2 and Step 3, and come back here to install the optional loader. If you pasted the pixel before you saved the API Secret, reload the Ecommerce tab, click Redo setup, and paste the new pixel code into Shopify.
- In your CleanClicks dashboard, go to Configuration → Ecommerce tab. The guided Shopify setup is in the Shopify card.
- Go to card 4 · GA4 first-party loader, which opens after you click Save secret on card 3. If the card shows the Shopify setup summary instead, click Set up on its GA4 first-party loader row.
- Click Copy code and open Themes. This copies the loader code and opens Themes in your Shopify admin. You can also click Copy on the code box.
If the card says Connect GA4 instead of showing code, the loader does not have a GA4 measurement ID yet. Connect GA4 on the Connections page, then come back to the card. If the card still asks for GA4 after you connect it, contact support.
Install the Loader in Your Theme
- In Themes, on your live theme, click the three dots, then Edit code
- Open
layout/theme.liquid - Paste the code just above the closing
</head>tag - Click Save
- Back on card 4, click Check my storefront. If CleanClicks can read your public storefront and finds the loader, the card shows Loader found on your storefront. CleanClicks cannot check a store behind Shopify's password page until the store is public. If the check cannot reach your store, try again in a minute.
Disable Existing GA4
If Shopify's own Google Analytics connection reports checkout starts or add-to-carts that the loader misses on your theme, keep that connection and skip the loader for now.
If you install the loader, remove or comment out any existing GA4/gtag.js scripts to avoid duplicate tracking. CleanClicks loads its own proxied copy of gtag.js, and two copies send every event twice. Three places to check:
- Theme script: remove or comment out any
gtag.jsorgoogletagmanager.com/gtag/jsscript tags in your theme - Google & YouTube app: open the app's settings and turn off its GA4 tracking
- Google Tag Manager: if you run GA4 through GTM, remove the GA4 tags from your container
Note which property and web stream each one used before you remove it, so you have a rollback path.
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 tab and find the Google Analytics 4 card
- Enter your GA4 API Secret (found in GA4 Admin > Data Streams > your stream > Measurement Protocol API secrets) and click Save Google Analytics 4
- Leave the API Secret saved. The Shopify pixel generator reads it, and purchase events reach GA4 through it. Installing the pixel is not on its own a reason to change the GA4 server-side setting. If GA4 starts showing duplicate purchases, contact support instead of flipping that setting yourself. See GA4 Connections.
Google Signals / Demographics
GA4 demographics reports (age, gender, interests) and GA4 remarketing audiences need Google Signals. The option is Turn on Google Signals. It appears in the GA4 step of setup when CleanClicks creates a new GA4 property for you, and it is off by default.
Our recommendation is to leave it off. Demographics only come from visitors who are signed into Google with Ads Personalization on, which is a slice of your traffic rather than a census, so the picture is often inaccurate. It will not change your Google Ads results either, because CleanClicks sends conversions to Google Ads directly. Turn it on and Google may also hide report rows for small audience segments, which hits smaller-traffic sites hardest.
Step 2: Install the Custom Pixel (Signal or Clarity)
The Custom Pixel is generated for your domain with your configuration baked in. It runs in Shopify's sandboxed iframe and tracks the full ecommerce funnel. When GA4 is configured, it also sends the GA4 purchase event on checkout completion.
- In your CleanClicks dashboard, go to Configuration → Ecommerce tab. In the Shopify card, enter your store address on card 1 · Your Shopify store and click Continue. If the card shows the Shopify setup summary instead, click Redo setup.
- On card 2 · Add the CleanClicks pixel, click Copy code and open Customer events. This copies your pixel code (generated for your domain) and opens Customer events in your Shopify admin. You can also click Copy on the code box.
- In Shopify Admin, go to Settings > Customer events
- Click Add custom pixel
- Name it CleanClicks
- In the Customer privacy section, set Permission to Not required
- Set Data sale to Does not qualify as data sale
- If Shopify shows a Data collection setting, set it 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.
Why "Not required"? The CleanClicks pixel runs for every visitor and applies the visitor's consent choice itself. When a visitor declines, it sends events as measurement-only and removes their hashed email. See CCPA and opt-out behavior for what each platform receives.
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 (Signal or Clarity)
The webhook provides a server-side order path. Verify webhook delivery, event and order IDs, deduplication, and the intended destination receipt before treating the purchase path as accepted.
- In the guided Shopify setup, click Continue to the webhook on card 2 (or Skip for now) to open card 3 · Add the order webhook
- Click Copy URL and open Webhooks. This copies the Webhook URL and opens Settings > Notifications > Webhooks in your Shopify admin.
- Click Create webhook
- Event: Order payment
- Format: JSON
- URL: paste the webhook URL
- Set Webhook API version to the newest dated version marked (Latest). The dropdown defaults to unstable. Do not use unstable or Release candidate.
- Click Save
- Scroll to the bottom of the Webhooks page. Under the list, Shopify shows one line: "All your webhooks will be signed with" followed by a long code. That code is the signing secret. Copy it.
- Back on card 3, paste it under Paste the signing secret from Shopify and click Save secret. CleanClicks stores it encrypted and never shows it again.
Important: Do not use Shopify's Send test button to check purchase tracking. CleanClicks may skip its sample order as stale, and the sample does not show that CleanClicks processed a paid order. Use a paid test order.
Refunds and cancellations: if you also create webhooks for Shopify's Refund created and Order cancellation events with the same webhook URL, CleanClicks receives them as
refundandcancellationevents with a negative value. CleanClicks does not send these events to any destination (an ad platform or GA4, for example) unless your site's CleanClicks record has a mapping for that event. You cannot add that mapping in your dashboard.
Testing
After setup, verify each component. On card 4, click Continue or Skip for now to reach the Shopify setup summary. From the summary, Set up reopens card 4 and Redo setup reopens card 2.
GA4 First-Party Loader
- In the Shopify setup summary, click Set up on the GA4 first-party loader row, then click Check my storefront and read the result
- Visit your store in an Incognito window
- Open GA4 Realtime report
- Browse a product page — look for
view_item
Custom Pixel
- Load any page of your storefront. In the Shopify setup summary, click Re-check. Once CleanClicks has received a pixel event, the Pixel row reads verified and names the latest event it found.
- Browse products, add to cart, search
- Complete a test checkout. The order appears under Recent conversions on the Dashboard.
Webhook
- Complete a real paid test order (not Shopify's Send test)
- In the Shopify setup summary on the Ecommerce tab, click Re-check. The Webhook row reads verified after CleanClicks processes the first paid order. If it says the order had no customer email, that the delivery was more than 48 hours old, or that the order could not be fully processed, you need a new paid order to check again.
- Find the order under Recent conversions on the Dashboard. Its destination lights do not show delivery status yet. Check the conversion in each ad platform you send to.
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 loader code is before </head> in layout/theme.liquid. Click Check my storefront on card 4. 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 saved on the Google Analytics 4 card of the Vendors tab |
| Duplicate GA4 events | Remove your existing GA4 setup (see "Disable Existing GA4" above) |
| Webhook row says Shopify sent an order CleanClicks could not verify | Re-copy the signing secret from Shopify and save it again on card 3 |
Next: WordPress Setup