Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion content/docs/campaigns/tracking/everflow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions content/docs/campaigns/tracking/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down Expand Up @@ -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`.

Expand Down
6 changes: 3 additions & 3 deletions content/docs/campaigns/tracking/google-analytics-4.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down Expand Up @@ -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"`.

Expand Down Expand Up @@ -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
Expand Down
55 changes: 48 additions & 7 deletions content/docs/campaigns/tracking/google-tag-manager.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand All @@ -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.
Expand Down Expand Up @@ -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.
</Callout>

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.
Expand All @@ -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

Expand All @@ -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.

Expand All @@ -107,24 +117,55 @@ 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` |

More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting).

## 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).
26 changes: 14 additions & 12 deletions content/docs/campaigns/tracking/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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
---
Expand Down Expand Up @@ -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:
Comment thread
next-devin marked this conversation as resolved.
Resolved

| 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).
Loading