Skip to content
Merged
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: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Campaign tracking guides: changes need review from the analytics and attribution owner.
/content/docs/campaigns/tracking/ @masmalsah
14 changes: 13 additions & 1 deletion content/capabilities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -277,18 +277,30 @@ capabilities:
- /docs/apps/campaigns-app/build-campaign-packages
- /docs/apps/campaigns-app/campaigns-offers-and-discounts
- /docs/apps/campaigns-app/campaign-analytics
- /docs/apps/meta-pixel
- /docs/features/offers/marketing-attribution
developer_docs:
- /docs/campaigns
- /docs/campaigns/page-kit
- /docs/agent-setup
- /docs/campaigns/templates
- /docs/campaigns/api
- /docs/campaigns/admin-api
- /docs/campaigns/tracking
- /docs/campaigns/tracking/getting-started
- /docs/campaigns/tracking/google-tag-manager
- /docs/campaigns/tracking/google-analytics-4
- /docs/campaigns/tracking/meta
- /docs/campaigns/tracking/everflow
- /docs/campaigns/tracking/triple-whale
- /docs/campaigns/tracking/more-integrations
- /docs/campaigns/tracking/shop-sync
- /docs/campaigns/tracking/testing-and-troubleshooting
Comment thread
brettstirlingbond marked this conversation as resolved.
Resolved
api_operations: [tag:campaigns]
webhooks: []
skills: [next-campaigns-create, next-campaigns-setup]
status: available
last_verified: 2026-10-22
last_verified: 2026-11-16

- id: storefront-themes
title: Storefront themes
Expand Down
2 changes: 1 addition & 1 deletion content/docs/admin-api/guides/external-checkout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Users are first checked for an existing user by `email` before creating a new us
**It is not recommended to pass `phone_number` directly on the user when creating a cart or order, we recommend passing a local phone number in the `shipping_address` instead.** Address fields have country context, which allows local phone numbers to be passed and converted to [E.164 format](https://en.wikipedia.org/wiki/E.164) before being saved. A `phone_number` passed to the `user` object directly must be in E.164 format.
</Callout>
## Cart / Order Attribution Detail
Cart and Order `attribution` object sets the [marketing attribution](https://docs.nextcommerce.com/docs/features/offers/marketing-attribution) on the order for tracking the source of orders and use in orders reporting. You can also pass in [metadata](https://docs.nextcommerce.com/docs/build-a-store/technical-settings/metadata-fields-and-tags) fields that are configured on the store to track custom attribution parameters and integrate external tracking platforms.
Cart and Order `attribution` object sets the [marketing attribution](https://docs.nextcommerce.com/docs/features/offers/marketing-attribution) on the order for tracking the source of orders and use in orders reporting. You can also pass in [metadata](https://docs.nextcommerce.com/docs/build-a-store/technical-settings/metadata-fields-and-tags) fields that are configured on the store to track custom attribution parameters and integrate external tracking platforms. For how NEXT Campaigns funnels fill these fields, see [Tracking](/docs/campaigns/tracking#for-developers).

```json title="Attribution Detail"
"attribution": {
Expand Down
4 changes: 4 additions & 0 deletions content/docs/apps/guides/marketing-attribution.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,10 @@ Attribution metadata stored on the cart is automatically carried over to the ord

## Campaigns & API Order Attribution

<Callout type="info" title="Setting up tracking on a campaign">
This guide is for building an attribution app. To set up ad tracking on a NEXT campaign, see [Tracking](/docs/campaigns/tracking).
</Callout>

Not all orders originate from the storefront. Orders created through [Campaigns](/docs/campaigns), the [Admin API](/docs/admin-api), and recurring [Subscription](/docs/admin-api/guides/subscription-management) renewals bypass the storefront entirely — [Webhooks](/docs/webhooks) are the way to capture attribution data for these conversions.

### Subscribe to Webhooks
Expand Down
2 changes: 2 additions & 0 deletions content/docs/campaigns/api/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ Session tracking is available to enable visibility into campaign performance by

These events flow into Campaign Performance reports for real-time monitoring of activity on your campaign.

Session tracking feeds NEXT's own campaign reports only. To send events to ad and analytics platforms, and for the attribution fields you can pass on carts and orders, see [Tracking](/docs/campaigns/tracking).

### Packages
A **package** is a virtual link to a product or product variant in your campaign — what customers reference by `package_id` when creating carts and orders. Each package is usually one product variant at its campaign price. In Campaigns App, packages are created when an offer selects a store product, and they are listed on the campaign's **Products** tab; over the [Admin API](/docs/campaigns/admin-api#add-packages-to-a-campaign) you create them directly. Send the selected package and quantity from the page. Older campaigns may still expose package-level quantity for compatibility, but new quantity tiers should be modeled with offers rather than separate `1x`, `2x`, and `3x` package records.

Expand Down
46 changes: 15 additions & 31 deletions content/docs/campaigns/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ The pages above are wired up by the **Campaign Cart SDK**. Its documentation is
| [Getting started](https://cart-sdk.nextcommerce.com/latest/quickstart/) | Loading the SDK and configuring it |
| [Data attributes](https://cart-sdk.nextcommerce.com/latest/attributes/) | Every `data-next-*` attribute |
| [JavaScript API](https://cart-sdk.nextcommerce.com/latest/javascript-api/) | The `window.next` methods |
| [Analytics events](https://cart-sdk.nextcommerce.com/latest/analytics/) | Every tracking event and its payload |
| [Analytics events](https://cart-sdk.nextcommerce.com/v0.4.43/reference/analytics-events) | Every tracking event and its payload |
| [URL parameters](https://cart-sdk.nextcommerce.com/latest/attribute-reference/setup/url-parameters/) | Parameters the SDK reads at boot |
| [Loader script](https://cart-sdk.nextcommerce.com/latest/attribute-reference/setup/loader-script/) | Attributes the loader script reads (`data-campaign`, `data-funnel`) |
| [Debugger](https://cart-sdk.nextcommerce.com/latest/javascript-api/#debugging-with-debug1) | The `?debug=1` debug panel |
Expand Down Expand Up @@ -234,15 +234,17 @@ For conditional shipping discounts, such as free shipping at 3 or more, use a `s

### Domains

Domains are configured in your store's **Campaign Settings** and apply across all campaigns. They control which domains are authorized to use your campaign API keys.
Domains are configured in the Campaigns app, under **Settings**, then **Allowed Domains**, and apply across all campaigns. They control which domains are authorized to use your campaign API keys.

| Type | SDK Access | Analytics Tracking |
| Type | SDK Access | NEXT campaign analytics |
| --- | --- | --- |
| **Production** | Yes | Yes — events tracked automatically |
| **Development** | Yes | No — events suppressed |
| **Production** | Yes | Yes, events recorded automatically |
| **Development** | Yes | No, events ignored |

The environment setting controls NEXT's own campaign analytics only. Vendor pixels and the SDK's event stream still run on development domains. See [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting).

<Callout type="idea">
Add `localhost` and any staging domains as **development** domains so you can test the full checkout flow without polluting analytics data.
Add `localhost` and any staging domains as **development** domains so you can test the full checkout flow without adding sessions to NEXT campaign analytics. Vendor pixels on those pages still fire.
</Callout>

<Callout type="warn">
Expand All @@ -253,36 +255,18 @@ Requests from domains not listed in either production or development will be rej

## Analytics & Tracking

Every starter template ships with NEXT Campaign Analytics **on by default** in auto mode. The SDK automatically tracks the full funnel — page views, add-to-cart, begin checkout, shipping/payment info, purchase, and upsells — through the always-on internal `nextCampaign` provider. No code required.

To also forward those events to **Google Tag Manager** or **Facebook Pixel**, add your IDs in `_data/campaigns.json`:
Every starter template ships with NEXT Campaign Analytics **on by default**. The SDK automatically tracks the full funnel (page views, add-to-cart, begin checkout, shipping and payment info, purchase, and upsells) for NEXT's own campaign reports. No code required.

```json
{
"my-campaign": {
"name": "My Campaign",
"...": "...",
"gtm_id": "GTM-XXXXXXX",
"fb_pixel_id": "123456789012345"
}
}
```

<Callout type="info">
The matching `providers.gtm.enabled` and `providers.facebook.enabled` flags in `assets/config.js` control whether the SDK **forwards events** to each provider. Templates ship with these set to `false` — flip them to `true` once your IDs are in place. See the per-provider guides below for the full wiring.
</Callout>
To send those events to your ad and analytics platforms, see [Tracking](/docs/campaigns/tracking).

<Callout type="idea" title="Keep your campaign analytics clean">
Two mechanisms skip tracking entirely — including the always-on internal `nextCampaign` provider — so your campaign dashboards reflect **real customer conversions**, not internal QA or test traffic:

- **Development domains** — any domain marked *development* in your store's Campaign Settings suppresses all events. Add `localhost`, staging URLs, and preview hosts here.
- **`?ignore=true` URL parameter** — append it to any URL to silence tracking for the entire session, useful for one-off testing on a production domain. Clear it with `window.NextAnalyticsClearIgnore()`.
</Callout>
Two things keep test traffic out of NEXT's campaign reports:

- **Development domains**: NEXT campaign analytics ignores visits from any domain set to *Development* in the Campaigns app, under **Settings**, then **Allowed Domains**. Add `localhost`, staging URLs and preview hosts there.
- **`?ignore=true`**: add it to any link to turn tracking off for that browser tab.

### Event reference

- [Analytics events](https://cart-sdk.nextcommerce.com/latest/analytics/): every tracking event the SDK emits, what triggers it, and what each destination receives
Do not use `?ignore=true` when you are checking that a purchase is reported. See [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting).
</Callout>

---

Expand Down
1 change: 1 addition & 0 deletions content/docs/campaigns/meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"index",
"templates",
"page-kit",
"tracking",
"[Playground](/playground)",
"---Cart SDK---",
"external:[SDK documentation](https://cart-sdk.nextcommerce.com/latest/)",
Expand Down
Loading
Loading