diff --git a/content/docs/campaigns/tracking/everflow.mdx b/content/docs/campaigns/tracking/everflow.mdx index 4ab3dd1..12582d8 100644 --- a/content/docs/campaigns/tracking/everflow.mdx +++ b/content/docs/campaigns/tracking/everflow.mdx @@ -110,7 +110,7 @@ Direct links are less reliable than redirect links. If the click script does not ## Affiliate details on the link -The campaign also saves the affiliate (`aff` or `affid`) and sub-affiliate values (`sub1` to `sub5`) from the link onto the order. See the SDK's [attribution parameters](https://cart-sdk.nextcommerce.com/v0.4.43/reference/url-parameters#attribution). +The campaign also saves the affiliate (`aff` or `affid`) and sub-affiliate values (`sub1` to `sub5`) from the link onto the order. See the SDK's [URL parameters](https://cart-sdk.nextcommerce.com/latest/attribute-reference/setup/url-parameters/). ## What the app sends diff --git a/content/docs/campaigns/tracking/getting-started.mdx b/content/docs/campaigns/tracking/getting-started.mdx index 944aa5c..ecca4b8 100644 --- a/content/docs/campaigns/tracking/getting-started.mdx +++ b/content/docs/campaigns/tracking/getting-started.mdx @@ -3,7 +3,7 @@ title: Set up tracking description: Turn on tracking for your NEXT campaign. Add your platform IDs to a starter template, publish, and run a first test order. sidebar_label: Getting started audience: [merchant, developer] -last_verified: 2026-11-16 +last_verified: 2026-12-04 tags: - Guide --- @@ -75,7 +75,7 @@ https://campaign.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch ``` 3. Go through checkout and pay with a [test card](/docs/testing). -4. Continue to the next page after payment. This is where the purchase is reported. +4. Check where the purchase is reported. On Campaign Cart SDK 0.5.2, the version the starter templates load, it is reported on the checkout page as soon as the payment goes through. A campaign still on SDK 0.4.x reports it on the next page after payment, so continue to it. 5. Check each platform received it. Every platform guide has a **Verify it works** section, for example [Meta](/docs/campaigns/tracking/meta#verify-it-works). 6. Open the order in your store dashboard and check that its attribution shows `utm_source` as `test` and `utm_campaign` as `launch-test`. diff --git a/content/docs/campaigns/tracking/google-analytics-4.mdx b/content/docs/campaigns/tracking/google-analytics-4.mdx index a0044fc..3462f04 100644 --- a/content/docs/campaigns/tracking/google-analytics-4.mdx +++ b/content/docs/campaigns/tracking/google-analytics-4.mdx @@ -3,7 +3,7 @@ title: Google Analytics 4 description: Track your NEXT campaign in Google Analytics 4, and use those purchases as conversions in Google Ads, including for YouTube ads. sidebar_label: Google Analytics 4 audience: [merchant, developer] -last_verified: 2026-11-16 +last_verified: 2026-12-04 tags: - Guide --- @@ -47,7 +47,7 @@ Do not also add a GA4 tag for the same property in Google Tag Manager. Two copie | The order is paid | `purchase` | | An upsell is accepted | `upsell_purchase` | -The `purchase` is sent on the first page after payment: the upsell page, or the receipt if there is no upsell. +On Campaign Cart SDK 0.5.2, the version the starter templates load, the `purchase` is sent on the checkout page as soon as the payment goes through. If the shopper pays away from the page, for example with PayPal, it is sent on the first campaign page they return to. On SDK 0.4.x it is sent on the first page after payment: the upsell page, or the receipt if there is no upsell. To stop an event, add `ga4_blocked_events` to your campaign, for example `"ga4_blocked_events": "dl_add_shipping_info"`. @@ -91,7 +91,7 @@ GA4 reads where a visitor came from off the page link, so keep your UTM paramete 1. Connect Google Tag Assistant to your campaign at [tagassistant.google.com](https://tagassistant.google.com). This puts that browser's GA4 hits into debug mode, so they appear in DebugView. 2. In GA4, open **Admin**, then **DebugView**. 3. Go through checkout in the window Tag Assistant opens, so the events stay in debug mode. You should see `page_view`, `begin_checkout` and the other events. -4. Place an order with a [test card](/docs/testing). On the next page you should see `purchase` with your order number as the transaction ID. +4. Place an order with a [test card](/docs/testing). You should see `purchase` with your order number as the transaction ID: on SDK 0.5.2 while you are still on the checkout page, on SDK 0.4.x on the next page. 5. Accept an upsell. You should see `upsell_purchase` on the page after it. ## Troubleshooting diff --git a/content/docs/campaigns/tracking/google-tag-manager.mdx b/content/docs/campaigns/tracking/google-tag-manager.mdx index 559e9b1..506d038 100644 --- a/content/docs/campaigns/tracking/google-tag-manager.mdx +++ b/content/docs/campaigns/tracking/google-tag-manager.mdx @@ -3,7 +3,7 @@ title: Google Tag Manager description: Send your campaign's events to your own Google Tag Manager container, and build tags on them. sidebar_label: Google Tag Manager audience: [merchant, developer] -last_verified: 2026-11-16 +last_verified: 2026-12-04 tags: - Guide --- @@ -20,6 +20,8 @@ Use GTM when you want to manage tags yourself, or for a platform that has no gui The **Google Tag Manager** app you set up under **Apps** in your NEXT dashboard only adds its script to your Storefront. It is not added to your Campaigns, so follow this page to add GTM to your campaign. +This page is for campaigns on Campaign Cart SDK 0.5.2, the version the starter templates load. Where a campaign still on SDK 0.4.x behaves differently, the page says so. The SDK version is in your campaign's `_data/campaigns.json` as `sdk_version`. + ## Set up Setup has two parts, and you need both. @@ -50,6 +52,8 @@ gtm: { With only `gtm_id`, the container loads but receives no campaign events. With only the `config.js` setting, the events are sent but there is no container to receive them. +SDK 0.5.2 also reads a newer setting for the same switch, `analytics.destinations.gtm.enabled`. You only need one of them. If you set both, the `destinations` one is used. + ## Events you can build tags on Each event reaches GTM as a data layer event. Create a **Custom Event** trigger with the event name, then attach your tag. @@ -62,11 +66,15 @@ Each event reaches GTM as a data layer event. Create a **Custom Event** trigger | `dl_begin_checkout` | The checkout loads | | `dl_add_shipping_info` | A shipping address is entered | | `dl_add_payment_info` | Payment details are entered | -| `dl_purchase` | The order is paid. Sent on the first page after payment | +| `dl_purchase` | The order is paid. See [Purchases and upsells](#purchases-and-upsells) for which page sends it | | `dl_viewed_upsell` | An upsell page is shown | | `dl_upsell_purchase` | An upsell is accepted. Sent on the page after it | -The full list, with every field, is in the SDK's [Analytics events reference](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events). +SDK 0.5.2 also sends `dl_generate_lead` when the shopper's contact details are saved at checkout, and `dl_skipped_upsell` when an upsell is declined. + +These `dl_*` events use the same format as SDK 0.4.x, so tags built for a 0.4.x campaign keep working on 0.5.2. The SDK now calls this format deprecated, but it still sends it. + +The full list, with every field, is in the SDK's [GTM destination reference](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/gtm/). For a campaign on SDK 0.4.x, use the [0.4.43 analytics events reference](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events). ## Reading values in your tags @@ -83,17 +91,19 @@ Create **Data Layer Variables** in GTM for the values you need. | Google click ID | `attribution.gclid` | | Meta click ID | `attribution.metadata.fbclid` | -The events also carry the shopper's email, phone, name and address under `user_properties`. Decide which tags may read them, and see [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). +The events also carry the shopper's details under `user_properties`. `dl_purchase` and `dl_upsell_purchase` carry the email, name, phone and billing address. On SDK 0.5.2 the events before the purchase carry only the email and country once the shopper has typed them, and `dl_user_data` also carries the name and phone. Decide which tags may read them, and see [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). ## Purchases and upsells | | `dl_purchase` | `dl_upsell_purchase` | | --- | --- | --- | -| When | The first page after payment | The page after an upsell is accepted | +| When, SDK 0.5.2 | The checkout page, as soon as the payment goes through. If the shopper pays away from the page, for example with PayPal, the first campaign page they return to | The page after an upsell is accepted | +| When, SDK 0.4.x | The first page after payment | The page after an upsell is accepted | | Order ID | The order number, for example `100041` | The order reference followed by `-US1`, `-US2` and so on | | Amount | The price of the items as shown on your store, without shipping | The upsell only | - A purchase is sent once per order. Reloading the page does not send it again. +- On SDK 0.5.2, if the shopper leaves the checkout before the purchase is sent, the next campaign page they open sends it. - A tag on `dl_purchase` alone misses upsell revenue. Add a tag on `dl_upsell_purchase` if you want it. - The amount is the item prices only. Add `ecommerce.shipping` if your platform should see shipping. On a store that shows prices without tax, add `ecommerce.tax` as well. @@ -107,19 +117,45 @@ To count purchases in Google Ads from GTM, add a Google Ads conversion tag on a Do this only if you are not already importing purchases into Google Ads from GA4. See [Use GA4 purchases in Google Ads](/docs/campaigns/tracking/google-analytics-4#use-ga4-purchases-in-google-ads). +## Keep an event out of GTM + +To stop one event reaching your container, list it in `blockedEvents` in `assets/config.js`. There are two ways to write it: + +```js title="assets/config.js" +// Inside analytics.providers, with dl_* names. Works on SDK 0.4.x and 0.5.2: +gtm: { + enabled: true, + blockedEvents: ['dl_upsell_purchase'] +}, +``` + +```js title="assets/config.js" +// Inside analytics, with the SDK's own event names. SDK 0.5.2 only: +destinations: { + gtm: { blockedEvents: ['upsell_completed'] } +}, +``` + +Use one or the other. On 0.5.2, a `destinations.gtm.blockedEvents` list replaces the `providers.gtm.blockedEvents` list; the two are not combined. The names that match each `dl_*` event are in the [GTM destination reference](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/gtm/#events). + +A blocked event is kept off `window.dataLayer`, which is what GTM reads. It still reaches `window.NextDataLayer`, so a script that reads that one still sees it. + ## Verify it works 1. Start **Preview** mode in your GTM container and open your campaign. 2. You should see `dl_user_data` first, then the other events as you move through the funnel. -3. Place an order with a [test card](/docs/testing). On the next page, `dl_purchase` appears with the order number. +3. Place an order with a [test card](/docs/testing). `dl_purchase` appears with the order number: on SDK 0.5.2 while you are still on the checkout page, on SDK 0.4.x on the next page. 4. Accept an upsell. `dl_upsell_purchase` appears on the page after it. +On SDK 0.5.2 you can also open any campaign page with `?debug=1` at the end of the link. The SDK's debug panel opens, and its **Analytics** tab lists each event the page sent, whether it reached GTM, and why not if it did not. Open a page with `?debug=0` to close the panel again. See [See what was sent](https://cart-sdk.nextcommerce.com/latest/analytics-reference/how-it-works/#see-what-was-sent). + ## Troubleshooting | Problem | Likely cause | Fix | | --- | --- | --- | | The container does not load | `gtm_id` is missing or empty | Add your container ID and rebuild | | The container loads but receives no events | `gtm` is switched off in `assets/config.js` | Switch it on | +| One event never reaches the container | It is listed in `blockedEvents` | Remove it from the list. See [Keep an event out of GTM](#keep-an-event-out-of-gtm) | | Tags do not fire | The trigger's event name does not match | Copy the name from GTM Preview | | A page view trigger never fires | It listens for `dl_page_view` | Use `dl_user_data` | @@ -127,4 +163,9 @@ More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testin ## Hand-built campaigns -On a campaign that is not built from a starter template, add your GTM container to every page yourself, then switch `gtm` on as in step 2. See the [Campaign Cart SDK analytics docs](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events). +On a campaign that is not built from a starter template, add your GTM container to every page yourself. + +- **SDK 0.5.2:** the SDK sends its `dl_*` events to `window.dataLayer` unless your page turns them off, so the container is all you add. The starter templates turn them off in `assets/config.js` until you switch `gtm` on, which is why step 2 is needed there. See the [GTM destination reference](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/gtm/). +- **SDK 0.4.x:** switch `gtm` on as in step 2. See the [0.4.43 analytics events reference](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events). + +On SDK 0.5.2, developers can also listen to the SDK's own events with `next.analytics.on` and push them to the container in whatever shape the tags need. Turn the `dl_*` events off if you do, or the container gets each event twice. See [Destinations](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/overview/#by-hand). diff --git a/content/docs/campaigns/tracking/index.mdx b/content/docs/campaigns/tracking/index.mdx index 7dce258..cf369fb 100644 --- a/content/docs/campaigns/tracking/index.mdx +++ b/content/docs/campaigns/tracking/index.mdx @@ -3,7 +3,7 @@ title: Tracking overview description: How ad and analytics tracking works in NEXT Campaigns, which platforms are supported, and which guide to follow for Google, Meta, Everflow, Triple Whale, TikTok and more. sidebar_label: Overview audience: [merchant, developer] -last_verified: 2026-11-16 +last_verified: 2026-12-04 tags: - Guide --- @@ -62,16 +62,18 @@ Some platforms can receive the shopper's email and phone to improve matching. Th ## For developers -The campaign's own events, their fields, and the ad details saved on each order are documented in the Campaign Cart SDK reference. The starter templates use SDK 0.4.43, so use the 0.4.43 pages: - -| What you need | SDK reference | -| --- | --- | -| Every event and when it is sent | [Analytics events: event names](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#event-names) | -| The fields on each event | [Analytics events: payload reference](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#payload-reference) | -| What GTM, Meta and RudderStack each receive | [Analytics events: providers](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#providers) | -| Which link parameters are saved on the order | [URL parameters: attribution](https://cart-sdk.nextcommerce.com/v0.4.43/reference/url-parameters#attribution) | -| Adding your own values to the order, with examples | [JavaScript API: attribution and metadata](https://cart-sdk.nextcommerce.com/v0.4.43/reference/javascript-api#attribution-and-metadata) | -| Sending your own events, with examples | [JavaScript API: analytics](https://cart-sdk.nextcommerce.com/v0.4.43/reference/javascript-api#analytics) | -| Checking events in the browser | [Debugger](https://cart-sdk.nextcommerce.com/v0.4.43/reference/debugger) | +The campaign's own events, their fields, and the ad details saved on each order are documented in the Campaign Cart SDK reference. The starter templates load SDK 0.5.2, documented in [How analytics works](https://cart-sdk.nextcommerce.com/latest/analytics-reference/how-it-works/), [Destinations](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/overview/), [Events](https://cart-sdk.nextcommerce.com/latest/events/) and the [JavaScript API](https://cart-sdk.nextcommerce.com/latest/javascript-api/). A campaign that still loads 0.4.x uses the 0.4.43 pages: + +| What you need | SDK 0.5.2 | SDK 0.4.x | +| --- | --- | --- | +| Every tracking event and when it is sent | [How analytics works](https://cart-sdk.nextcommerce.com/latest/analytics-reference/how-it-works/) | [Analytics events: event names](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#event-names) | +| The fields on each event | [Tracking events](https://cart-sdk.nextcommerce.com/latest/analytics/) | [Analytics events: payload reference](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#payload-reference) | +| What GTM, GA4, Meta and RudderStack each receive, and how to turn each on, off or block an event | [Destinations](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/overview/) | [Analytics events: providers](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#providers) | +| The `dl_*` events GTM reads | [GTM destination](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/gtm/) | [Analytics events: event names](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events#event-names) | +| Which link parameters are saved on the order | [URL parameters](https://cart-sdk.nextcommerce.com/latest/attribute-reference/setup/url-parameters/) | [URL parameters: attribution](https://cart-sdk.nextcommerce.com/v0.4.43/reference/url-parameters#attribution) | +| Adding your own values to the order | [JavaScript API: actions](https://cart-sdk.nextcommerce.com/latest/javascript-api/#actions), with `next.actions.setMetadata` | [JavaScript API: attribution and metadata](https://cart-sdk.nextcommerce.com/v0.4.43/reference/javascript-api#attribution-and-metadata) | +| Sending events to your own tool | [Destinations: by hand](https://cart-sdk.nextcommerce.com/latest/analytics-reference/destinations/overview/#by-hand), with `next.analytics.on` | [JavaScript API: analytics](https://cart-sdk.nextcommerce.com/v0.4.43/reference/javascript-api#analytics) | +| Checking events in the browser | [See what was sent](https://cart-sdk.nextcommerce.com/latest/analytics-reference/how-it-works/#see-what-was-sent), with `?debug=1` | [Debugger](https://cart-sdk.nextcommerce.com/v0.4.43/reference/debugger) | +| What changed from 0.4.x | [Migrating from 0.4.x](https://cart-sdk.nextcommerce.com/latest/migrating-from-0-4/) | | To read the saved ad details from an order, see [Marketing attribution](/docs/apps/guides/marketing-attribution). diff --git a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx index fc9da53..f1843da 100644 --- a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx +++ b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx @@ -3,7 +3,7 @@ title: Test and troubleshoot tracking description: Place a test order on your campaign, check what was reported at each step, and fix the tracking problems that come up most often. sidebar_label: Testing and troubleshooting audience: [merchant, developer] -last_verified: 2026-11-16 +last_verified: 2026-12-04 tags: - Guide --- @@ -11,12 +11,14 @@ import { Callout } from 'fumadocs-ui/components/callout'; Use this page to check your tracking before you launch, and to fix it when something is missing. +This page is for campaigns on Campaign Cart SDK 0.5.2, the version the starter templates load. Where a campaign still on SDK 0.4.x behaves differently, the page says so. The SDK version is in your campaign's `_data/campaigns.json` as `sdk_version`. + ## Before you test - **Test on a deployed production build.** Build with `npm run build`. The development server (`npm run dev`) leaves tracking out. - **Use a new private window for each test.** It starts a clean visit, with no ad details left over from an earlier test. - **Pay with a [test card](/docs/testing).** No money moves. -- **Do not use `?ignore=true`.** It turns tracking off for that browser tab. +- **Do not use `?ignore=true`.** It turns tracking off for that browser tab. Open a page with `?ignore=false` to turn it back on. A test order reports a real-looking purchase to every platform you have turned on. A domain set to **Development** does not stop this; it only keeps the visit out of NEXT's own campaign analytics. Expect your test orders in your ad platform reports. @@ -41,12 +43,18 @@ https://campaign.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=tracki 2. Go to checkout. Your platforms should show a page view and a checkout-started event. 3. Enter your details and pay with a test card. -4. Continue to the next page. This is where the purchase is reported. Each platform should show one purchase with your order number. -5. Reload that page. No second purchase should appear. +4. Check the purchase. Each platform should show one purchase with your order number. On SDK 0.5.2 it is reported on the checkout page as soon as the payment goes through. On SDK 0.4.x it is reported on the next page, so continue to it. +5. Reload the page. No second purchase should appear. 6. Accept an upsell if you have one. The upsell is reported on the page after it. 7. Open the order in your store dashboard. Its attribution should show the test details from your link. -Each platform guide has a **Verify it works** section that says where to look in that platform. Developers can also inspect the campaign's events in the browser with the SDK's [debugger](https://cart-sdk.nextcommerce.com/v0.4.43/reference/debugger). +Each platform guide has a **Verify it works** section that says where to look in that platform. + +### See what the campaign sent + +On SDK 0.5.2, add `?debug=1` to the end of any campaign link. The SDK's debug panel opens, and stays open in that tab as you move through the funnel. Its **Analytics** tab lists each event the page sent, what it carried, which platforms it reached, and why an event was not sent. Open a page with `?debug=0` to close it. See [See what was sent](https://cart-sdk.nextcommerce.com/latest/analytics-reference/how-it-works/#see-what-was-sent). + +On SDK 0.4.x, use the [0.4.43 debugger](https://cart-sdk.nextcommerce.com/v0.4.43/reference/debugger) instead. A payment that fails reports no purchase. Only paid orders are reported. To check this yourself, a store with the Test Gateway can pay with the declining test card in the [testing guide](/docs/admin-api/guides/testing-guide#test-gateway). @@ -66,7 +74,8 @@ The two numbers should be close. If a platform shows noticeably more or fewer pu | No platform receives anything, in one browser tab | `?ignore=true` was used earlier in the tab | Open a new private window | | One platform receives nothing | Its ID is missing from `_data/campaigns.json` | Add the ID and rebuild | | GTM or the Meta pixel loads but receives no events | It is switched off in `assets/config.js` | Switch it on. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager#set-up) or [Meta](/docs/campaigns/tracking/meta#set-up) | -| Checkout events arrive but no page views or purchases | `analytics.mode` in `assets/config.js` is not `'auto'` | Set it to `'auto'` | +| Checkout events arrive but no page views or purchases, on SDK 0.4.x | `analytics.mode` in `assets/config.js` is not `'auto'` | Set it to `'auto'`. SDK 0.5.2 ignores this setting | +| One event never reaches one platform | The event is on that platform's block list: `blockedEvents` in `assets/config.js` for GTM, Meta and RudderStack, or a setting such as `ga4_blocked_events` in `_data/campaigns.json` for the others | Remove it from the list. The platform's guide shows where its list is, for example [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager#keep-an-event-out-of-gtm), [Meta](/docs/campaigns/tracking/meta#count-each-purchase-once) or [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#what-gets-tracked) | | A store app does nothing on the campaign | Most tracking apps only add their scripts to your Storefront. A few, such as the Meta Pixel app's purchase, also cover campaign orders | Set the platform up with its guide in this section. See the [overview](/docs/campaigns/tracking#how-tracking-works) for the apps that cover campaign orders | | The checkout itself fails to load the cart | The campaign's domain is not in **Allowed Domains** | Add it in the Campaigns app under **Settings**, then **Allowed Domains** | @@ -74,7 +83,8 @@ The two numbers should be close. If a platform shows noticeably more or fewer pu | Problem | Cause | Fix | | --- | --- | --- | -| No purchase after a test order | The shopper never reached the page after payment | Continue to the upsell or receipt page | +| No purchase after a test order, on SDK 0.4.x | The shopper never reached the page after payment | Continue to the upsell or receipt page | +| No purchase after a test order, on SDK 0.5.2 | The shopper paid away from the page, for example with PayPal, and has not come back to the campaign, or left the checkout before the purchase was sent | The purchase is sent on the first campaign page they open next. Continue to the upsell or receipt page | | No purchase when you reopen an order's page | Each order is reported once | Expected. Place a new test order | | NEXT campaign analytics shows no sessions | The domain is set to **Development** | Set it to **Production** |