- UTM tags say which campaign a visit came from; click ids such as gclid, fbclid and ttclid tie the visit to one exact ad click.
- Both live in the browser at first and disappear when nothing saves them: on a later visit, a blocked script or a payment page on another domain.
- Saving them in the cart when the shopper lands carries them into the Shopify order, so every order keeps its source even when the pixel never fired.
- With the source on the order you can audit single orders, credit campaigns on real purchases and send server events with the right click id to Meta, Google and TikTok.
To see the campaign source and click id of every Shopify order, save the UTM tags and the ad platform's click id when the shopper lands, write them to the cart, and let Shopify carry them into the order. Shopify then keeps them with the order as additional details, and a tracking tool can read them to credit the order and to send the purchase to Meta, Google Ads and TikTok with the right click id. Without that step, the values stay in the browser and are often gone by the time the order is placed.
This guide explains each parameter, why the data disappears, how to store it, what it lets you do, and how ROASaurus uses it today, including what waits for a Shopify permission.
The attribution parameters explained
Two kinds of values tell you where an order came from. UTM tags are labels you add to your own links. Click ids are added by the ad platform to each ad click.
| Parameter | Set by | What it tells you |
|---|---|---|
utm_source | You, in the ad or link | Where the traffic came from: google, facebook, newsletter |
utm_medium | You | The type of channel: cpc, paid_social, email |
utm_campaign | You | The campaign: spring_sale, bfcm |
utm_content, utm_term | You | The ad variant, and the search term for search ads |
utm_id | You or the platform | A campaign id, for joining your data with the platform's |
gclid, gbraid, wbraid | Google Ads auto-tagging | The exact Google ad click; Google Ads needs it to credit an uploaded conversion |
fbclid → _fbc | Meta | The Meta ad click; stored as the _fbc cookie for the Conversions API |
_fbp | The Meta pixel | Meta's browser id, used for matching |
ttclid, _ttp | TikTok | The TikTok ad click and TikTok's browser id |
msclkid, ScCid, epik, rdt_cid, twclid | Microsoft, Snapchat, Pinterest, Reddit, X | The click on each of those platforms |
| GA client id | The Google tag | GA4's browser id, so a server-sent purchase can be joined to its session |
| Consent state | Your cookie banner | Whether the visitor allowed marketing tracking |
The click id entry in the glossary has the short definition, and UTM parameters for Meta and TikTok shows how to tag your ads.
Why UTM and click id data disappear on Shopify
When a shopper lands from an ad, the UTM tags and the click id are in the address bar. From then on, they only survive if something saves them.
- The shopper comes back later. The landing page with the tags was a visit days ago. Shopify records the visits before an order and their landing pages, but a click id that no tool kept on landing is easy to lose.
- Scripts are blocked. Ad blockers, Safari's tracking prevention and iPhone privacy settings stop the scripts that would read and store the values. See what ad blockers do to your tracking.
- Cookies expire. Safari limits cookies set by scripts to 7 days, or 24 hours after a visit from a link with a click id.
- The checkout is sandboxed. Code in your theme does not run in Shopify's checkout, so it cannot add the values there.
- Payment pages on another domain. A wallet or payment provider can break the chain between the visit and the confirmation page.
The symptoms are familiar: purchases under direct or unassigned in GA4 (see GA4 unassigned traffic), fewer purchases in Ads Manager than in Shopify, and revenue in GA4 that does not match Shopify (see GA4 vs Shopify revenue).
How to store the campaign source and click ids in Shopify orders
- Capture on landing
A storefront script reads the UTM tags and click ids on every landing and keeps them first-party, on your own domain.
- Write cart attributes
When the shopper adds to cart, the script writes the values to cart attributes. Attributes whose name starts with an underscore are hidden from the shopper at checkout.
- Let Shopify carry them
Shopify copies the cart attributes into the order, where they appear with the order's additional details and in the order API.
- Respect consent
Store click ids and visitor ids only when the visitor allowed marketing tracking, and record the consent state with them.
- Read them from the order
Your attribution report and your server-side tracking read the values from the order, not from the browser.
Here is what the hidden attributes on an order can look like:
_tl v_7f3a9c21e4 _tl_gclid Cj0KCQiA…BwE _tl_fbc fb.1.1795600000000.IwAR2x… _tl_fbp fb.1.1795512000000.1834567890 _tl_ttclid E.C.P.v3… _tl_market us
How the data helps you optimize marketing
- Trace an order back to its source. When Ads Manager or GA4 misses a purchase, the order still shows which campaign and which click brought it.
- Credit campaigns on real purchases. Count orders and revenue per campaign from your orders, not from what each platform claims.
- Recover from tracking failures. A purchase GA4 put under direct, with a gclid on the order, was a Google Ads click.
- Read refunds per campaign. If one campaign brings many refunded orders, its source on those orders shows it.
- Help customer service. Knowing that a shopper came from a discount campaign or a specific ad explains their expectations.
- Build your own reports. Export or filter orders by campaign, channel or click id without depending on a platform dashboard.
Does this work with Meta, Google Ads and TikTok?
Yes, and that is where the stored values matter most. Each platform credits a server-sent purchase better when it carries the platform's own click id:
| Platform | Value from the order | What it improves |
|---|---|---|
| Meta | fbc and fbp | Conversions API purchases are tied to the ad click, which raises Event Match Quality |
| Google Ads | gclid, gbraid or wbraid | Server-sent conversions are credited to the exact click; hashed email helps when there is none |
| TikTok | ttclid and ttp | Events API purchases are tied to the click, also when the TikTok pixel was blocked on a phone |
| GA4 | The client id | A Measurement Protocol purchase joins the session that carried the campaign |
Server-side tracking on Shopify shows the full flow, and the ecommerce analytics guide covers the reports you can build on it.
How ROASaurus uses the order data today
On Shopify, the ROASaurus storefront script captures click ids and UTM tags first-party, through the app proxy on your own store domain. With marketing consent, it writes hidden cart attributes to every cart: the visitor id (_tl), the Meta, TikTok and Google click ids and browser ids, and the Shopify Market. The order arrives with them, and ROASaurus links it to every click and visit of that visitor. If the attributes are missing, it falls back to the thank-you page event, the hashed email, and the IP address and browser, and then to the click ids and UTMs in the landing page Shopify saved with the order.
Each order's page under Profit › Orders › Journeys shows the ad clicks before the purchase with their campaigns, the time to convert, how the order was matched (by cart attributes or a fallback), the credit each of the twelve attribution models gives each click, and a timeline of the journey. Profit › Orders › Profit per order filters orders by channel and UTM. The attribution report under Marketing › Channels & campaigns › Attribution adds it up per channel and campaign, with a lookback of 1 to 90 days or unlimited, 7 days by default. The same click ids go out with every server-side purchase, to Meta, Google Ads, TikTok and the other platforms you connect.
Setup
There is nothing to configure for the cart attributes: install the ROASaurus Shopify app and turn on its theme app embed, and every cart from a visitor with marketing consent gets them. To check, open a recent order's journey page and look at Matched by. The setup steps are in the Shopify setup guide, and the marketing attribution guide explains the models. Before a peak, run the BFCM tracking checklist, and check that your email tool gets the same data with Klaviyo tracking on Shopify.
Sources
- Shopify Dev Docs: Order object (custom attributes, customer journey summary)
- Shopify Help Center: Measuring marketing performance
- Google for Developers: Send offline conversion events to Google Ads (Data Manager API)
- Meta for Developers: ClickID and the fbp and fbc parameters