From a2dfa91cb8c70c06a2ad16b7bbeee696d1d75486 Mon Sep 17 00:00:00 2001 From: Brett Bond Date: Mon, 16 Nov 2026 21:11:12 +1100 Subject: [PATCH 01/10] Add Guides > Tracking section for NEXT Campaigns New content/docs/campaigns/tracking/ (12 pages): overview, getting started, Triple Whale, Meta Pixel and Conversions API, TikTok, Google Ads and YouTube, GA4, GTM, more integrations, Shop Sync stores, events and attribution reference, testing and troubleshooting. Each platform page carries a verification status table from source review (SDK v0.4.43 and v0.5.0, starter templates 206780f, store app sources) and a test order walked on 2026-11-16. Consolidation: campaigns getting-started analytics section points to the new section and corrects the development-domain wording; pointers from the Campaigns API, marketing attribution, storefront event tracking, checkout links and external checkout pages; tracking pages added to the campaigns capability; CODEOWNERS for the tracking folder. Co-Authored-By: Claude Opus 5.5 --- .github/CODEOWNERS | 2 + content/capabilities.yaml | 13 +- .../admin-api/guides/external-checkout.mdx | 2 +- .../apps/guides/marketing-attribution.mdx | 4 + content/docs/campaigns/api/index.mdx | 2 + content/docs/campaigns/index.mdx | 22 +- content/docs/campaigns/meta.json | 1 + .../tracking/events-and-attribution.mdx | 181 +++++++++ .../campaigns/tracking/getting-started.mdx | 148 +++++++ .../docs/campaigns/tracking/google-ads.mdx | 207 ++++++++++ .../campaigns/tracking/google-analytics-4.mdx | 140 +++++++ .../campaigns/tracking/google-tag-manager.mdx | 241 ++++++++++++ content/docs/campaigns/tracking/index.mdx | 106 +++++ content/docs/campaigns/tracking/meta.json | 17 + content/docs/campaigns/tracking/meta.mdx | 371 ++++++++++++++++++ .../campaigns/tracking/more-integrations.mdx | 134 +++++++ content/docs/campaigns/tracking/shop-sync.mdx | 164 ++++++++ .../tracking/testing-and-troubleshooting.mdx | 172 ++++++++ content/docs/campaigns/tracking/tiktok.mdx | 209 ++++++++++ .../docs/campaigns/tracking/triple-whale.mdx | 243 ++++++++++++ content/docs/storefront/checkout-links.mdx | 4 +- content/docs/storefront/event-tracking.mdx | 5 + 22 files changed, 2376 insertions(+), 12 deletions(-) create mode 100644 .github/CODEOWNERS create mode 100644 content/docs/campaigns/tracking/events-and-attribution.mdx create mode 100644 content/docs/campaigns/tracking/getting-started.mdx create mode 100644 content/docs/campaigns/tracking/google-ads.mdx create mode 100644 content/docs/campaigns/tracking/google-analytics-4.mdx create mode 100644 content/docs/campaigns/tracking/google-tag-manager.mdx create mode 100644 content/docs/campaigns/tracking/index.mdx create mode 100644 content/docs/campaigns/tracking/meta.json create mode 100644 content/docs/campaigns/tracking/meta.mdx create mode 100644 content/docs/campaigns/tracking/more-integrations.mdx create mode 100644 content/docs/campaigns/tracking/shop-sync.mdx create mode 100644 content/docs/campaigns/tracking/testing-and-troubleshooting.mdx create mode 100644 content/docs/campaigns/tracking/tiktok.mdx create mode 100644 content/docs/campaigns/tracking/triple-whale.mdx diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..85b87f8 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Campaign tracking guides: changes need review from the analytics and attribution owner. +/content/docs/campaigns/tracking/ @masmalsah diff --git a/content/capabilities.yaml b/content/capabilities.yaml index 1cf012e..9b5b645 100644 --- a/content/capabilities.yaml +++ b/content/capabilities.yaml @@ -277,6 +277,8 @@ 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 @@ -284,11 +286,20 @@ capabilities: - /docs/campaigns/templates - /docs/campaigns/api - /docs/campaigns/admin-api + - /docs/campaigns/tracking + - /docs/campaigns/tracking/getting-started + - /docs/campaigns/tracking/triple-whale + - /docs/campaigns/tracking/meta + - /docs/campaigns/tracking/tiktok + - /docs/campaigns/tracking/google-ads + - /docs/campaigns/tracking/shop-sync + - /docs/campaigns/tracking/events-and-attribution + - /docs/campaigns/tracking/testing-and-troubleshooting 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 diff --git a/content/docs/admin-api/guides/external-checkout.mdx b/content/docs/admin-api/guides/external-checkout.mdx index 6f3cce3..9e9fdc9 100644 --- a/content/docs/admin-api/guides/external-checkout.mdx +++ b/content/docs/admin-api/guides/external-checkout.mdx @@ -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. ## 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 the [Events and attribution reference](/docs/campaigns/tracking/events-and-attribution). ```json title="Attribution Detail" "attribution": { diff --git a/content/docs/apps/guides/marketing-attribution.mdx b/content/docs/apps/guides/marketing-attribution.mdx index acdd7eb..eb1d874 100644 --- a/content/docs/apps/guides/marketing-attribution.mdx +++ b/content/docs/apps/guides/marketing-attribution.mdx @@ -215,6 +215,10 @@ Attribution metadata stored on the cart is automatically carried over to the ord ## Campaigns & API Order Attribution + +This guide is for building an attribution app. To set up Triple Whale, Meta, TikTok, Google Ads or another platform on a NEXT Campaigns funnel, see [Tracking](/docs/campaigns/tracking). + + 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 diff --git a/content/docs/campaigns/api/index.mdx b/content/docs/campaigns/api/index.mdx index 2c3ba8d..74a6f3e 100644 --- a/content/docs/campaigns/api/index.mdx +++ b/content/docs/campaigns/api/index.mdx @@ -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) and the [Events and attribution reference](/docs/campaigns/tracking/events-and-attribution). + ### 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. diff --git a/content/docs/campaigns/index.mdx b/content/docs/campaigns/index.mdx index bbf53ff..4672556 100644 --- a/content/docs/campaigns/index.mdx +++ b/content/docs/campaigns/index.mdx @@ -236,10 +236,12 @@ For conditional shipping discounts, such as free shipping at 3 or more, use a `s 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. -| 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). Add `localhost` and any staging domains as **development** domains so you can test the full checkout flow without polluting analytics data. @@ -253,7 +255,9 @@ 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. +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 and payment info, purchase, and upsells) through the internal `nextCampaign` provider, which templates ship turned on. No code required. + +Setup guides for every supported platform (Triple Whale, Meta, TikTok, Google Ads, GA4, GTM and more), the event and attribution reference, and testing steps are in [Tracking](/docs/campaigns/tracking). To also forward those events to **Google Tag Manager** or **Facebook Pixel**, add your IDs in `_data/campaigns.json`: @@ -269,14 +273,16 @@ To also forward those events to **Google Tag Manager** or **Facebook Pixel**, ad ``` -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. +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. The [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) and [Meta](/docs/campaigns/tracking/meta) guides cover the full wiring, and the other platforms use one key each in `_data/campaigns.json`. -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: +Two mechanisms keep test traffic out of your campaign dashboards, so they reflect **real customer conversions**, not internal QA: + +- **Development domains**: NEXT campaign analytics ignores events from any domain marked *development* in your store's Campaign Settings. Add `localhost`, staging URLs, and preview hosts here. Vendor pixels on those pages still fire. +- **`?ignore=true` URL parameter**: append it to any URL to silence all SDK tracking for the browser session, useful for one-off testing on a production domain. Clear it with `window.NextAnalyticsClearIgnore()`. -- **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()`. +Do not use `?ignore=true` when you are testing that a purchase event fires: it stops every event, including the purchase. diff --git a/content/docs/campaigns/meta.json b/content/docs/campaigns/meta.json index 67a941a..8adb683 100644 --- a/content/docs/campaigns/meta.json +++ b/content/docs/campaigns/meta.json @@ -8,6 +8,7 @@ "index", "templates", "page-kit", + "tracking", "[Playground](/playground)", "---Cart SDK---", "external:[SDK documentation](https://cart-sdk.nextcommerce.com/latest/)", diff --git a/content/docs/campaigns/tracking/events-and-attribution.mdx b/content/docs/campaigns/tracking/events-and-attribution.mdx new file mode 100644 index 0000000..b0a8b09 --- /dev/null +++ b/content/docs/campaigns/tracking/events-and-attribution.mdx @@ -0,0 +1,181 @@ +--- +title: Events and attribution reference +description: Look up Campaign Cart SDK event names, purchase values and the attribution fields sent with your orders. Compare SDK 0.4.43 with the source-checked changes in 0.5.0. +sidebar_label: Events and attribution +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- + +## Event names by SDK version + +Starter templates pin SDK 0.4.43. Use the 0.4.x column for those funnels. The table lists events emitted by 0.4.43, including events you trigger manually. The last column describes the 0.4.43 trigger unless it explicitly says otherwise. + +| Moment | SDK 0.4.x event | SDK 0.5.0 event | Fires on | +| --- | --- | --- | --- | +| Page load or user context refresh | `dl_user_data` | `page_viewed` | Every page load in auto mode; also on supported context refreshes | +| Product list viewed | `dl_view_item_list` | `product_list_viewed` | A page with multiple packages, a configured view-item-list meta tag, or `next.trackViewItemList()` | +| Product viewed | `dl_view_item` | `product_viewed` | A single or selected package, a configured view-item meta tag, or `next.trackViewItem()` | +| Item added | `dl_add_to_cart` | `product_added_to_cart` | Cart item added in auto mode; 0.5.0 also reports carts filled before page load | +| Item removed | `dl_remove_from_cart` | `product_removed_from_cart` | Cart item removed in auto mode | +| Package swapped | `dl_package_swapped` | No direct equivalent | Package selector in swap mode; 0.5.0 removes this event and sends removal and addition events | +| Cart updated | `dl_cart_updated` | `cart_updated` | Cart update in auto mode | +| Checkout started | `dl_begin_checkout` | `checkout_started` | Checkout form initialization with a non-empty cart, in any mode | +| Shipping entered | `dl_add_shipping_info` | `checkout_shipping_address_submitted`, `checkout_shipping_method_submitted` | Shipping method selection, autofill or address autocomplete, in any mode | +| Payment entered | `dl_add_payment_info` | `checkout_payment_info_submitted` | Complete card fields, an express payment button press or redirect payment submission, in any mode | +| Order purchased | `dl_purchase` | `checkout_completed` | First SDK page that freshly fetches the paid order, in auto mode | +| Upsell viewed | `dl_viewed_upsell` | `upsell_viewed` | Upsell page | +| Upsell skipped | `dl_skipped_upsell` | `upsell_skipped` | Shopper skips an upsell | +| Upsell purchased | `dl_upsell_purchase` | `upsell_completed` | Next SDK page after acceptance, from the queued event | +| Scroll threshold reached | `dl_scroll_depth` | No mapping confirmed | Configured scroll-tracking meta tag thresholds, once per threshold per page, in any mode | +| Exit intent shown | `dl_exit_intent_shown` | No direct tracking event; data layer only | Exit-intent popup shown, in auto mode | +| Exit intent accepted | `dl_exit_intent_accepted` | No direct tracking event; data layer only | Exit-intent popup clicked, in auto mode | +| Exit intent dismissed | `dl_exit_intent_dismissed` | No direct tracking event; data layer only | Exit-intent popup dismissed, in auto mode | +| Exit intent closed | `dl_exit_intent_closed` | No direct tracking event; data layer only | Exit-intent popup closed, in auto mode | +| Exit intent action | `dl_exit_intent_action` | No direct tracking event; data layer only | Exit-intent action, in auto mode | +| Sign-up | `dl_sign_up` | No mapping confirmed | Your call to `next.trackSignUp(email)` | +| Login | `dl_login` | No mapping confirmed | Your call to `next.trackLogin(email)` | +| Custom event | Your event name | No mapping confirmed | Your call to `next.trackCustomEvent(name, data)` | + +SDK 0.4.43 defines `dl_page_view`, `dl_route_changed`, `dl_view_cart`, `dl_select_item`, `dl_view_search_results` and `dl_subscribe`, but never emits them. The SDK Meta provider's `PageView` comes from `dl_user_data`. + +The `dl_*` event stream still exists on 0.5.0 as a deprecated compatibility layer. Its shipping compatibility event is sent only for the first shipping-address or shipping-method event per checkout. Unconfirmed: the 0.5.0 mappings and behavior above were checked in source, but not in a live funnel. No 0.5.0 mapping is confirmed for scroll depth, sign-up, login or your custom event names. + +## Purchase event + +On SDK 0.4.43, `dl_purchase` fires on the first SDK page that does a fresh fetch of the order from `?ref_id=` or `?order_ref_id=` after payment. This can be your upsell page before the receipt. Creating the order on the checkout page does not emit it. A cached order with the same reference, loaded less than 15 minutes ago, does not emit it again. + +Set `window.nextConfig.analytics.enabled` to `true` and `window.nextConfig.analytics.mode` to `'auto'` for automatic `dl_purchase`. Only `mode === 'auto'` starts the auto-trackers; omitting `mode` does not enable them. + +| Field | SDK 0.4.43 value | +| --- | --- | +| `ecommerce.transaction_id` | Order number, stringified. If absent, the SDK falls back to `order.ref_id`, then `orderId`, then `transactionId`. Without an identifier it does not build the event | +| `event_id` | Same value as `ecommerce.transaction_id` | +| `ecommerce.value` | Item revenue: sum of item price multiplied by quantity. Tax and shipping are not added | +| `ecommerce.tax` | `order.total_tax` | +| `ecommerce.shipping` | Shipping on your store's displayed tax basis | +| `ecommerce.currency` | Order currency, or campaign currency if absent | +| `ecommerce.items` | Order line items | +| `ecommerce.items[].item_id` | Product SKU, falling back to `SKU-` | +| `ecommerce.items[].item_variant_id` | Variant identifier, when available | + +For tax-exclusive stores, `value` excludes tax and shipping. The per-unit price uses the store's displayed basis: tax-exclusive for tax-exclusive stores, tax-inclusive for VAT stores. On a VAT store, item tax is already in `value`, and `tax` is also sent separately. + +An unpaid order with `payment_complete_url` does not fire `dl_purchase`. A payment-failure landing also vetoes it. The failure check uses the recorded failure path, or `?payment_failed=true` unless the current path matches the recorded success path. + +The SDK deduplicates purchases in `localStorage` under `nextDataLayer_reportedPurchases`, keeping the last 20 transaction IDs without a time expiry. The key can have the SDK's scope suffix. It records an ID after the event is pushed to `window.NextDataLayer`. + +In the live SDK 0.4.43 test, `transaction_id` and `event_id` were the order number. The purchase fired on the upsell page with `value: 12`, `tax: 0` and `shipping: 0`. The order total became 15 after the upsell. Revisiting the upsell page did not send another `dl_purchase`. + +## Upsell event + +On SDK 0.4.43, `dl_upsell_purchase` uses `transaction_id: -US`, where `n` counts accepted upsells. Its `event_id` is the same string. The reference can differ from the order number used by `dl_purchase`. + +The event reports the accepted upsell line only, with `tax: 0` and `shipping: 0`, except for the bundle behavior below. It is queued in `sessionStorage` and replayed on the next SDK page where analytics initializes. If it is more than 5 minutes old at replay, it is dropped. Acceptance without navigation leaves it queued. + +The value basis varies by acceptance path: + +| Acceptance path | `value` basis | +| --- | --- | +| Accept-upsell button, single package | Added order line on the store's displayed tax basis | +| Accept-upsell button, bundle | One event per bundle item, each with the whole bundle total. Summing these events overcounts bundle revenue | +| Upsell page or `next.addUpsell` | Added line's `price_incl_tax`, falling back to campaign package price multiplied by quantity | +| Package toggle | Campaign package price multiplied by quantity | + +No attribution is sent on upsell API calls. The added lines belong to the original order, which received attribution when it was created. The analytics event itself carries the current attribution at replay time. + +## Attribution captured from the URL + +On SDK 0.4.43, these URL values become fields in your order's `attribution` object. The last column is relative to that object. + +| URL parameter | Stored as | Sent on order | +| --- | --- | --- | +| `utm_source` | `attribution.utm_source` | `utm_source` | +| `utm_medium` | `attribution.utm_medium` | `utm_medium` | +| `utm_campaign` | `attribution.utm_campaign` | `utm_campaign` | +| `utm_content` | `attribution.utm_content` | `utm_content` | +| `utm_term` | `attribution.utm_term` | `utm_term` | +| `gclid` | `attribution.gclid` | `gclid` | +| `aff` or `affid` | `attribution.affiliate` | `affiliate`; `affid` takes precedence | +| `sub1` to `sub5`, or `subaffiliate1` to `subaffiliate5` | Corresponding `attribution.subaffiliate1` to `attribution.subaffiliate5` | `subaffiliate1` to `subaffiliate5`; long names take precedence, values truncated to 225 characters | +| `fbclid` | `attribution.metadata.fbclid` | `metadata.fbclid` | +| `clickid` | `attribution.metadata.clickid` | `metadata.clickid` | +| `evclid` | `attribution.metadata.everflow_transaction_id` | `metadata.everflow_transaction_id` and root `everflow_transaction_id` | +| `funnel` | `attribution.funnel` | `funnel` | + +Not supported on SDK 0.4.x: automatic attribution capture of `ttclid`, `msclkid`, `gbraid`, `wbraid` and `sg_evclid`. Keeping these values in the query string does not put them in order attribution. The live test confirmed that `ttclid` was absent from the SDK attribution. + +Unconfirmed live: SDK 0.5.0 captures `ttclid`, `msclkid`, `gbraid` and `wbraid` in order `attribution.metadata`. Source confirms these additions; the live test used 0.4.43. + +The cookies `_fbp` and `_fbc` map to `metadata.fb_fbp` and `metadata.fb_fbc`. On 0.4.43 the SDK reads them once per attribution collection, at SDK boot and again when the checkout form initializes. There is no delayed retry if the pixel sets them later. Missing cookies produce empty strings, which can overwrite earlier values. The SDK does not synthesize `_fbc` from `fbclid`. + +Automatic metadata includes `landing_page`, `referrer`, `device`, `device_type`, `domain`, `timestamp`, `conversion_timestamp`, `sdk_version` and `user_ip`. The SDK also collects `fb_fbp`, `fb_fbc` and `fb_pixel_id`. In the live test, the order's `metadata.landing_page` was the checkout URL, not the first presell URL. + +## How attribution persists + +The last value per parameter wins. A tagged URL replaces the stored value for each parameter it contains; absent parameters keep their earlier values. Alias precedence still applies: a stored `affid` takes precedence over a later `aff`, and stored `subaffiliate1` to `subaffiliate5` take precedence over the corresponding short names. + +SDK 0.4.43 keeps attribution in `sessionStorage` for the browser tab. It also stores `evclid` and the funnel name in `localStorage`. The live test observed the query string carried through checkout, upsell and receipt URLs. + +For links to other domains, configure `window.nextConfig.utmTransfer`: + +| Key | Behavior on SDK 0.4.43 | +| --- | --- | +| `enabled` | Must be `true` to run link parameter transfer | +| `applyToExternalLinks` | Set to `true` to include external links; defaults to `false` | +| `excludedDomains` | String array matched as substrings of external link URLs | +| `paramsToCopy` | String array of URL parameter names. Empty or absent copies all current URL parameters | +| `debug` | Enables extra logging | + +The transfer snapshots the current URL parameters at boot and appends missing parameters when you click a link. It keeps values already present in the destination link. + +Attribution is sent on prospect cart creation and order creation, including express payment orders. A failed prospect cart creation retry omits attribution. Upsell requests do not send it. + +See [checkout-link parameters](/docs/storefront/checkout-links) for checkout links, and [marketing attribution](/docs/apps/guides/marketing-attribution) for reading attribution from the `order.created` webhook. + +## Adding your own attribution values + +Use these SDK 0.4.43 methods to inspect or add attribution before your order is created: + +| Method | Behavior | +| --- | --- | +| `next.addMetadata(key, value)` | Merges one key into `attribution.metadata`; returns void | +| `next.setMetadata(metadata)` | Merges an object into existing metadata, without replacing it; returns void | +| `next.setAttribution(attribution: Record)` | Shallow-merges top-level attribution fields and merges any supplied `metadata`; returns void | +| `next.getAttribution()` | Returns the order-API attribution shape | +| `next.debugAttribution()` | Prints attribution in a console group; returns void | + +`setAttribution` does not update the separate stored URL-parameter copies. Collection on the next page can overwrite values you set with it. + +For example, capture `ttclid` as custom metadata on SDK 0.4.x: + +```javascript +window.nextReady = window.nextReady || []; +window.nextReady.push(function (next) { + const ttclid = new URLSearchParams(window.location.search).get('ttclid'); + if (ttclid) { + next.addMetadata('ttclid', ttclid); + } +}); +``` + +On Shop Sync stores, metadata keys reach Shopify only if you map them. See [tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). Unconfirmed live: Shop Sync metadata delivery was source-checked but was not part of the live test. + +## Where to read attribution + +Read your order's `attribution` object in the Admin API or the [Campaigns API](/docs/campaigns/api). The live test checked the Admin API order and confirmed the UTM fields, `gclid`, `affiliate`, `subaffiliate1`, `funnel` and `metadata.fbclid`. + +| Field in `attribution` | Contents | +| --- | --- | +| `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` | Captured campaign parameters | +| `affiliate` | Affiliate value | +| `subaffiliate1` to `subaffiliate5` | Subaffiliate values | +| `gclid` | Google click ID | +| `funnel` | Funnel name | +| `everflow_transaction_id` | Captured `evclid` | +| `metadata` | Captured metadata and values you added | + +The SDK sends non-empty top-level attribution fields and the metadata object. It does not send `first_visit_timestamp` or `current_visit_timestamp` to the API. + +For order notifications, read attribution from the `order.created` [webhook](/docs/webhooks). diff --git a/content/docs/campaigns/tracking/getting-started.mdx b/content/docs/campaigns/tracking/getting-started.mdx new file mode 100644 index 0000000..ee7b5f4 --- /dev/null +++ b/content/docs/campaigns/tracking/getting-started.mdx @@ -0,0 +1,148 @@ +--- +title: Set up tracking +description: The first steps for tracking a NEXT Campaigns funnel. What NEXT does for you, what you configure, how to turn vendors on in a starter template, and how to run your first test order. +sidebar_label: Getting started +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; + +This page gets a funnel ready to track and walks you through your first test. Do it once per funnel, then open the guide for each platform you use. How the parts fit together is explained in the [Tracking overview](/docs/campaigns/tracking#how-tracking-works). + +## What NEXT handles and what you configure + +| NEXT handles | You configure | +| --- | --- | +| The Campaign Cart SDK captures UTM parameters and click IDs from the landing URL and attaches them to the order | Your vendor IDs, one key per vendor in `_data/campaigns.json` | +| The SDK emits an ecommerce event stream (`dl_*` events in `window.NextDataLayer`) on every funnel page | Turning on the SDK providers for Google Tag Manager, Meta and RudderStack in `assets/config.js` | +| NEXT campaign analytics (session tracking) is on by default through the `nextCampaign` provider | Your funnel domain, added as a **Production** domain in the Campaigns app | +| Once you install the Meta Pixel app, it sends a server-side Purchase for campaign orders | Installing the Meta Pixel app, adding your pixel ID and access token, and setting `storeName` in `assets/config.js` | +| On Shop Sync stores, Shop Sync pushes campaign orders to Shopify | Choosing one purchase sender for each platform | +| | Consent handling. NEXT Campaigns has no built-in consent banner; see [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent) | +| | Testing with a test order before you launch | + +The Meta Pixel app's server Purchase and the Shop Sync order push were not part of NEXT's test order on 2026-11-16. Treat them as unconfirmed until you check them on your own store. + +## Before you start + +- A NEXT store with a campaign in the Campaigns app. See [NEXT Campaigns](/docs/campaigns). +- A funnel built from a [starter template](/docs/campaigns/templates) with the [Page Kit](/docs/campaigns/page-kit), or a funnel you built by hand with the Campaign Cart SDK. The `landing` template family loads no SDK and no analytics, so it cannot be tracked as shipped. +- Your funnel domain added in the Campaigns app. Open **Settings**, then **Allowed Domains**, click **Add Domain**, enter the **Domain** and set **Environment** to **Production** or **Development**. Requests from a domain that is not listed are rejected. +- An account with each ad or analytics platform you plan to use, and the ID each guide asks for. + + +The Campaigns app says "Analytics and event tracking are ignored for development domains." That applies to NEXT's own campaign analytics: it ignores events from a development domain. The SDK has no domain check, so on a development domain the `dl_*` events still fire and vendor pixels still send to your ad accounts. The starter templates leave out their tracking markup only when you build with `npm run dev`, whatever the domain. If test traffic must stay out of a vendor's data, leave that vendor's key empty in builds you deploy to a development domain. + + +## Choose your path + +- Starter template funnel: add one key per vendor to the campaign's entry in `_data/campaigns.json`. For Google Tag Manager and Meta, also turn on the matching provider flag in `assets/config.js`. Follow [Configure a starter template funnel](#configure-a-starter-template-funnel). +- Hand-built funnel: you can use the SDK providers for Google Tag Manager, Meta and RudderStack, set in `window.nextConfig.analytics`, and send everything else from your own GTM container. The SDK does not load the GTM container, the Meta pixel or the RudderStack SDK, so your pages must include them. The template analytics adapters for GA4, Triple Whale, TikTok and the others are not packaged for hand-built funnels, and no hand-built page was tested. See [Known gaps](/docs/campaigns/tracking#known-gaps) and the [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) guide. +- Shop Sync store: read [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) first. Some Shopify-side tools already see the synced orders, which changes where each purchase should come from. + +## Configure a starter template funnel + +1. Open `_data/campaigns.json` and find the entry for your campaign. +2. Add the key for each vendor you use. A missing or empty key leaves that vendor off. Any other value, including a placeholder, turns it on. + +| Vendor | Key in `_data/campaigns.json` | Guide | +| --- | --- | --- | +| Google Tag Manager | `gtm_id` | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | +| Meta pixel | `fb_pixel_id` | [Meta](/docs/campaigns/tracking/meta) | +| Google Analytics 4 | `ga4_id` | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | +| Triple Whale | `triplewhale_name` | [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| TikTok | `tiktok_pixel_id` | [TikTok](/docs/campaigns/tracking/tiktok) | +| Google Ads and YouTube | No key of its own | [Google Ads and YouTube](/docs/campaigns/tracking/google-ads) | +| Northbeam | `northbeam_client_id` | [Northbeam](/docs/campaigns/tracking/more-integrations#northbeam) | +| Snapchat | `snap_pixel_id` | [Snapchat](/docs/campaigns/tracking/more-integrations#snapchat) | +| Pinterest | `pinterest_tag_id` | [Pinterest](/docs/campaigns/tracking/more-integrations#pinterest) | +| Taboola | `taboola_account_id` (numbers only) | [Taboola](/docs/campaigns/tracking/more-integrations#taboola) | +| AppLovin Axon | `axon_event_key` | [AppLovin Axon](/docs/campaigns/tracking/more-integrations#applovin-axon) | +| RudderStack | `rudderstack_write_key` and `rudderstack_dataplane_url` (both required) | [RudderStack](/docs/campaigns/tracking/more-integrations#rudderstack) | + +Each guide lists the optional keys for its vendor, such as event filters and identity settings. + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "sdk_version": "0.4.43", + "gtm_id": "GTM-XXXXXXX", + "fb_pixel_id": "123456789012345", + "ga4_id": "G-XXXXXXXXXX", + "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX", + "triplewhale_name": "your-store.myshopify.com" + } +} +``` + +If you set both `gtm_id` and `ga4_id`, do not also add a GA4 tag for the same property inside your GTM container. Two paths send every GA4 event twice. + +3. For Google Tag Manager, Meta and RudderStack, also turn on the provider in `assets/config.js`. The key in `_data/campaigns.json` loads the vendor's script; the provider flag makes the SDK send its events to it. With only the key set, the GTM container loads but receives no `dl_*` events from the SDK, and the Meta pixel loads but sends no events. + - Google Tag Manager: set `analytics.providers.gtm.enabled` to `true`. + - Meta: set `analytics.providers.facebook.enabled` to `true`, and set `settings.pixelId` to the same ID as `fb_pixel_id`. + - RudderStack: set `analytics.providers.rudderstack.enabled` to `true`. +4. Set `storeName` to your store subdomain, for example `your-store`. The templates ship with `'store-name'`. The SDK's Meta provider uses it to give the browser Purchase the event ID `your-store-`, the same format the Meta Pixel app uses for its server Purchase. Without it, the browser Purchase has no event ID. +5. Keep `analytics.enabled: true` and `mode: 'auto'`. Only `'auto'` starts the SDK's automatic tracking. Any other value, including `'manual'`, `'disabled'` or no `mode` at all, sends no `dl_user_data` and no `dl_purchase`. To turn analytics off, set `enabled: false`; `mode: 'disabled'` does not do it. +6. Build for production with `npm run build`. The tracking markup is left out of `npm run dev` builds. +7. Deploy to the domain you added as **Production**. + +The `analytics` block with Google Tag Manager and Meta turned on looks like this. Leave the other entries as they ship. + +```js title="assets/config.js (excerpt)" + storeName: 'your-store', + analytics: { + enabled: true, + mode: 'auto', + providers: { + nextCampaign: { + enabled: true + }, + gtm: { + enabled: true + }, + facebook: { + enabled: true, + settings: { + pixelId: "123456789012345" + } + }, + rudderstack: { + enabled: false, + settings: {} + } + } + }, +``` + + +The starter templates pin SDK 0.4.43 through `sdk_version`, and this page describes that version. SDK 0.5.0 reads these settings from `analytics.destinations` and still maps the 0.4.x `providers` keys and `storeName`. That mapping was not tested. + + +## Pick one purchase sender + +A campaign order can reach the same platform from the funnel's browser pixel, from a NEXT store app on the server, and on Shop Sync stores from a Shopify-side app that reads the synced order. Decide which one sends the purchase for each platform before you launch. For Meta, the browser Purchase and the Meta Pixel app's server Purchase are built to share the event ID `your-store-` when `storeName` is set, so Meta can deduplicate them. For any other platform, send the purchase from one place only. The rules are in [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +## Run your first test + +1. Open a fresh browser profile, then open your first funnel page on the production domain with UTM parameters and `nfdebug=true` on the URL: + +```text +https://funnel.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch-test&nfdebug=true +``` + +2. In the browser console, run `next.getAttribution()`. You should see your `utm_*` values, and any click ID you added, such as `gclid` or `metadata.fbclid`. SDK 0.4.43 does not store `ttclid`. +3. Move through checkout and place a test order with a [test card](/docs/testing). +4. On the first page after payment (the upsell page, or the receipt if there is no upsell), check `window.NextDataLayer`. It should contain one `dl_purchase` with your order number as `transaction_id`. If you accept an upsell, the next page should show `dl_upsell_purchase` with a `transaction_id` ending in `-US1`. +5. Run `NextForwarder.getStatus()`. Each template adapter you turned on should show `active: true`, and its `sent` count should rise as you move through the funnel. `NextForwarder` exists only on starter templates with at least one adapter vendor set. Google Tag Manager and RudderStack never appear in it, and Meta appears only when `meta_advanced_matching_enabled` is on. +6. Open the **Verify it works** section of each platform guide, for example [Meta](/docs/campaigns/tracking/meta#verify-it-works), and check the vendor's own tools. + + +`?ignore=true` turns off every analytics event for the browser tab, including `dl_purchase`, and the SDK carries it to the next pages. If you used it earlier, open a new tab or run `window.NextAnalyticsClearIgnore()` before you test. + + +Test orders still fire the browser events. The Meta Pixel app skips test orders unless **Enable Sending Test Data** is on in its settings. The SDK sends `dl_purchase` once per order in each browser, so use a fresh browser profile for each test order. + +More checks and fixes are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). diff --git a/content/docs/campaigns/tracking/google-ads.mdx b/content/docs/campaigns/tracking/google-ads.mdx new file mode 100644 index 0000000..3eef932 --- /dev/null +++ b/content/docs/campaigns/tracking/google-ads.mdx @@ -0,0 +1,207 @@ +--- +title: Google Ads and YouTube +description: Count NEXT Campaigns funnel purchases as Google Ads conversions, including for YouTube ads, by importing GA4 key events or by adding Google Ads tags to your own GTM container. Support is partial; this guide lists what exists and what does not. +sidebar_label: Google Ads and YouTube +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| The SDK captures `gclid` from the landing URL and stores it on the order as `attribution.gclid` | Verified | SDK source, and a test order: `gclid` seen in `next.getAttribution()` on the first page and on the order's attribution through the Admin API | 2026-11-16 | 0.4.43 | +| The GA4 adapter sends `purchase` and `upsell_purchase` from the funnel | Verified | Test order, `gtag` calls and GA4 requests observed in the browser (see [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#verification-status)) | 2026-11-16 | 0.4.43 | +| The SDK pushes `dl_purchase` and `dl_upsell_purchase` to `window.dataLayer` with `transaction_id`, `value` and `currency` | Verified | SDK source, and the same test order with the SDK's GTM provider on and no container loaded | 2026-11-16 | 0.4.43 | +| `gbraid` and `wbraid` are not stored on the order on SDK 0.4.x, and are stored in attribution metadata on SDK 0.5.0 | Unconfirmed | SDK source for both versions; not walked | 2026-11-16 | 0.4.43, 0.5.0 | +| GA4 key events imported into Google Ads count as Google Ads conversions | Unconfirmed | Google's help documentation only | 2026-11-16 | | +| Google Ads conversion tags in your GTM container fire on `dl_purchase` and `dl_upsell_purchase` | Unconfirmed | SDK source only; no GTM container or Google Ads tag was loaded in the test | 2026-11-16 | 0.4.43 | +| `gclid` reaches the Shopify order on Shop Sync stores through a metadata mapping | Unconfirmed | Shop Sync metadata guide only; not walked | 2026-11-16 | | +| A Google Ads key or adapter in the starter templates, a NEXT server-side Google Ads sender, enhanced conversions | Not supported | Starter template and store app source | 2026-11-16 | | + +NEXT did not use a Google Ads account for this test, so whether conversions arrive and report in Google Ads, by either path, was not checked. + +## What it does + +YouTube ads are bought and measured through Google Ads, so this one guide covers both. Nothing on this page is specific to YouTube. + +NEXT has no dedicated Google Ads integration for campaign funnels. The starter templates have no Google Ads key or adapter, and no NEXT store app sends Google Ads conversions from the server for campaign orders. What NEXT does provide: + +- The SDK captures the Google click ID (`gclid`) from the ad's landing URL and stores it on the order. +- The GA4 adapter and the SDK's GTM provider send each purchase and accepted upsell from the funnel with the order number, value and currency. + +You get those purchases into Google Ads in one of two ways: + +| Path | How it works | Guide you set up first | +| --- | --- | --- | +| Import GA4 key events | The GA4 adapter sends `purchase` and `upsell_purchase` to your GA4 property. You mark them as key events and import them into Google Ads as conversions | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | +| Google Ads tags in your GTM container | Your own GTM container listens for the SDK's `dl_purchase` and `dl_upsell_purchase` events and fires your Google Ads conversion tags | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | + +Use one path for each conversion, not both. Running both counts every purchase twice. + +These are not available: + +- A dedicated Google Ads key in `_data/campaigns.json` or a Google Ads adapter. +- Enhanced conversions. Nothing in the templates or the SDK sends hashed customer data to Google Ads. +- Server-side conversion upload. Storing `gclid` on the order does not send anything to Google Ads, and NEXT has no feature that uploads orders or click IDs to Google Ads. + + +The [Google Analytics 4 store app](https://docs.nextcommerce.com/docs/apps/google-analytics-4) has its own Google Ads conversion settings. That app runs on your NEXT storefront only and does not load on a campaign funnel, so those settings do nothing for campaign orders. + + +## Before you start + +- A Google Ads account with auto-tagging turned on. Without auto-tagging, ad clicks carry no `gclid`. +- A funnel built from a starter template, with your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. Analytics and event tracking are ignored on development domains. +- For the GA4 import path: + - GA4 set up on the funnel and working. Follow [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) first. + - Your Google Analytics and Google Ads accounts linked. + - Administrator or editor access to the GA4 property. Google's help says you need at least Marketer access to import. +- For the GTM path: + - Your own GTM container loading on the funnel with the SDK's GTM provider on. Follow [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) first. + - A Google Ads conversion action for purchases, and one for upsells if you want to count them separately. + +## Set up + + + + +### Import GA4 key events + +1. Set up the GA4 adapter with your measurement ID (`ga4_id`) as described in [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#set-up), and check that `purchase` arrives. +2. In GA4, mark `purchase` as a key event. Mark `upsell_purchase` too if you want upsell revenue to count in Google Ads. +3. Link your Google Analytics property to your Google Ads account, and turn on auto-tagging in Google Ads. +4. In GA4, open **Advertising**, then **Tools**, then **Conversion management**, and select **New conversion**. Pick your Google Ads account, pick the key events, choose a conversion category and save. Events you pick from the events list in this flow are marked as key events. Google's steps are in [Create Google Ads conversions from GA4 key events](https://support.google.com/google-ads/answer/10632359?hl=en). +5. In Google Ads, check how the new conversion actions are set to count. Google's help explains why a conversion created this way can be marked as a secondary conversion action. Secondary actions are not used for bidding until you change them. + +Google notes that this feature may not be available to every Google Analytics property. + +### Google Ads tags in your GTM container + +1. Load your GTM container on the funnel and turn on the SDK's GTM provider, as described in [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager#set-up). The SDK does not load GTM itself. +2. In GTM, add data layer variables for `ecommerce.transaction_id`, `ecommerce.value` and `ecommerce.currency`. +3. Add a trigger that fires on the `dl_purchase` event. +4. Add a Google Ads conversion tag for your purchase conversion action. Set its transaction ID, value and currency from the variables in step 2, and attach the `dl_purchase` trigger. +5. To count upsells, add a second trigger on `dl_upsell_purchase` and a second Google Ads conversion tag that uses it. +6. Publish the container, build the funnel with `npm run build`, and deploy. The analytics markup is left out of `npm run dev` builds. + +If you use this path, do not also import the GA4 `purchase` key event for the same conversion. + + + + +This guide is documented for starter templates only for now. It was written against the starter template set-up, and no hand-built page was tested. On a hand-built funnel, the closest supported path is your own GTM container reading the SDK's `dl_*` events. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). + + + + +## Events sent + +Google Ads receives nothing from NEXT directly. It receives what your GA4 property or your GTM tags pass on. + +| Funnel event | GA4 import path | GTM path | When it fires | +| --- | --- | --- | --- | +| `dl_purchase` | GA4 `purchase`, imported as a conversion | Trigger for your purchase conversion tag | The first page after payment (upsell or receipt), once per order | +| `dl_upsell_purchase` | GA4 `upsell_purchase`, imported as a conversion if you choose | Trigger for your upsell conversion tag, if you add one | The page after an upsell is accepted | + +The other funnel events (page views and checkout steps) also reach GA4 and your GTM container. See their guides for the full lists. This guide covers purchase conversions only. + +## Attribution requirements + +- Auto-tagging must be on in Google Ads so the landing URL carries `gclid`. +- The SDK reads `gclid` from the landing URL, keeps it for the browser tab session, and sends it on the order as `attribution.gclid`. A new `gclid` on a later page replaces the old one. +- The SDK carries the query string through the checkout, upsell and receipt pages, so Google's tags on those pages see the same URL parameters as the landing page. +- Keep every funnel page on one domain, or on subdomains of one domain, so the GA4 cookie is shared across the funnel. See [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#attribution-requirements). +- SDK 0.4.x does not store `gbraid` or `wbraid` on the order. It keeps them in the funnel's page links, but they are not in the order's attribution. SDK 0.5.0 stores both in the order's attribution metadata. + +### Shop Sync stores + +On a store that uses Shop Sync, campaign orders are copied into Shopify. A Google Ads conversion tracked on the Shopify side, for example by a Shopify Google app, does not see the funnel visit, because the shopper never loaded a Shopify page. + +Shop Sync does not copy `gclid` to the Shopify order on its own. According to the [Shop Sync metadata guide](https://guides.nextcommerce.com/guides/shop-sync-metadata), it reaches the Shopify order only when: + +1. A metadata field for it exists in NEXT, under **Settings**, then **Metadata Fields**, on the attribution object. See [Metadata fields and tags](https://docs.nextcommerce.com/docs/build-a-store/technical-settings/metadata-fields-and-tags). +2. The value is in the order's attribution metadata. The guide notes that `gclid` is a standard attribution field rather than metadata, so it has to be copied into metadata first, with the SDK's `next.addMetadata('gclid', ...)`. +3. The field is mapped to a Shopify order metafield in Shop Sync with **Add Metadata Sync**. The types must match, for example a NEXT text field to a Shopify single line text field. + +Metafields are written once, when the Shopify order is created. This mapping is Unconfirmed: NEXT has not walked it. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) for which Shopify-side tools see synced orders. + +## Purchases, revenue and upsells + +| Field | Order purchase | Upsell | +| --- | --- | --- | +| Event | `dl_purchase`, sent to GA4 as `purchase` | `dl_upsell_purchase`, sent to GA4 as `upsell_purchase` | +| `transaction_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | +| `value` | Item revenue, excluding tax and shipping | The upsell line only | +| `currency` | The order currency | The order currency | + +Upsells are sent as separate events. If you import only `purchase`, or add only a `dl_purchase` tag, Google Ads counts the first sale and not the upsell revenue. Because `value` excludes tax and shipping, Google Ads conversion value will be lower than the order total. + +`dl_purchase` is sent once per order in a browser. A reload or revisit of the page does not send it again. + +## Browser and server events + +Google Ads gets campaign conversions from the browser only, through GA4 or your GTM tags. NEXT sends no Google Ads events from the server, so there is no server event to deduplicate against. + +Send each purchase from one place: either the GA4 import or a GTM conversion tag, and not a Shopify-side Google app on top. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +## Worked example + +A Google Ads click to a funnel that uses the GA4 import path. The campaign entry sets only GA4: + +```json title="_data/campaigns.json" +{ + "summer-offer": { + "name": "Summer Offer", + "sdk_version": "0.4.43", + "ga4_id": "G-XXXXXXXXXX" + } +} +``` + +With auto-tagging on, a shopper lands on `https://offers.example.com/presell/?utm_source=google&utm_medium=cpc&utm_campaign=summer-offer&gclid=EXAMPLE_GCLID`, buys the $12 main offer and accepts a $3 upsell. + +| Where | What you see | +| --- | --- | +| The NEXT order | `attribution.gclid` is `EXAMPLE_GCLID`, with `utm_source`, `utm_medium` and `utm_campaign` alongside it | +| GA4, upsell page | `purchase` with `transaction_id` `100041` and `value` 12 | +| GA4, receipt page | `upsell_purchase` with `transaction_id` set to the order reference plus `-US1` and `value` 3 | +| Google Ads | One conversion for `purchase`, plus one for `upsell_purchase` if you imported it (Unconfirmed) | + +## Verify it works + +1. Open a funnel page on your production domain with a test click ID on the URL, for example `?gclid=EXAMPLE_GCLID&nfdebug=true`. Do not add `?ignore=true`, which turns all tracking off for the browser tab. +2. In the browser console, run `next.getAttribution()`. It should show your `gclid`. +3. Place a test order with a [test card](/docs/testing) and accept an upsell. +4. Check the order's attribution, for example through the Admin API. `attribution.gclid` should hold your test value. +5. For the GA4 path, confirm `purchase` and `upsell_purchase` as described in [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#verify-it-works). +6. For the GTM path, use Google Tag Assistant to confirm your conversion tags fire on `dl_purchase` and `dl_upsell_purchase` with the order number, value and currency. + + +The SDK does not check whether an order is a test order. A test order sends `purchase` to your GA4 property and fires your GTM tags like a real one, so it can be counted in Google Ads through either path. + + +More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Troubleshooting and limits + +| Symptom | Likely cause | Fix | +| --- | --- | --- | +| No `gclid` on the order | Auto-tagging is off, or the ad's URL drops the query string before the funnel loads | Turn on auto-tagging; check the landing URL in the browser carries `gclid` | +| Every conversion counted twice | Both paths run for the same conversion, or a Shopify-side Google app also counts the synced order | Keep one sender per conversion | +| Upsell revenue missing in Google Ads | `upsell_purchase` was not imported, or there is no `dl_upsell_purchase` tag | Import the key event or add the tag | +| Conversion value lower than the order total | `value` excludes tax and shipping by design | Compare against item revenue in NEXT | +| Imported conversion not used for bidding | It was created as a secondary conversion action | Change it in Google Ads | +| Cannot create a conversion from GA4 | Missing access, unlinked accounts, or the feature is not available to the property | Check the prerequisites in [Google's help](https://support.google.com/google-ads/answer/10632359?hl=en) | +| Google Ads settings in the Google Analytics 4 store app have no effect | That app runs on the storefront only | Use one of the two paths on this page | + +- There is no Google Ads key or adapter in the starter templates. +- There are no enhanced conversions and no server-side conversion upload from NEXT. +- NEXT has not verified that imported conversions or GTM conversion tags report correctly in Google Ads. +- SDK 0.4.x does not store `gbraid` or `wbraid` on the order. +- An upsell accepted as a bundle sends one `dl_upsell_purchase` per item in the bundle, each valued at the whole bundle total (from SDK source, not walked). A conversion tag or imported key event counts each of them. +- Google Ads receives no conversion for subscription renewals or other orders created without a funnel visit. diff --git a/content/docs/campaigns/tracking/google-analytics-4.mdx b/content/docs/campaigns/tracking/google-analytics-4.mdx new file mode 100644 index 0000000..fb35f11 --- /dev/null +++ b/content/docs/campaigns/tracking/google-analytics-4.mdx @@ -0,0 +1,140 @@ +--- +title: Google Analytics 4 +description: Send NEXT Campaigns funnel page views, checkout steps, purchases and upsells to a GA4 property with the starter template GA4 adapter, and check the events arrive. +sidebar_label: Google Analytics 4 +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| Setting `ga4_id` loads `gtag.js` and the GA4 adapter on every funnel page | Verified | Starter template source, and a production build of the Olympus template | 2026-11-16 | 0.4.43 | +| Funnel events reach `gtag` with the names below | Verified | Test order, `gtag` calls and `/g/collect` requests observed in the browser | 2026-11-16 | 0.4.43 | +| Accepted upsells arrive as a separate `upsell_purchase` event | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | +| Events appear in GA4 reports and DebugView | Unconfirmed | Not checked: the test used a placeholder measurement ID | | | + +The browser side was checked with a placeholder measurement ID, so what GA4 does with the events after it receives them was not checked. + +## What it does + +The GA4 adapter loads Google's `gtag.js` with your measurement ID on every funnel page and sends the SDK's funnel events to GA4 as GA4 ecommerce events. It covers presell, landing, checkout, upsell and receipt pages. It runs in the browser only. NEXT does not send GA4 events from the server, and the Google Analytics 4 store app does not load on campaign funnels. + +## Before you start + +- A GA4 property and a web data stream. Copy its measurement ID (it starts with `G-`). +- A funnel built from a starter template. The adapter ships with every template family except `landing`. +- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. +- Match the property's currency and time zone to your NEXT store so reports line up. + +## Set up + + + + +1. Open `_data/campaigns.json` and find the entry for your campaign. +2. Add your measurement ID: + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "ga4_id": "G-XXXXXXXXXX" + } +} +``` + +3. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds, so tracking does not load in the development server. +4. Deploy, then follow [Verify it works](#verify-it-works). + +Do not also add a GA4 tag in Google Tag Manager or in the page for the same property. Two paths send every event twice. + + + + +The GA4 adapter is documented for starter templates only. It was not tested on a hand-built page, and it is not published as a standalone package. On a hand-built funnel, send the SDK's `dl_*` events to GA4 from your own Google Tag Manager container instead. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). + + + + +## Events sent + +By default the adapter forwards eight SDK events. The table shows what each becomes in GA4. + +| SDK event | GA4 event | When it fires | +| --- | --- | --- | +| `dl_user_data` | `page_view` | Every page load | +| `dl_view_item` | `view_item` | A page shows a package | +| `dl_add_to_cart` | `add_to_cart` | An item is added to the cart | +| `dl_begin_checkout` | `begin_checkout` | The checkout form loads | +| `dl_add_shipping_info` | `add_shipping_info` | A valid shipping address is entered | +| `dl_add_payment_info` | `add_payment_info` | Payment details are complete | +| `dl_purchase` | `purchase` | The first page after payment | +| `dl_upsell_purchase` | `upsell_purchase` | The page after an upsell is accepted | + +`gtag` is configured with `send_page_view: false`, so the adapter's `page_view` is the only one. + +To send fewer events, add `ga4_blocked_events` with a comma-separated list, for example `"ga4_blocked_events": "dl_add_shipping_info, dl_add_payment_info"`. To send more, list them in `ga4_allowed_events`, or use `"all"` to send every event the adapter can map, including `view_item_list`, `select_item`, `remove_from_cart`, `view_cart`, `sign_up` and `login`. + +## Attribution requirements + +GA4 reads campaign source from the page URL, so keep your UTM parameters on the ad's landing URL. The SDK carries the query string through to the checkout, upsell and receipt pages. Every page should be on the same domain, or on subdomains of one domain, so the GA4 cookie is shared across the funnel. If your funnel spans two different domains, set up GA4 cross-domain measurement in your Google tag settings. + +## Purchases, revenue and upsells + +| Field | Order purchase | Upsell | +| --- | --- | --- | +| Event | `purchase` | `upsell_purchase` (custom event) | +| `transaction_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | +| `value` | Item revenue without shipping. Tax is excluded on stores that show prices without tax and included on stores that show tax-inclusive prices | The upsell line only | +| Other fields | `currency`, `tax`, `shipping`, `coupon`, `affiliation`, `items` | `currency`, `affiliation`, `coupon`, `upsell_number`, `package_id`, `package_name`, `original_order_id` | + +Upsells are kept out of the `purchase` event so purchase counts and average order value describe the first sale. To report upsell revenue in GA4, mark `upsell_purchase` as a key event and include it in your revenue explorations. If you import GA4 key events into Google Ads, import `upsell_purchase` too when you want upsell revenue to count there. See [Google Ads and YouTube](/docs/campaigns/tracking/google-ads). + +`items[].item_id` is the product SKU. + +## Browser and server events + +GA4 receives browser events only. There is no NEXT server event to deduplicate against, so the only duplicate risk is a second GA4 tag on the same pages. Send each GA4 event from one place: this adapter, or your own GTM container, not both. + +## Worked example + +A campaign that sends GA4 and keeps upsells out of the default set, for a property that only wants checkout and purchase data: + +```json title="_data/campaigns.json" +{ + "summer-offer": { + "name": "Summer Offer", + "sdk_version": "0.4.43", + "ga4_id": "G-XXXXXXXXXX", + "ga4_blocked_events": "dl_upsell_purchase" + } +} +``` + +## Verify it works + +1. Open a funnel page on your production domain with `?nfdebug=true` added to the URL. Do not add `?ignore=true`, which turns all tracking off for the browser tab. +2. In the browser console, run `NextForwarder.getStatus()`. The `ga4` entry should show `active: true`, and `sent` should increase as you move through the funnel. +3. In GA4, open **Admin**, then **DebugView**, or use Google Tag Assistant, and walk through checkout. You should see `page_view`, `begin_checkout`, `add_shipping_info` and `add_payment_info`. +4. Place a test order with a [test card](/docs/testing). On the upsell or receipt page you should see `purchase` with your order number as the transaction ID. Accept an upsell and you should see `upsell_purchase` on the next page. + +More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Troubleshooting and limits + +| Symptom | Likely cause | Fix | +| --- | --- | --- | +| No GA4 requests at all | Built with `npm run dev`, `ga4_id` empty, or `?ignore=true` set earlier in the tab | Build with `npm run build`; check the key; open a new tab without `?ignore=true` | +| Every event counted twice | GA4 also loaded by GTM or a page script | Remove the other GA4 tag | +| Purchase revenue lower than the order total | `value` is item revenue and leaves out shipping (and tax, on stores that show prices without tax) | Use `tax` and `shipping` from the event, or report on item revenue | +| Upsell revenue missing | `upsell_purchase` is a separate event | Mark it as a key event and include it in reports | +| No `purchase` after a test order | The shopper never reached a page after payment, or the order was already reported in that browser | Load the upsell or receipt page; use a fresh browser profile for each test | + +- GA4 receives no event for subscription renewals or other orders created without a funnel visit. +- The adapter needs SDK 0.4.28 or later. diff --git a/content/docs/campaigns/tracking/google-tag-manager.mdx b/content/docs/campaigns/tracking/google-tag-manager.mdx new file mode 100644 index 0000000..c1507c4 --- /dev/null +++ b/content/docs/campaigns/tracking/google-tag-manager.mdx @@ -0,0 +1,241 @@ +--- +title: Google Tag Manager +description: Send the SDK's dl_* funnel events to your own Google Tag Manager container from starter template funnels, and check that each vendor tag receives every purchase once. +sidebar_label: Google Tag Manager +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| The SDK pushes each `dl_*` event to `window.dataLayer` | Verified | Test order on a production build, with `window.dataLayer` read in the browser on checkout, upsell and receipt pages | 2026-11-16 | 0.4.43 | +| `dl_purchase` fires once per order, on the first page after payment, and not again when the page is revisited | Verified | Test order, then a revisit of the upsell page | 2026-11-16 | 0.4.43 | +| `dl_upsell_purchase` fires on the page after the upsell, with a `transaction_id` of the order reference plus `-US1` | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | +| Each `dl_*` push is preceded by `{ecommerce: null}` | Unconfirmed | Source read only; not checked in the browser | 2026-11-16 | 0.4.43 | +| The container loads when `gtm_id` and the provider flag are both set | Unconfirmed | Starter template source read; the test order had no container | 2026-11-16 | 0.4.43 | +| `npm run dev` builds leave out the analytics markup | Unconfirmed | Template source and repo docs; not walked | 2026-11-16 | 0.4.43 | +| Attribution sits under `attribution`, with no root-level copy on `dl_*` events | Unconfirmed | Source read only | 2026-11-16 | 0.4.43 | +| An accepted upsell bundle pushes one `dl_upsell_purchase` per bundle item, each valued at the bundle total | Unconfirmed | Source read only | 2026-11-16 | 0.4.43 | +| `blockedEvents` on the `gtm` provider keeps a `dl_*` event out of `window.dataLayer` | Unconfirmed | Source read only | 2026-11-16 | 0.4.43 | +| Tags in your container fire and deliver data to a vendor | Unconfirmed | Not walked: no container in the test | 2026-11-16 | 0.4.43 | +| On 0.5.0, `window.ElevarDataLayer` is not written and `dl_*` `user_properties` carry only `visitor_type` | Unconfirmed | SDK 0.5.0 source and docs read; not walked | 2026-11-16 | 0.5.0 | +| A Meta Purchase from the Meta Pixel app uses the same event ID as the browser Purchase | Unconfirmed | Not walked: the Meta Pixel app was not installed on the test store | 2026-11-16 | n/a | + +The test order had no GTM container, so tag firing in GTM, Tag Assistant results and what a vendor received through GTM were not checked. + +## What it does + +The Google Tag Manager provider in the SDK pushes every `dl_*` funnel event to `window.dataLayer` and to `window.ElevarDataLayer`. Each push is preceded by `{ecommerce: null}`. The SDK never loads GTM itself. On a starter template funnel, the template loads your container when you set `gtm_id`, and your GTM tags decide what reaches each platform. + +The provider runs in the browser only. It covers every funnel page of the starter template families except `landing`, which loads no SDK. + +## Before you start + +- A Google Tag Manager web container. Copy its ID, which has the form `GTM-XXXXXXX`. +- A funnel built from a starter template. +- Your funnel domain added under **Allowed Domains** in the Campaigns app, under **Settings**, as a **Production** domain. Analytics and event tracking are ignored for development domains. +- The NEXT Google Tag Manager app covers the storefront only. It does not run on campaign funnels, so the setup below is still needed. See the [app documentation](https://docs.nextcommerce.com/docs/apps/google-tag-manager). + +## Set up + + + + +Setup has two parts, and both are required. + +1. Open `_data/campaigns.json` and find the entry for your campaign. +2. Add your container ID: + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "gtm_id": "GTM-XXXXXXX" + } +} +``` + +3. Open `assets/config.js` and turn the GTM provider on. The template ships it set to `false`. Leave `mode: 'auto'` as it is, because the purchase and cart events come from automatic tracking. + +```js title="assets/config.js" +// Inside analytics.providers, change only the gtm entry: +gtm: { + enabled: true +}, +``` + +4. Build with `npm run build`. The analytics markup is left out of `npm run dev` builds, so GTM does not load in the development server. +5. Deploy, then follow [Verify it works](#verify-it-works). + +Each part does something on its own, which is why both are needed: + +| Set | What happens | +| --- | --- | +| Only `gtm_id` | The container loads, but the SDK sends it no `dl_*` events. Inferred from the template's config comment; not walked. | +| Only the provider flag | The SDK pushes `dl_*` events to `window.dataLayer`, and no container loads to read them. Observed in the test order. | + + + + +On a hand-built funnel you add your GTM container to every page yourself, then turn on the SDK's `gtm` provider in `window.nextConfig.analytics` as described in the [Campaign Cart SDK analytics docs](https://cart-sdk.nextcommerce.com/latest/analytics/). The events are the same as on a starter template. NEXT has not tested this on a hand-built page for this guide, so check it with GTM Preview before you rely on it. + + + + +The config key depends on the SDK version your template pins. The version comes from `sdk_version` in `_data/campaigns.json`, and the starter templates pin 0.4.43. + + + + +The flag is `analytics.providers.gtm.enabled`, set as in step 3 above. You can also list `dl_*` names in `blockedEvents`: + +```js title="assets/config.js" +gtm: { + enabled: true, + blockedEvents: ['dl_add_payment_info'] +}, +``` + +`blockedEvents` matches exact, case-sensitive event names. A blocked event does not reach `window.dataLayer` for GTM. It still reaches `window.NextDataLayer` and the other providers. + + + + + +Everything on this tab comes from SDK 0.5.0 source and docs. The test order ran on 0.4.43. + + +- The key is `analytics.destinations.gtm.enabled`. GTM is on by default on 0.5.0. Set it to `false` to stop the `window.dataLayer` writes. A 0.4.x `providers.gtm.enabled: false` also turns it off when the destination key is not set. +- `window.ElevarDataLayer` is not written. +- Every `dl_*` push carries `user_properties` with `visitor_type` only. Customer email and phone are not sent, so a tag that reads them gets nothing. +- `blockedEvents` is not read. + + + + +## Events sent + +The SDK emits these `dl_*` events. Most need `mode: 'auto'`, which the template ships with. + +| Event | When it fires | +| --- | --- | +| `dl_user_data` | Each page load, before the other events on the page. Also on in-funnel navigation, login and logout. | +| `dl_view_item_list` | A page with more than one product | +| `dl_view_item` | A page that shows one product | +| `dl_add_to_cart` | An item is added to the cart, once its price is final | +| `dl_remove_from_cart` | An item is removed from the cart | +| `dl_package_swapped` | A package is swapped | +| `dl_cart_updated` | The cart changes | +| `dl_begin_checkout` | The checkout form loads with items in the cart, once per form | +| `dl_add_shipping_info` | A shipping method is chosen, or a valid address is entered | +| `dl_add_payment_info` | Payment details are complete, an express payment button is pressed, or a redirect payment method is submitted | +| `dl_purchase` | The first SDK page with a `ref_id` after payment | +| `dl_viewed_upsell` | An upsell page is shown | +| `dl_skipped_upsell` | An upsell is skipped | +| `dl_upsell_purchase` | An upsell is accepted. It is pushed on the next SDK page. | +| `dl_scroll_depth` | A scroll threshold set in the page's meta tag is reached | +| `dl_exit_intent_shown`, `dl_exit_intent_accepted`, `dl_exit_intent_dismissed`, `dl_exit_intent_closed`, `dl_exit_intent_action` | Exit-intent pages | +| `dl_sign_up`, `dl_login` | Only when the page calls `next.trackSignUp` or `next.trackLogin` | + +`dl_page_view` is defined in the SDK but never sent at 0.4.43, so a trigger on it never fires. Page loads reach GTM as `dl_user_data`. The same applies to `dl_route_changed`, `dl_view_cart`, `dl_select_item` and `dl_view_search_results`. + +Create one Custom Event trigger for each `dl_*` name you use, with the event name set to that name, for example `dl_purchase`. Each push has the event name in its `event` key, and the `event_id` at the top level. The ecommerce object follows the GA4 shape: `currency`, `transaction_id`, `value`, `tax`, `shipping`, `affiliation` and `items`, with `coupon` or `discount` when they apply. Each item carries `item_id` (the product SKU), `item_name`, `price` and `quantity`. + +The SDK does not copy `utm_*` or `gclid` to the top level of a `dl_*` event. Read them under `attribution`. + +## Attribution requirements + +Every `dl_*` event carries an `attribution` object. The keys that matter for tags: + +| Key | Holds | +| --- | --- | +| `attribution.utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` | UTM parameters from the landing URL | +| `attribution.gclid` | The Google click ID | +| `attribution.affiliate`, `attribution.subaffiliate1` to `subaffiliate5` | Affiliate and sub-affiliate parameters | +| `attribution.funnel` | The funnel name | +| `attribution.metadata.fbclid` | The Meta click ID | +| `attribution.metadata.clickid` | The `clickid` parameter | +| `attribution.metadata.everflow_transaction_id` | The `evclid` parameter | +| `attribution.metadata.fb_fbp`, `fb_fbc`, `fb_pixel_id` | Meta browser cookies and pixel ID | + +NEXT does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`. A vendor pixel on the page can still read its own click ID cookie, as the TikTok pixel did in the test order. + +Each event also carries a `user_properties` object. In 0.4.43 it holds the shopper's email, phone, name and address fields in plain text. Decide which tags may read these fields, and see [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). + +Keep every funnel page on one domain. The SDK keeps attribution in the browser for the current tab and carries query parameters from page to page during SDK navigation, so a page on another domain gets attribution only when the parameters reach it. A new tab starts attribution again, except for the funnel name and `evclid`. + +## Purchases, revenue and upsells + +| Field | `dl_purchase` | `dl_upsell_purchase` | +| --- | --- | --- | +| When it fires | The first SDK page with a `ref_id` after payment | The next SDK page after the upsell is accepted | +| `event_id` and `ecommerce.transaction_id` | The order number, for example `100041` | The order reference plus `-US1`, `-US2`, and so on | +| `ecommerce.value` | Item revenue, excluding tax and shipping | The accepted upsell line, or the bundle total | +| `ecommerce.tax` and `ecommerce.shipping` | Order tax and shipping | `0` and `0` | +| `ecommerce.affiliation` | `Online Store` | `Upsell` | +| Other fields | `currency`, `coupon`, `discount`, `items` | `currency`, `coupon`, `items`, `upsell_metadata` with `original_order_id`, `upsell_number`, `package_id` and `package_name` | +| Repeat pushes | Suppressed per browser by transaction ID, for the last 20 IDs | Not suppressed | + +`dl_purchase` waits for payment. An order that still has a payment step does not fire, and a payment failure landing does not fire. + + +When a bundle of upsell items is accepted, the SDK pushes one `dl_upsell_purchase` per item, and each carries the whole bundle total. Summing those events overstates upsell revenue. + + + +A tag that listens to both `window.dataLayer` and `window.ElevarDataLayer` counts every event twice. Listen to one array. + + +## Browser and server events + +GTM runs in the browser only, and NEXT sends nothing from the server for it. Send each purchase from one place per vendor, so a single purchase is counted once. [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +The Meta Pixel app in the NEXT Dashboard sends a server Purchase for new orders. If your GTM container also sends a Meta Purchase, both need the same event ID, `{store}-{order number}`, so Meta can deduplicate them, as described in [Meta's deduplication guide](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events). `dl_purchase` carries the order number but not your store name, so build the prefix in the tag. Not walked: the Meta Pixel app was not installed on the test store, so the server Purchase and its event ID were not checked. + +## Worked example + +A campaign that pins SDK 0.4.43 and sends purchases to GTM: + +```json title="_data/campaigns.json" +{ + "summer-offer": { + "name": "Summer Offer", + "sdk_version": "0.4.43", + "gtm_id": "GTM-XXXXXXX" + } +} +``` + +The same campaign needs the `gtm` entry set to `enabled: true` in `assets/config.js`, as in Set up. + +In GTM, add a Custom Event trigger that fires only on `dl_purchase`, and attach it to the tag that sends your purchase conversion. That tag reads `ecommerce.transaction_id` for the order number, `ecommerce.value` for item revenue and `ecommerce.currency` for the currency. If the tag is a Meta Purchase, build its event ID as `{store}-{order number}` from `event_id`. + +## Verify it works + +1. Build with `npm run build`, deploy, and open a funnel page on your Production domain. Do not add `?ignore=true`. It turns off every provider in that tab, so GTM receives nothing and a purchase test proves nothing. +2. Open GTM Preview for your container and load the funnel page. You should see `dl_user_data` first, then the events for that page. `window.dataLayer` in the browser console holds the same pushes. +3. Place a test order with a [test card](/docs/testing). In GTM Preview, `dl_purchase` appears on the upsell or receipt page, with `transaction_id` set to the order number. Accept an upsell, and `dl_upsell_purchase` appears on the next page. + +More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Troubleshooting and limits + +| Symptom | Likely cause | Fix | +| --- | --- | --- | +| No `dl_*` events in the container | The GTM flag is `false` (0.4.x), the build was `npm run dev`, or `?ignore=true` is set in the tab | Set the flag, build with `npm run build`, and open a new tab without `?ignore=true` | +| The container loads, but tags do not fire | `gtm_id` is empty, so no container loads, or the trigger name does not match the `dl_*` name | Set both parts of the setup, and check the trigger name against the event in GTM Preview | +| Every event counted twice | A tag listens to both `dataLayer` and `ElevarDataLayer`, or a second path sends the same vendor | Keep one listener and one path per vendor | +| No `dl_purchase` after a test order | The order is unpaid, the shopper never reached a page with a `ref_id` after payment, or that order was already reported in this browser | Load the upsell or receipt page, and use a fresh browser profile for each test | +| `dl_upsell_purchase` appears one page late | The SDK holds it until the next SDK page | Expected. Check the next page. | +| Upsell revenue is higher than expected | Each bundle item pushes an event with the whole bundle total | Handle bundle totals in the tag or the report | +| Purchase value is lower than the order total | `value` excludes tax and shipping | Read `ecommerce.tax` and `ecommerce.shipping` alongside it | +| A `dl_page_view` trigger never fires | The SDK does not send `dl_page_view` at 0.4.43 | Trigger on `dl_user_data` for page loads | + +- The SDK does not skip test orders, so a test purchase reaches GTM and fires `dl_purchase`. Filter test data in GTM if your reports need it clean. +- An order that never loads a funnel page with a `ref_id` after payment produces no `dl_purchase` in the browser. diff --git a/content/docs/campaigns/tracking/index.mdx b/content/docs/campaigns/tracking/index.mdx new file mode 100644 index 0000000..11b474d --- /dev/null +++ b/content/docs/campaigns/tracking/index.mdx @@ -0,0 +1,106 @@ +--- +title: Tracking overview +description: How ad and analytics tracking works on NEXT Campaigns funnels, which integrations are supported and how well each is verified, and which guide to follow for Triple Whale, Meta, TikTok, Google Ads, GA4 and GTM. +sidebar_label: Overview +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; + +A NEXT Campaigns funnel is a set of your own pages (presell, landing, checkout, upsells, receipt) that load the Campaign Cart SDK and talk to the Campaigns API. Because the funnel is not a Shopify or storefront checkout, the tracking apps you may already use elsewhere do not see it automatically. This section explains what tracks a funnel today, how to set each platform up, and how to prove it works. + +Start with [Set up tracking](/docs/campaigns/tracking/getting-started), then open the guide for your platform. + +## How tracking works + +Three parts can send tracking data for a campaign order. Each guide says which part it configures. + +| Part | Where it runs | What it does | Where you configure it | +| --- | --- | --- | --- | +| Campaign Cart SDK | The shopper's browser | Captures UTM parameters and click IDs from the landing URL, emits an ecommerce event stream (`dl_*` events in `window.NextDataLayer`), and forwards it to GTM, the Meta pixel and RudderStack through built-in providers | `assets/config.js` (`window.nextConfig.analytics`) | +| Starter template analytics adapters | The shopper's browser | Load a vendor's pixel on every page and translate the SDK's `dl_*` events into that vendor's events: GA4, Triple Whale, TikTok, Northbeam, Snapchat, Pinterest, Taboola and AppLovin Axon | One key per vendor on the campaign entry in `_data/campaigns.json` | +| Store apps | NEXT's servers | Send order events server to server after the order exists. For campaign orders this covers the Meta Pixel app's Conversions API Purchase, Everflow postbacks and Klaviyo order events | The store dashboard, under **Apps** | + +```mermaid +flowchart LR + A[Ad click with UTMs and click IDs] --> B[Funnel pages: SDK + vendor pixels] + B -->|attribution on cart and order| C[Campaigns API order] + B -->|browser events| V[Ad and analytics platforms] + C --> D[Store apps: Meta Pixel app, Everflow, Klaviyo] + D -->|server events| V + C -->|Shop Sync stores only| S[Shopify order tagged NEXT] + S --> T[Shopify-side tools such as Triple Whale] +``` + + +The TikTok Pixel Events, Google Analytics 4, Google Tag Manager, AppLovin AXON and Taboola apps inject their scripts into your NEXT storefront only. They do not load on a campaign funnel. On a funnel, use the template adapters or the SDK providers instead. The Meta Pixel app is the exception for one event: its server-side Purchase is sent for campaign orders too. + + +## What happens at each step of a funnel + +This is the behaviour of a starter template funnel on SDK 0.4.43 with the vendors turned on. It was checked with a test order on 2026-11-16. + +| Step | What NEXT records | What the browser sends | +| --- | --- | --- | +| Shopper clicks your ad | The SDK stores `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `gclid`, `aff` or `affid`, `sub1` to `sub5` and `fbclid` from the landing URL for the browser tab session | Each vendor's page view | +| Presell and landing pages | Nothing new unless a parameter changes. A new value for a parameter replaces the old one | Page views; product views where a page shows packages | +| Checkout loads | The cart | `dl_begin_checkout` and the vendor's checkout-started event | +| Shopper types email or phone | A prospect cart once name, email and items are present | Triple Whale `Contact` (when turned on), and identity calls for vendors whose identity setting is on | +| Shipping and payment entered | | `dl_add_shipping_info`, `dl_add_payment_info` | +| Payment succeeds | The order, with the stored attribution (see [Events and attribution](/docs/campaigns/tracking/events-and-attribution)) | Nothing on the checkout page itself | +| First page after payment (upsell or receipt) | | `dl_purchase` with the order number as `transaction_id` and the item revenue as `value`. Shipping is never included; tax is excluded on stores that show prices without tax and included on stores that show tax-inclusive prices. Sent once per order; a reload or revisit does not send it again | +| Shopper accepts an upsell | The upsell line is added to the same order | `dl_upsell_purchase` on the next page, with `transaction_id` set to the order reference plus `-US1`, `-US2` and so on, and `value` set to the upsell line only | +| After the order | Store apps run server side: Meta Pixel app Purchase, Everflow postback, Klaviyo events. On Shop Sync stores the order is pushed to Shopify | | + +Upsells reach each platform differently. Some count an accepted upsell as another purchase, some receive it as a separate custom event, and the SDK's Meta provider sends nothing for it. Each platform guide states which. + +## Supported integrations + +Each integration has two ratings. **Setup and events** says whether NEXT has confirmed the funnel sends the right events. **Platform reporting** says whether NEXT has confirmed the events arrive and report correctly inside the vendor's own dashboard. + +- **Verified**: checked against the current source and observed in a test order. +- **Partial**: some of the path is verified and some is not, or it needs a workaround. The guide says which part. +- **Unconfirmed**: documented from source code or vendor documentation only. Treat it as untested. +- **Not supported**: no setup exists today. + +| Integration | Setup and events | Platform reporting | Guide | +| --- | --- | --- | --- | +| Triple Whale | Verified | Unconfirmed; not supported on stores without Shopify | [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| Meta pixel and Conversions API | Verified for browser events; server Purchase Unconfirmed | Unconfirmed | [Meta](/docs/campaigns/tracking/meta) | +| TikTok | Verified for browser events; no server event | Unconfirmed | [TikTok](/docs/campaigns/tracking/tiktok) | +| Google Ads and YouTube | Partial | Unconfirmed | [Google Ads and YouTube](/docs/campaigns/tracking/google-ads) | +| Google Analytics 4 | Verified | Unconfirmed | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | +| Google Tag Manager | Verified | Not applicable (your tags decide) | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | +| Northbeam, Snapchat, Pinterest, Taboola, AppLovin Axon, RudderStack, Everflow, Klaviyo | Unconfirmed | Unconfirmed | [More integrations](/docs/campaigns/tracking/more-integrations) | + +Every guide opens with a **Verification status** table that lists exactly what was checked, how, on which SDK version and when. + +## Send each purchase from one place + +Every ad platform needs to receive a purchase once. A campaign order can reach a platform from up to three places: the funnel's browser pixel, a NEXT store app on the server, and, on Shop Sync stores, a Shopify-side app that reads the synced Shopify order. Decide which one sends the purchase for each platform before you launch. + +- If the browser and the server both send it, they must share the same event ID so the platform can deduplicate. The Meta guide shows how NEXT does this for Meta. +- If a Shopify-side app also sends the synced order to the same platform, exclude orders tagged `NEXT` in that app, or block the purchase in the funnel. +- Meta deduplicates a browser and server event only when the event name and event ID match within 48 hours. Two server senders are never deduplicated. + +[Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) has a table of which Shopify-side tools see synced orders. + +## Privacy and consent + +NEXT Campaigns has no built-in consent banner, consent mode, regional blocking or opt-out link. If your funnel needs them, build them into your pages and make sure they also stop the vendor scripts. The identity settings in the template adapters (for example `triplewhale_contact_enabled` and `meta_advanced_matching_enabled`) send the shopper's email and phone to that vendor. Turn them on only when your privacy policy and consent handling cover it. The SDK also stores the shopper's details in a first-party cookie and includes them in its `dl_*` events, so any tag you add in GTM can read them. + +## Known gaps + +These are the main limits today. Each guide lists its own. + +- The SDK reads the Meta `_fbp` and `_fbc` cookies once when a page loads. On a first visit the Meta pixel may not have set them yet. The starter templates include a workaround; hand-built funnels do not. +- SDK 0.4.x does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`. SDK 0.5.0 does. +- No NEXT app sends TikTok, Google Ads or Triple Whale events from the server for campaign orders. +- Triple Whale attributes an order only when it receives both a pixel purchase and a matching order record. On a store without Shopify, Triple Whale receives no order record. +- The template adapters are not packaged for hand-built funnels. + +## Maintenance + +This section is maintained by the NEXT Campaigns team. It is re-checked when a Campaign Cart SDK minor version is released, when the starter template analytics adapters change, and when the Meta Pixel app changes. Each page shows the date it was last verified. diff --git a/content/docs/campaigns/tracking/meta.json b/content/docs/campaigns/tracking/meta.json new file mode 100644 index 0000000..e5e8555 --- /dev/null +++ b/content/docs/campaigns/tracking/meta.json @@ -0,0 +1,17 @@ +{ + "title": "Tracking", + "pages": [ + "index", + "getting-started", + "triple-whale", + "meta", + "tiktok", + "google-ads", + "google-analytics-4", + "google-tag-manager", + "more-integrations", + "shop-sync", + "events-and-attribution", + "testing-and-troubleshooting" + ] +} diff --git a/content/docs/campaigns/tracking/meta.mdx b/content/docs/campaigns/tracking/meta.mdx new file mode 100644 index 0000000..5d16605 --- /dev/null +++ b/content/docs/campaigns/tracking/meta.mdx @@ -0,0 +1,371 @@ +--- +title: Meta Pixel and Conversions API +description: Send NEXT Campaigns funnel events to a Meta pixel from the browser, send the order Purchase from the server with the Meta Pixel app, and set up both so Meta counts each purchase once. +sidebar_label: Meta +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| Setting `fb_pixel_id` loads Meta's `fbevents.js` and runs `fbq('init')` on every funnel page | Verified | Starter template source, and requests to `www.facebook.com/tr` in a test order | 2026-11-16 | 0.4.43 | +| The SDK's facebook provider sends `PageView`, `ViewContent`, `AddShippingInfo` (custom) and `Purchase` | Verified | Test order, Meta pixel requests observed in the browser | 2026-11-16 | 0.4.43 | +| The browser `Purchase` carries the event ID `your-store-100041` (store subdomain, then order number), `order_id` and item revenue as `value` | Verified | Test order with `storeName` set, `eid`, `cd[order_id]` and `cd[value]` read from the Purchase request | 2026-11-16 | 0.4.43 | +| No browser Meta event is sent for an accepted upsell; `ViewedUpsell` (custom) is sent on the upsell page | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | +| `AddToCart`, `InitiateCheckout` and `AddPaymentInfo` mappings | Unconfirmed | SDK source only; not recorded in the test order | | | +| The Meta Pixel app sends one server `Purchase` per campaign order, with the event ID `{store}-{order number}` | Unconfirmed | App source and merchant docs; the app was not installed on the test store | | | +| Meta deduplicates the browser and server `Purchase` | Unconfirmed | Meta's documentation only; Events Manager not checked | | | +| The `_fbp` and `_fbc` cookies reach the order's attribution | Unconfirmed | SDK and template source only; the placeholder pixel never set the cookies | | | +| Advanced matching with `meta_advanced_matching_enabled` | Unconfirmed | Template source and its tests | | | +| SDK 0.5.0 `destinations.meta` config | Unconfirmed | SDK 0.5.0 source and docs | | | + +The browser side was checked with a placeholder pixel ID on a store without the Meta Pixel app, so the server Purchase, deduplication in Events Manager and cookie capture were not checked. + +## What it does + +Meta tracking on a funnel has two parts that you set up separately. + +| Part | Runs in | Sends | Set up in | +| --- | --- | --- | --- | +| Browser pixel | The shopper's browser, on every funnel page | `PageView`, product, checkout and upsell events, and the order `Purchase`, through the Campaign Cart SDK's facebook provider | `_data/campaigns.json` and `assets/config.js` | +| Server Purchase (Conversions API) | NEXT's servers, after the order is created | One `Purchase` per order | The Meta Pixel app in your store dashboard | + +The starter template loads the pixel. The SDK sends the events through it. The Meta Pixel app sends the server Purchase for campaign orders as well as storefront orders. The app's browser scripts run on your NEXT storefront only and do not load on a funnel. + +When both parts send the order `Purchase`, they must use the same event ID so Meta can deduplicate them. NEXT builds that ID from your store subdomain and the order number, so `storeName` in `config.js` has to be your store subdomain. + +## Before you start + +- A Meta pixel and its ID. For the server Purchase you also need an access token for that pixel. +- Your store subdomain: the lowercase part before `.29next.store`, for example `your-store` in `your-store.29next.store`. +- A funnel built from a starter template. The Meta pixel code ships with every template family except `landing`. +- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. +- The Meta Pixel app installed on your store, if you want the server Purchase. See the [Meta Pixel app merchant docs](https://docs.nextcommerce.com/docs/apps/meta-pixel). + +## Set up + + + + +### Part 1: browser pixel + +The browser pixel needs two settings. With only the first, the pixel loads but the SDK sends no events. With only the second, the SDK has no pixel to send through. + +1. Open `_data/campaigns.json`, find your campaign's entry and set `fb_pixel_id`. The key is already there with an empty value. + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "fb_pixel_id": "123456789012345" + } +} +``` + +2. Open `assets/config.js`. Set `storeName` to your store subdomain, turn on the facebook provider and give it the same pixel ID. + +```js title="assets/config.js" +window.nextConfig = { + // ...your existing settings + storeName: 'your-store', + analytics: { + enabled: true, + mode: 'auto', + providers: { + // ...other providers unchanged + facebook: { + enabled: true, + settings: { + pixelId: '123456789012345' + } + } + } + } +}; +``` + +The template ships with `storeName: 'store-name'` and the facebook provider turned off. Change both. The SDK only checks that `settings.pixelId` is not empty; the events go to the pixel that `fb_pixel_id` loads, so keep the two the same to avoid confusion. + +3. Do not add `fbq('track', 'PageView')` to your pages. The template's pixel code leaves it out on purpose because the SDK sends `PageView` on every page load. A manual call sends every page view twice. +4. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds. + +### Part 2: server Purchase + +5. In your store dashboard, open **Apps**, then **Meta Pixel**. Select **Add Pixel**, enter the **Pixel ID (Dataset ID)** and **Access Token**, and save. Add the same pixel you set as `fb_pixel_id`. +6. Set **Default Meta Pixel**. Orders that do not say which pixel they came from go to this one. +7. Check the app's other settings: + +| Setting | Default | What it does | +| --- | --- | --- | +| **Default Meta Pixel** | Required | The pixel that receives the server Purchase when the order has no `fb_pixel_id` in its attribution metadata | +| **Enable Delay Order Confirmation** | On | Waits 10 minutes before sending, to wait for order updates | +| **Enable Sending Test Data** | Off | Test orders are skipped unless this is on. The merchant docs call it **Enable Test Data** | +| **Ignore Subscription Renewal Orders** | On | Renewal orders are not sent as conversions. Not listed in the merchant docs | + +8. Choose who sends the order Purchase to Meta, and set the matching config. See [Browser and server events](#browser-and-server-events). +9. Deploy, then follow [Verify it works](#verify-it-works). + + + + +The Meta setup is documented for starter templates only. It was not tested on a hand-built page, and a hand-built funnel does not get the template's `_fbp` and `_fbc` workaround. The closest supported path is to build the funnel from a [starter template](/docs/campaigns/templates); the Meta Pixel app's server Purchase does not depend on the funnel's pages. + + + + +### SDK 0.5.0 + +The starter templates pin SDK 0.4.43, and everything else on this page describes 0.4.43. On SDK 0.5.0 the Meta settings move. This is from the 0.5.0 source and docs and has not been tested. + + + + +```js title="assets/config.js" +window.nextConfig = { + storeName: 'your-store', + analytics: { + enabled: true, + mode: 'auto', + providers: { + facebook: { + enabled: true, + settings: { pixelId: '123456789012345' } + } + } + } +}; +``` + + + + +```js title="assets/config.js" +window.nextConfig = { + analytics: { + destinations: { + meta: { + enabled: true, + storeName: 'your-store' + } + } + } +}; +``` + +`destinations.meta.storeName` falls back to the top-level `storeName`, and the 0.4.x keys still turn Meta on. Other changes that affect Meta on 0.5.0: + +- `blockedEvents` is not read, so the server-only option below cannot be set in config. +- The SDK does not send `PageView` and expects the page's own pixel code to. The template pixel code sends none, so check page views before you move a template to 0.5.0. +- An accepted upsell is sent as its own `Purchase` with the event ID `-US`, without the store name. It does not match a server event. +- Prices are sent before tax. + + + + +## Events sent + +The SDK's facebook provider turns these SDK events into Meta events. Custom events are sent with `fbq('trackCustom')`, the rest with `fbq('track')`. + +| SDK event | Meta event | Type | When it fires | Seen in the test order | +| --- | --- | --- | --- | --- | +| `dl_user_data` | `PageView` | Standard | Every page load | Yes | +| `dl_view_item` | `ViewContent` | Standard | A page shows a package | Yes | +| `dl_add_to_cart` | `AddToCart` | Standard | An item is added to the cart | Not recorded | +| `dl_remove_from_cart` | `RemoveFromCart` | Custom | An item is removed | Not recorded | +| `dl_begin_checkout` | `InitiateCheckout` | Standard | The checkout form loads | Not recorded | +| `dl_add_shipping_info` | `AddShippingInfo` | Custom | A valid shipping address is entered | Yes | +| `dl_add_payment_info` | `AddPaymentInfo` | Standard | Payment details are complete | Not recorded | +| `dl_purchase` | `Purchase` | Standard | The first page after payment | Yes | +| `dl_viewed_upsell` | `ViewedUpsell` | Custom | An upsell page is shown | Yes | +| `dl_skipped_upsell` | `SkippedUpsell` | Custom | The shopper declines an upsell | Not recorded | +| `dl_upsell_purchase` | Nothing | | The page after an upsell is accepted | Yes, nothing sent | + +To stop one event going to Meta, add `blockedEvents` to the facebook provider with the SDK event names, for example `blockedEvents: ['dl_add_shipping_info']`. The names must match exactly. Meta names such as `PageView` or `Purchase` block nothing, even though the template's config comment shows `["PageView"]`. A blocked event still goes to every other provider. + +The SDK's facebook provider sends no customer data. Customer data reaches Meta only through advanced matching, below. + +## Attribution requirements + +Keep `fbclid` on the ad's landing URL. The SDK stores it in the order's attribution metadata and carries the query string through to the checkout, upsell and receipt pages. + +The Meta Pixel app reads these keys from the order's attribution metadata: + +| Metadata key | Set by | Used by the app for | +| --- | --- | --- | +| `fb_fbp` | The SDK, from the `_fbp` cookie | Matching the server Purchase to the browser | +| `fb_fbc` | The SDK, from the `_fbc` cookie | Matching the server Purchase to the click | +| `fb_pixel_id` | The SDK, from the template's `fbq('init')` call | Choosing which pixel receives the server Purchase | +| `fb_test_code` | You, for testing only | Sending the server Purchase to Meta's Test Events | +| `fb_event_source_url` | Not set by the SDK | The event source URL; the app falls back to your store's primary domain | + +The merchant docs list `fb_fbp` and `fb_fbc` as required for the server event. + +### The `_fbp` and `_fbc` cookies + +SDK 0.4.43 reads `_fbp` and `_fbc` when a page loads and again when the checkout form starts. It does not read them later. On a first visit the Meta pixel may not have set them yet, so the order can carry empty values. SDK 0.5.0 reads them once per tab and has the same gap. + +The starter templates include `meta.adapter.js`, which loads whenever `fb_pixel_id` is set. It reads the two cookies again every 500 ms for up to 10 seconds while they are missing, and after every cart update, and copies them into the attribution metadata with `next.addMetadata`. Hand-built funnels do not have it. + +### Advanced matching + +Add `"meta_advanced_matching_enabled": true` to the campaign entry in `_data/campaigns.json` to send the shopper's details to Meta through the pixel. `meta.adapter.js` collects the shopper's details from the checkout fields as they are typed, then calls `fbq('init')` once on the page with them, just before the first `InitiateCheckout`, `AddPaymentInfo` or `Purchase` that has an email or phone. It sends `em`, `ph`, `fn`, `ln`, `ct`, `st`, `zp`, `country` and `external_id` (the SDK's anonymous visitor ID). Phone is sent only when the field holds a valid international number. + +Advanced matching is not gated on the marketing opt-in checkbox. Turn it on only when your privacy policy and consent handling cover sending this data to Meta. If you use a consent banner, make it stop the pixel. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). + +On a return visit the SDK refills the phone field after `InitiateCheckout` has been sent, so that event goes without `ph`. + +## Purchases, revenue and upsells + +| Field | Browser `Purchase` (SDK) | Server `Purchase` (Meta Pixel app) | +| --- | --- | --- | +| When | The first page after payment | After the order is created; 10 minutes later when **Enable Delay Order Confirmation** is on | +| Event ID | `{storeName}-{order number}`, for example `your-store-100041`. None when `storeName` is not set | `{store}-{order number}`, using the store subdomain | +| `order_id` | The NEXT order number | The NEXT order number | +| `value` | Item revenue, excluding tax and shipping, for the first sale | The order total including tax (`total_incl_tax`) | +| `num_items` | Number of order lines | Sum of item quantities | +| Other fields | `currency`, `content_type`, `content_ids`, `contents` | | +| Upsells | Not included. Nothing is sent for an accepted upsell | With the delay on, the app re-reads the order before sending, so upsells accepted before then are expected to be included. Not confirmed | + +The SDK's facebook provider never sends upsell revenue to Meta from the browser. The upsell page sends `ViewedUpsell` as a custom event, and `dl_upsell_purchase` has no Meta mapping. If you want upsell revenue in Meta, it has to come from the server Purchase. + +When Meta deduplicates two events, its documentation says it generally keeps the first one received. With the delay on, the browser Purchase usually arrives first, so Meta may report the browser value (item revenue without upsells) rather than the server total. This was not checked in Events Manager. + +## Browser and server events + +Every purchase should reach Meta from one place, or from two places that share an event ID. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +Meta deduplicates a browser and server event only when the browser `eventID` equals the server `event_id`, the event names match and both go to the same pixel, within 48 hours ([Meta: deduplicate pixel and server events](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)). Two server senders are never deduplicated. + +Choose one of these two options. + +### Option 1: browser events and server Purchase, deduplicated + +The browser sends every event, including `Purchase`. The Meta Pixel app also sends `Purchase`. Both use `your-store-{order number}`, so Meta keeps one. This needs `storeName` set to your store subdomain exactly. + +```js title="assets/config.js" +window.nextConfig = { + storeName: 'your-store', + analytics: { + enabled: true, + mode: 'auto', + providers: { + facebook: { + enabled: true, + settings: { pixelId: '123456789012345' } + } + } + } +}; +``` + +### Option 2: server Purchase only + +The browser sends every event except `Purchase`, and the Meta Pixel app is the only Purchase sender. Use this if you cannot be sure the IDs match, or if you want the server value, which is expected to include upsells. + +```js title="assets/config.js" +window.nextConfig = { + storeName: 'your-store', + analytics: { + enabled: true, + mode: 'auto', + providers: { + facebook: { + enabled: true, + settings: { pixelId: '123456789012345' }, + blockedEvents: ['dl_purchase'] + } + } + } +}; +``` + + +Never send the same Meta event from a Google Tag Manager tag and from the SDK's facebook provider. If your GTM container also runs a Meta pixel on the funnel, its base code sends its own `PageView`, so add `'dl_user_data'` to the facebook provider's `blockedEvents` to stop a second `PageView`. A pixel loaded only through GTM is not detected by the SDK, so the order's `fb_pixel_id` is empty and the server Purchase goes to the **Default Meta Pixel**. + + +On Shop Sync stores, a Shopify-side Meta sender would be a third sender for the same order. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). + +### Extra pixels and backup ad accounts + +Add every pixel you use in the Meta Pixel app with **Add Pixel**. A campaign's server Purchase goes to the pixel in that campaign's `fb_pixel_id`, which the SDK records on the order. To send a campaign to a different pixel or a backup ad account, set its `fb_pixel_id` and `settings.pixelId` to that pixel and add the pixel in the app. + + +If an order's `fb_pixel_id` is not one of the pixels added in the Meta Pixel app, the app sends nothing for that order. It does not fall back to the **Default Meta Pixel**. Add the pixel in the app before you point a campaign at it. + + +## Worked example + +A store at `your-store.29next.store` runs a campaign on pixel `123456789012345` with advanced matching on, and uses option 1. + +```json title="_data/campaigns.json" +{ + "summer-offer": { + "name": "Summer Offer", + "sdk_version": "0.4.43", + "fb_pixel_id": "123456789012345", + "meta_advanced_matching_enabled": true + } +} +``` + +`assets/config.js` uses the option 1 config above, with `storeName: 'your-store'`. In the Meta Pixel app, pixel `123456789012345` is added and set as **Default Meta Pixel**. + +A shopper buys a $12 package, then accepts a $3 upsell. The order number is `100041`. + +| Sender | Event | Event ID | Value | +| --- | --- | --- | --- | +| Browser, on the upsell page | `Purchase` | `your-store-100041` | 12 | +| Browser, on the upsell page | `ViewedUpsell` | | | +| Browser, after the upsell is accepted | Nothing | | | +| Meta Pixel app, 10 minutes after the order | `Purchase` | `your-store-100041` | The order total including tax, expected to include the upsell | + +The event IDs match, so Meta should keep one Purchase for order `100041`. The browser rows match what was observed in a test order; the server row is from the app's source. + +## Verify it works + +1. Open a funnel page on your production domain. Do not add `?ignore=true`, which turns all tracking off for the browser tab. +2. In the browser console, run `NextAnalytics.getStatus()`. `providers` should include `facebook`. +3. In Meta Events Manager, open **Test Events** for your pixel, or use the Meta Pixel Helper browser extension. Walk through the funnel. You should see `PageView` on each page, and `AddShippingInfo` once you enter a shipping address. +4. Place a test order with a [test card](/docs/testing). On the first page after payment you should see `Purchase` with the event ID `your-store-` followed by your order number. In the browser's network panel this is the `eid` parameter on the request to `www.facebook.com/tr`. +5. To test the server Purchase, turn on **Enable Sending Test Data** in the Meta Pixel app. The app skips test orders otherwise. Then add the test code from **Test Events** to the order's attribution metadata on a funnel page before checkout: + +```html + +``` + +6. Place another test order. With **Enable Delay Order Confirmation** on, wait at least 10 minutes. Test Events should show a server `Purchase` with the same event ID as the browser one. +7. Remove the snippet and turn **Enable Sending Test Data** off before launch. The app passes `fb_test_code` to Meta on every order that carries it. + +The app keeps a log of the events it sends for 30 days. Where that log appears in the dashboard was not confirmed for this guide. + +More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Troubleshooting and limits + +| Symptom | Likely cause | Fix | +| --- | --- | --- | +| No requests to Meta at all | Built with `npm run dev`, `fb_pixel_id` empty, or `?ignore=true` set earlier in the tab | Build with `npm run build`; check the key; open a new tab without `?ignore=true` | +| The pixel loads but sends no events | The facebook provider is off, or `settings.pixelId` is empty, so the SDK skips the provider with a console warning | Turn the provider on and set `settings.pixelId` | +| A console warning that `fbq` is missing, about 5 seconds after an event | The provider is on but no pixel is on the page | Set `fb_pixel_id` in `_data/campaigns.json` | +| Two `PageView` events per page | A manual `fbq('track', 'PageView')`, or a Meta pixel in GTM | Remove the manual call, or block `dl_user_data` on the facebook provider | +| Each purchase counted twice | `storeName` missing, left as `store-name`, or not your exact store subdomain, so the browser and server IDs differ | Set `storeName` to your store subdomain in lowercase, or use option 2 | +| No server Purchase for a test order | **Enable Sending Test Data** is off | Turn it on while testing | +| No server Purchase for a live order | The order's `fb_pixel_id` is not added in the app, no pixel is configured, the order is a subscription renewal, or the 10-minute delay has not passed | Add the pixel in the app; wait 10 minutes; check **Ignore Subscription Renewal Orders** | +| Server Purchase goes to the wrong pixel | The pixel is loaded only by GTM, so `fb_pixel_id` is empty and the default pixel is used | Load the pixel with `fb_pixel_id`, or set **Default Meta Pixel** to the right pixel | +| `blockedEvents` has no effect | Meta event names used, or SDK 0.5.0 | Use `dl_*` names; on 0.5.0 `blockedEvents` is not read | +| `fb_fbp` or `fb_fbc` empty on orders | First visit before the pixel set its cookies, or a hand-built funnel without `meta.adapter.js` | Use a starter template; check the order's attribution metadata | + +- Browser and server Purchase values differ by design: the browser sends item revenue without tax or shipping, the server sends the order total including tax. +- Meta receives no browser event for subscription renewals or other orders created without a funnel visit. The server Purchase skips renewals while **Ignore Subscription Renewal Orders** is on. +- The Meta Pixel app's browser scripts run on your NEXT storefront only. On a funnel, browser events come from the SDK. diff --git a/content/docs/campaigns/tracking/more-integrations.mdx b/content/docs/campaigns/tracking/more-integrations.mdx new file mode 100644 index 0000000..6b314d4 --- /dev/null +++ b/content/docs/campaigns/tracking/more-integrations.mdx @@ -0,0 +1,134 @@ +--- +title: More integrations +description: Short entries for Northbeam, Snapchat, Pinterest, Taboola, AppLovin Axon, RudderStack, Everflow and Klaviyo, with the settings, events and limits each one has today. None of them has been walked end to end yet. +sidebar_label: More integrations +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- + +These integrations exist in the starter templates or as store apps, but NEXT has not walked a test order through them end to end. Each entry is Unconfirmed unless it says otherwise, and a vendor gets its own full guide once it has been tested. Before you add a second sender for a purchase, read [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +## Northbeam + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Built into the starter templates; not walked end to end. | +| Turn it on | Set `northbeam_client_id` on the campaign entry in `_data/campaigns.json`. NEXT has no Northbeam app, so the template snippet is the only path. | +| Optional keys | `northbeam_identity_enabled` (`true`, `1` or `yes`), `northbeam_allowed_events`, `northbeam_blocked_events` | +| Events sent | A page view from the base snippet on load. By default, `purchase` for each order, sent with `Northbeam.firePurchaseEvent`. With identity on, an email identify on the prospect cart and when the shopper enters an email. | +| Upsells | Each accepted upsell is sent as another `firePurchaseEvent`, with the order reference plus `-US1`, `-US2` and so on as the ID, and the upsell amount as the total. | +| Customer data | With `northbeam_identity_enabled` on, the email only. Phone is not sent. Not gated on accepts_marketing. | +| Limits | NEXT has no Northbeam app or server feed. The adapter rebuilds Northbeam's total as value plus tax plus shipping, because the SDK's `value` is product revenue only. | + +On a Shop Sync store, the funnel purchase cannot match the order that Northbeam receives through its Shopify connector, so it creates an unmatched or double-counted order. Block the pixel purchase and rely on identity instead. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "northbeam_client_id": "your-client-id", + "northbeam_identity_enabled": "true", + "northbeam_blocked_events": "dl_purchase, dl_upsell_purchase" + } +} +``` + +## Snapchat + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Built into the starter templates; not walked end to end. | +| Turn it on | Set `snap_pixel_id` on the campaign entry in `_data/campaigns.json`. | +| Optional keys | `snap_advanced_matching_enabled` (`true`, `1` or `yes`), `snap_allowed_events`, `snap_blocked_events` | +| Events sent | Uppercase names. By default: `VIEW_CONTENT` for product views, `ADD_CART`, `START_CHECKOUT`, `ADD_BILLING` for payment details, and `PURCHASE` for each order. | +| Upsells | Sent as another `PURCHASE`, with `transaction_id` set to the order reference plus `-US1`, `-US2` and so on. Snapchat counts each one as a purchase. | +| Customer data | With advanced matching on, the raw email and phone, sent from the prospect cart. The adapter gates this on accepts_marketing. | +| Limits | The purchase value is sent in the `price` field and is product revenue, without tax and shipping. The source notes that adding tax and shipping would give total-paid ROAS, but the adapter does not do that by default. Advanced matching works through a re-initialisation of the pixel, which the source asks to be checked. That check has not been run. | + +## Pinterest + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Built into the starter templates; not walked end to end. | +| Turn it on | Set `pinterest_tag_id` on the campaign entry in `_data/campaigns.json`. | +| Optional keys | `pinterest_enhanced_match_enabled` (`true`, `1` or `yes`), `pinterest_allowed_events`, `pinterest_blocked_events` | +| Events sent | Lowercase conversion events. By default: `addtocart` for add to cart and `checkout` for each order. The adapter sends no product-view, begin-checkout or payment-info event. | +| Upsells | Sent as another `checkout`, with its own event ID and an `order_id` of the order reference plus `-US1`, `-US2` and so on. | +| Customer data | With enhanced match on, the raw email in a `pintrk('load')` call on the prospect cart. Pinterest hashes it in the browser. The adapter gates this on accepts_marketing. | +| Limits | Enhanced match is marked UNVERIFIED in the adapter source. The source notes that a second `load` call may do nothing. This has not been tested. | + +## Taboola + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Built into the starter templates; not walked end to end. | +| Turn it on | Set `taboola_account_id` in `_data/campaigns.json` to your numeric Taboola account ID. The Taboola store app tracks the storefront only and does not load on funnels. | +| Optional keys | `taboola_allowed_events`, `taboola_blocked_events` | +| Events sent | By default: `view_content`, `add_to_cart`, `start_checkout`, `add_payment_info` and `make_purchase`. The base pixel sends `page_view`. | +| Upsells | Sent as the custom event `upsell_purchase`, with `orderid` set to the order reference plus `-US1`, `-US2` and so on, and the revenue for that upsell only. | +| Customer data | None. Hashed-email enhanced matching is not sent. | +| Limits | The account ID is written into the page without quotes, so a value that is not numeric breaks the page script. | + +## AppLovin Axon + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Built into the starter templates; not walked end to end. | +| Turn it on | Set `axon_event_key` in `_data/campaigns.json`. The AppLovin AXON store app is storefront-only and does not load on funnels. | +| Optional keys | `axon_item_category_id` (positive integer), `axon_send_user_data` (`true`), `axon_allowed_events`, `axon_blocked_events` | +| Events sent | By default: `page_view`, `view_item`, `add_to_cart`, `begin_checkout`, `add_payment_info` and `purchase`. Axon accepts only its standard event names, so there are no custom events. | +| Upsells | Sent as a second `purchase`, with `transaction_id` set to the order reference plus `-US1`, `-US2` and so on, and tax and shipping set to 0. Axon counts each upsell as a purchase. | +| Customer data | With `axon_send_user_data` set to `true`, the purchase event carries `user_data`: the email, the phone digits without the plus sign, and the user ID. The adapter does not gate this on accepts_marketing. | +| Limits | `item_category_id` must be a positive integer. The SDK's item category is the campaign name, and Axon rejects it with HTTP 400. Images are sent only for `.png`, `.jpg` and `.jpeg` URLs. Without `user_data`, Axon still records the revenue and transaction ID. | + +## RudderStack + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Built into the starter templates; not walked end to end. | +| Turn it on | Set both `rudderstack_write_key` and `rudderstack_dataplane_url` in `_data/campaigns.json`. The loader is added only when both are set. Then set `analytics.providers.rudderstack.enabled` to `true` in `assets/config.js`. On SDK 0.5.0 the flag is `destinations.rudderstack.enabled`, and the 0.4.x key still maps to it. That change has not been walked. | +| Optional keys | None in `campaigns.json`. `blockedEvents` in `assets/config.js` applies to this provider as well. | +| Events sent | `Product Viewed`, `Product Added`, `Product Removed`, `Cart Viewed`, `Checkout Started`, `Checkout Step Completed` (shipping), `Payment Info Entered`, `Order Completed`, `Upsell Viewed`, `Upsell Skipped`, `Signed Up` and `Logged In`. `identify` calls use the email as the user ID. | +| Upsells | Each accepted upsell sends another `Order Completed`, with the order ID set to the order reference plus `-US1`, `-US2` and so on. | +| Customer data | Identify traits include email, first name, last name, phone, city, state, country, postal code and `acceptsMarketing`. The `state` trait is sent on purchase only. | +| Limits | `Order Completed` `total` is value plus tax plus shipping. On a store that shows VAT, `value` already includes tax, so RudderStack counts tax twice. This is inferred from the code paths and has not been run. On SDK 0.4.43 the adapter never calls `page()`. | + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "rudderstack_write_key": "your-write-key", + "rudderstack_dataplane_url": "https://your-dataplane-url" + } +} +``` + +With the flag off, the loader still runs and the SDK sends nothing. This is inferred from the source and has not been run. + +## Everflow + +| Item | Details | +| --- | --- | +| Status | Unconfirmed (source only). Store app; not walked end to end. | +| Turn it on | In the store dashboard, go to Apps, then Everflow. Set **Everflow Postback URL** and **Everflow Network ID**, and keep **Enable Everflow S2S Postback** on. | +| Optional keys | **Everflow Verification Token** (up to 32 characters), **Everflow Postback Delay Minutes** (0 to 10, default 0), **Include Tax in Conversion Value** (off by default). | +| Events sent | One server-side postback to Everflow when an order is placed, and another when its status changes. The fields are the network ID, verification token, transaction ID, currency, amount and order number. | +| Upsells | Not confirmed. The source sends one postback per order, and the amount is the order total when the postback fires, so an upsell added before then should be included. This is inferred and has not been tested. | +| Customer data | None. The postback has no customer fields. | +| Limits | A postback is sent only when the order's attribution has `everflow_transaction_id`, only for open orders that are not on hold, and never for a canceled order. Test orders are skipped unless **Enable S2S Postback for test orders** is on. The configured URL keeps only its scheme and host, so custom query parameters cannot be added. | + +The SDK copies the `evclid` URL parameter into `everflow_transaction_id`, so keep `evclid` on the funnel's landing URL. Merchant docs: [Everflow app](https://docs.nextcommerce.com/docs/apps/everflow). + +## Klaviyo + +| Item | Details | +| --- | --- | +| Status | Unconfirmed. Store app; source and merchant docs only, not walked end to end. | +| Turn it on | Install the Klaviyo app from the Apps menu in the NEXT dashboard, and connect your existing Klaviyo account through OAuth. Settings are under Actions, then Settings. | +| Optional keys | **Delay Order Confirmation Events**, **Enable Sending Test Data**, **Default Subscription List** and **SMS Consent**, among the other settings on the app page. | +| Events sent | The onsite events (Active on Site, Viewed Product, Added to Cart, Started Checkout) fire on the NEXT storefront only, not on funnel pages. Server events come from store webhooks: Placed Order and one Ordered Product per line on order creation; Fulfilled Order, Canceled Order and Refunded Order on order updates; Started Subscription and Cancelled Subscription on subscription changes. Started Checkout from abandoned carts is sent only when its store setting is on. | +| Upsells | With **Delay Order Confirmation Events** on, Placed Order waits 10 minutes. The merchant docs describe this hold as the window that lets upsells join the order. | +| Customer data | The server events are built from the store's order webhooks. This page does not list the fields Klaviyo receives. | +| Limits | Campaign reach is inferred, not tested. The router does not filter by order source, so a campaign order that fires `order.created` should be sent. Test orders are skipped unless **Enable Sending Test Data** is on. | + +Merchant docs: [Klaviyo app](https://docs.nextcommerce.com/docs/apps/klaviyo). diff --git a/content/docs/campaigns/tracking/shop-sync.mdx b/content/docs/campaigns/tracking/shop-sync.mdx new file mode 100644 index 0000000..2d4dad2 --- /dev/null +++ b/content/docs/campaigns/tracking/shop-sync.mdx @@ -0,0 +1,164 @@ +--- +title: Tracking on Shop Sync stores +description: What reaches Shopify when Shop Sync pushes a NEXT campaign order, which Shopify-side tracking tools see synced orders, how to pick one purchase sender per ad platform, and how to map a click ID such as gclid onto the Shopify order. +sidebar_label: Shop Sync stores +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; + +This page is for stores where NEXT campaign orders are pushed into Shopify by Shop Sync, and where you also run tracking apps on the Shopify side. On these stores one order can reach an ad platform twice: once from your funnel pages and once from a Shopify app that reads the synced Shopify order. Read [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place) first, then use this page to decide which sender to keep for each platform. + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| The NEXT order carries the UTM parameters and `gclid` as attribution fields, and `fbclid` in attribution metadata | Verified | Test order placed through a starter template funnel, then read through the Admin API | 2026-11-16 | 0.4.43 | +| An accepted upsell is added to the same NEXT order | Verified | Test order with an accepted upsell; the order total included the upsell line | 2026-11-16 | 0.4.43 | +| The `landing_page` attribution metadata on the order holds the checkout URL, not the first page the shopper landed on | Verified | Same test order, read through the Admin API | 2026-11-16 | 0.4.43 | +| The funnel's Meta `Purchase` carries an event ID in the `{store}-{order number}` format that the Meta Pixel app uses | Verified | Test order, Meta pixel requests observed in the browser | 2026-11-16 | 0.4.43 | +| Shop Sync creates the Shopify order tagged `NEXT`, with no UTM or click ID fields | Unconfirmed | Shop Sync source and the Shop Sync guides | | | +| Only mapped `order` and `attribution` metadata fields are written to the Shopify order, once, when it is created | Unconfirmed | Shop Sync source and the Shop Sync metadata guide | | | +| Copying `gclid` into metadata with `next.addMetadata` lets Shop Sync map it | Unconfirmed | Shop Sync metadata guide and SDK source | | 0.4.43 | +| Which Shopify-side tools see synced orders | Unconfirmed | Shop Sync source, template documentation and vendor documentation | | | +| The template `*_blocked_events` keys and the SDK `blockedEvents` setting stop the funnel purchase | Unconfirmed | Starter template and SDK source; not run in the test order | | 0.4.43 | +| A Meta Pixel app server `Purchase` deduplicates against the funnel's browser `Purchase` | Unconfirmed | Meta Pixel app source and Meta documentation | | | + +No Shop Sync store was used for the test order, so nothing that happens after the order leaves NEXT was observed: the Shopify order, its metafields, and what any Shopify-side app or ad platform did with it. + +## What reaches Shopify + +Shop Sync creates the Shopify order when your NEXT store sends a fulfillment request for the order. It is not created at the moment of payment. + +| On the Shopify order | Value | +| --- | --- | +| Tags | The NEXT order's tags plus `NEXT`. Subscription renewal orders also get `Recurring` | +| PO number | The NEXT order number | +| Financial status | Paid | +| Processed at | The date the order was placed in NEXT | +| Other fields | Currency, shipping address, line items, email, phone, and the test flag | +| Payment transaction | Added only when payment sync is turned on for your Shop Sync store | +| UTM parameters, click IDs, referrer, landing page | Not sent | +| Metafields | Only the metadata fields you map in Shop Sync (see below) | + +An accepted upsell is added to the same NEXT order, so the NEXT order total includes it. Whether the Shopify order includes an upsell depends on the NEXT order's contents when the fulfillment request is sent; that timing was not checked. + +Subscription renewals are synced like other orders, tagged `Recurring`, and copy the renewal order's own metadata. To carry a value such as a click ID onto renewals, set it on the subscription's attribution metadata through the Admin API. + +### Attribution and metadata + +Shop Sync does not copy attribution to Shopify on its own. After it creates the Shopify order, it writes Shopify order metafields for the keys you have mapped, and nothing else. It can read from two NEXT objects only: the order's `metadata` (object `order`) and the order's `attribution.metadata` (object `attribution`). Empty or null values are skipped. + +The SDK puts some click IDs into `attribution.metadata` and others into top-level attribution fields. `fbclid` is already in metadata. `gclid` and the UTM parameters are top-level fields, so Shop Sync cannot map them until you copy them into metadata. The section Mapping a click ID to Shopify, below, shows how. + +To map a field: + +1. In NEXT, open **Settings**, then **Metadata Fields**, click **Add Metadata Definition**, give it a name, choose the object (**Attribution** for click IDs), enter the key, choose the type, and click **Save Changes**. See [Metadata fields and tags](https://docs.nextcommerce.com/docs/build-a-store/technical-settings/metadata-fields-and-tags). +2. In Shopify, open **Settings**, then **Custom data**, and add an **Orders** metafield definition of the matching type. +3. In Shop Sync, click **Add Metadata Sync**. Choose the NEXT field under **Next Commerce Metadata** and the Shopify field under **Shopify Order Metafield**, then save. + +The two types must match or the save fails with "Metadata type mismatch": + +| NEXT type | Shopify metafield type | +| --- | --- | +| Text | `single_line_text_field` | +| Multi Text | `multi_line_text_field` | +| Integer | `number_integer` | +| Decimal | `number_decimal` | +| Boolean | `boolean` | + +The Shop Sync guides cover the rest of the setup: [Shop Sync onboarding](https://guides.nextcommerce.com/guides/shop-sync-onboarding) and [Shop Sync metadata](https://guides.nextcommerce.com/guides/shop-sync-metadata). + +## Which tools see synced orders + +A synced order is created in Shopify through Shopify's Admin API. The shopper never loads a Shopify storefront or checkout page, so anything that depends on a Shopify browser session does not see the order. Tools that read Shopify orders after they exist do. + +| Tool type | Sees synced orders? | Status | Source | +| --- | --- | --- | --- | +| Shopify admin and reports | Yes. The order shows as imported, unfulfilled, tagged `NEXT` | Unconfirmed | Shop Sync onboarding guide | +| Triple Whale connected to the Shopify store | Yes, it ingests the synced Shopify order | Unconfirmed | Starter template documentation; Triple Whale documentation says Shopify orders reach it by webhook | +| Northbeam through its Shopify connector | Yes, it ingests the synced Shopify order as the order of record | Unconfirmed | Starter template source | +| Shopify apps that send server events from Shopify order webhooks | Yes, they report synced orders as purchases | Unconfirmed | Internal NEXT notes only; not checked in source | +| Shopify's native Meta sales channel | No, it does not report orders created through the API | Unconfirmed | Internal NEXT notes only; not checked in source | +| Pixels that run in the Shopify storefront or checkout | No, the shopper never visits those pages | Unconfirmed | Follows from how Shop Sync creates the order; not tested | +| Any Shopify-side tool that reads attribution from the Shopify order itself | Sees no UTM, referrer or landing page, only the metafields you map | Unconfirmed | Shop Sync source | + +If a tool is not in this table, check whether it reads Shopify orders through webhooks or the Admin API (it will see synced orders) or only through a browser pixel on Shopify pages (it will not). + +## Pick one purchase sender per platform + +For each ad platform, decide which one place sends the purchase. A campaign order can reach a platform from the funnel's browser pixel, from a NEXT store app on the server, and from a Shopify-side app that reads the synced order. The funnel side is turned off with a blocked-events key in `_data/campaigns.json`, or with `blockedEvents` in `assets/config.js` for the SDK's Meta provider. The Shopify side is turned off in the Shopify app, by excluding orders tagged `NEXT` if the app offers a tag filter, or by turning off its purchase events. No Shopify app's settings were checked for this page. + +| Platform | Senders that can reach it | Recommended single sender | How to stop the others | Status | +| --- | --- | --- | --- | --- | +| Meta | Funnel browser `Purchase` (SDK Meta provider); NEXT Meta Pixel app server `Purchase`; a Shopify-side server sender | The funnel browser `Purchase` and the NEXT Meta Pixel app, as one pair. They use the same event ID, `{store}-{order number}`, so Meta can deduplicate them | Exclude orders tagged `NEXT` in the Shopify-side sender, or turn its purchase events off for that pixel. If you keep the Shopify-side sender instead, turn off the NEXT Meta Pixel app and add `"dl_purchase"` to `analytics.providers.facebook.blockedEvents` | Partial: the funnel event ID was observed; the server side was not | +| Triple Whale | Funnel adapter `Purchase` and `UpsellPurchase`; the synced Shopify order Triple Whale ingests | The Shopify order Triple Whale ingests, with the funnel sending `Contact` to tie the session to it | `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"`, with `triplewhale_name` set to `your-store.myshopify.com`, `triplewhale_platform` set to `SHOPIFY` and `triplewhale_contact_enabled` on | Unconfirmed, and see the note below | +| Northbeam | Funnel adapter `purchase`; the synced Shopify order Northbeam ingests | The Shopify order from Northbeam's Shopify connector, with identity sent from the funnel | `"northbeam_blocked_events": "dl_purchase, dl_upsell_purchase"`, with `northbeam_identity_enabled` on. See [Northbeam](/docs/campaigns/tracking/more-integrations#northbeam) | Unconfirmed | +| GA4 and Google Ads | Funnel GA4 adapter; any Shopify-side Google app that reports synced orders (not confirmed that one does) | The funnel GA4 adapter, with Google Ads importing GA4 key events | Exclude orders tagged `NEXT` in the Shopify-side Google app, or, to keep that app instead, `"ga4_blocked_events": "dl_purchase, dl_upsell_purchase"` | Unconfirmed | +| TikTok | Funnel TikTok adapter `Purchase`; any Shopify-side TikTok app that reports synced orders (not confirmed that one does) | The funnel TikTok adapter. NEXT sends no TikTok server event for campaign orders | Exclude orders tagged `NEXT` in the Shopify-side TikTok app, or, to keep that app instead, `"tiktok_blocked_events": "dl_purchase, dl_upsell_purchase"` | Unconfirmed | + +Things to know about each row: + +- Meta deduplicates a browser event and a server event when the event name and event ID match and both arrive within 48 hours. Meta's documentation does not describe deduplicating two server events, so never run the NEXT Meta Pixel app and a Shopify-side server sender for the same pixel. See [Meta's deduplication guide](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events) and the [Meta](/docs/campaigns/tracking/meta) guide. +- The SDK's `blockedEvents` matches the SDK event name exactly. Use `"dl_purchase"`. A Meta event name such as `"Purchase"` blocks nothing. +- The NEXT Meta Pixel app skips subscription renewals by default (**Ignore Subscription Renewal Orders**). A Shopify-side sender sees synced renewals tagged `Recurring` and may report them as purchases. +- TikTok deduplicates a pixel event and an Events API event only when both carry the same event ID ([TikTok's deduplication guide](https://ads.tiktok.com/resources/help/article/event-deduplication?lang=en)). NEXT has not confirmed that any Shopify-side TikTok app uses the funnel's event ID, so treat two TikTok senders as a double count. +- Google Ads setup is in [Google Ads and YouTube](/docs/campaigns/tracking/google-ads). + + +The starter template documentation says to block the funnel purchase on Shop Sync stores when Triple Whale is connected to Shopify, or orders are counted twice. Triple Whale's own documentation says attribution needs both a pixel purchase and a matching order record ([custom sales platform guide](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform)). Neither setup has been tested on a Shop Sync store. Check attribution in Triple Whale after your first orders, and see [Triple Whale](/docs/campaigns/tracking/triple-whale). + + +## Mapping a click ID to Shopify + +This example puts the Google click ID and the Meta click ID on the Shopify order as metafields, so Shopify-side tools and your own reports can read them. None of it has been tested on a Shop Sync store. + +### gclid + +The SDK stores `gclid` as a top-level attribution field, so Shop Sync cannot see it. Copy it into attribution metadata on your funnel pages before the order is placed: + +```html title="Funnel page, for example checkout" + +``` + +`next.addMetadata(key, value)` merges one key into `attribution.metadata`. The script copies the value again on `cart:updated` as a precaution. SDK 0.4.38 to 0.4.43 can put a stale `fb_fbp` or `fb_fbc` value back on a cart update, and the starter templates' Meta adapter re-copies those two keys on `cart:updated` for that reason. The `window.nextReady.push` hook and `sdk.on('cart:updated', ...)` are the same calls that adapter uses. + +Then map it: + +1. In NEXT, add a metadata definition with object **Attribution**, key `gclid`, type **Text**. +2. In Shopify, add an **Orders** metafield definition of type single line text. +3. In Shop Sync, click **Add Metadata Sync** and map the NEXT `gclid` field to that Shopify metafield. + +### fbclid + +The SDK already stores `fbclid` in attribution metadata, so no script is needed. Add an **Attribution** metadata definition with key `fbclid` and type **Text**, a matching single line text **Orders** metafield in Shopify, and a metadata sync between them. The Shop Sync metadata guide lists `fb_fbc`, `fb_fbp`, `clickid` and `everflow_transaction_id` as other attribution keys you can map the same way. + +### Check it + +Place an order with a [test card](/docs/testing), then request fulfillment for it. Test orders are not sent to fulfillment automatically, so they reach Shopify only after a manual fulfillment request ([Test orders](https://docs.nextcommerce.com/docs/manage/orders/test-orders)). In Shopify, open the order, which is flagged as a test and tagged `NEXT`, and confirm the metafields hold the values from your landing URL. + +## Limits + +- Metafields are written once, when Shop Sync creates the Shopify order. A value added to the NEXT order later does not reach Shopify. +- Only `order` and `attribution` metadata can be mapped. Top-level attribution fields such as `utm_source` and `gclid` must be copied into metadata first, as in the `gclid` example. +- If you map `landing_page`, Shopify receives the checkout URL. The SDK replaces the landing page with the checkout URL when it creates the prospect cart. +- `fb_fbp` and `fb_fbc` can be empty on a first visit, because the SDK reads the Meta cookies once when a page loads. Empty values are not written. +- SDK 0.4.43 does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`, so they cannot be mapped. SDK 0.5.0 stores them in attribution metadata, which should make them mappable; this has not been checked. +- Coupon codes are not synced to the Shopify order, according to internal NEXT notes. Unconfirmed: not checked in Shop Sync source. +- Triple Whale's documentation expects Shopify product and variant IDs in pixel events. The funnel sends NEXT SKUs. The effect on matching is not known. +- Revenue differs by sender for the same order. The funnel's GA4 purchase `value` excludes tax and shipping, while the NEXT Meta Pixel app sends the order total including tax. +- More on what the SDK captures is in [Events and attribution](/docs/campaigns/tracking/events-and-attribution). Testing steps are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). diff --git a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx new file mode 100644 index 0000000..ae8dcf4 --- /dev/null +++ b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx @@ -0,0 +1,172 @@ +--- +title: Test and troubleshoot tracking +description: Place a safe test order on a NEXT Campaigns funnel, check what the SDK, template adapters and store apps sent 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 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; + +Use this page to test a funnel's tracking without polluting your reports, see what each part sent, and fix common problems. It describes a starter template funnel on SDK 0.4.43. The browser behaviour was checked with a test order on 2026-11-16. Vendor dashboards, the Meta Pixel app's server Purchase and Shop Sync were not checked, and the page says so where they come up. + +## Test safely + +### Build for production + +Build with `npm run build`. A `npm run dev` build leaves out all of the template's analytics markup: no vendor base pixels, no template analytics adapters and no noscript fallbacks. Testing tracking on a dev build shows nothing. + +### Choose the domain + +Every domain that serves the funnel must be added in the Campaigns app: open **Settings**, then **Global Settings**, then **Allowed Domains**, then **Add Domain**, and pick an **Environment**. Requests from a domain that is not on the list are not allowed. Both environments accept live orders. + +| Environment | NEXT campaign analytics | Vendor pixels and SDK providers | Use it for | +| --- | --- | --- | --- | +| **Production** | Recorded | Fire | The final check before launch, and any test that needs NEXT campaign analytics | +| **Development** | Ignored ("Analytics and event tracking are ignored for development domains") | Still fire. The SDK has no development-domain check, so Meta, GA4, TikTok, Triple Whale and the rest receive your test events | Building and checking pages without adding sessions to NEXT campaign analytics | + +A development domain does not protect your ad accounts. Treat every test on either domain as traffic the vendors will see. + +### Pay with a test card + +Pay with a [test card](/docs/testing). Test cards create **Test Orders** with no transactions, so no money moves. Store apps decide for themselves whether to send a test order: + +| Store app | Sends test orders? | Setting | +| --- | --- | --- | +| Meta Pixel (server Purchase) | Only when the setting is on | **Enable Sending Test Data** (the [merchant docs](https://docs.nextcommerce.com/docs/apps/meta-pixel) call it Enable Test Data) | +| Everflow | Only when both settings are on | **Enable Everflow S2S Postback** and **Enable S2S Postback for test orders**. See the [Everflow docs](https://docs.nextcommerce.com/docs/apps/everflow) | +| Klaviyo | Only when the setting is on | **Enable Sending Test Data**. See the [Klaviyo docs](https://docs.nextcommerce.com/docs/apps/klaviyo) | +| AppLovin AXON | No. **Skip Test Orders** is on by default | This app runs on the NEXT storefront only and does not load on funnels | +| Shop Sync | Creates the Shopify order flagged as a test, with the `NEXT` tag | Not checked in the 2026-11-16 test | + +The browser side does not look at test status. The SDK fires `dl_purchase` for any paid order, test or not, and the template analytics adapters forward it. A test order therefore sends a real-looking purchase, with its value, to every pixel on the funnel. Use each vendor's test tools where it has them (see [Debug tools](#debug-tools)), or exclude your own test traffic in the vendor's reports. + +### Turning tracking off with `?ignore=true` + +Adding `?ignore=true` to a funnel URL turns off all SDK analytics for that browser tab: no `dl_*` events, no SDK providers, no template analytics adapter traffic and no NEXT campaign analytics script. It is stored for the tab session and the SDK carries the parameter onto the next pages, so it stays on as you move through the funnel. Attribution is still captured and still sent on the order. + +To turn it back on, remove `ignore=true` from the URL and run `window.NextAnalyticsClearIgnore()` in the console, or open a new tab. `?reset=true` does not clear it. + + +With the flag on, the purchase event is never sent, so the test proves nothing. Use it only to browse your own funnel without creating events. + + +### Use a fresh browser profile or private window for each test + +The SDK remembers in the browser what it has already done, so a second test in the same browser behaves differently from a shopper's first visit: + +- It keeps the last 20 reported order numbers in `localStorage` (`nextDataLayer_reportedPurchases`) and never sends a purchase for those orders again. In the 2026-11-16 test, revisiting the upsell page sent no second `dl_purchase`. +- It keeps the shopper's email, phone and name in a cookie for 365 days, so later tests start with the checkout already filled in. +- It keeps the `evclid` value and the funnel name in `localStorage`, so they carry into later tabs. +- `?reset=true` clears less than its name suggests: stored `utm_*`, `gclid` and `evclid` values survive it, and so does the `?ignore=true` flag. + +Open a new private window or a clean browser profile for every test order, and close it when you are done. + +## Debug tools + +These tools apply to SDK 0.4.43 and the starter template analytics adapters. + + +SDK 0.5.0 has no `window.NextAnalytics.getStatus()`. Open its debug panel with `?debug=1` instead: the Analytics tab lists each event sent and the destinations it reached, and the Providers tab shows whether `?ignore=true` is on. On 0.5.0, `?ignore=false` turns tracking back on for the tab. This was not tested by NEXT. + + +### In the browser console + +| Tool | How to use | What it shows | +| --- | --- | --- | +| `window.NextDataLayer` | Type it in the console on any funnel page | Every `dl_*` event the SDK pushed on this page, with its `ecommerce`, `attribution`, `user_properties` and `campaign_*` fields. It fills up even when no provider is turned on | +| `window.NextAnalytics.getStatus()` | Run it in the console | `initialized`, `debugMode`, `providers` (the SDK providers that started: `nextCampaign`, `gtm`, `facebook`, `rudderstack`, `custom`), `eventsTracked` (the length of `window.NextDataLayer`) and `ignored` (`true` when `?ignore=true` is in force) | +| `next.getAttribution()` | Run it in the console on any funnel page | The attribution that will be sent with the order: the non-empty `utm_*` fields, `gclid`, `affiliate`, `subaffiliate1` to `subaffiliate5`, `funnel`, and `metadata` with `fbclid`, `fb_fbp`, `fb_fbc`, `fb_pixel_id`, `landing_page`, `sdk_version`, `user_ip` and the other captured keys | +| `next.debugAttribution()` | Run it in the console | The same attribution, printed as a grouped console summary | +| `?debugger=true` | Add it to the funnel URL | Opens the SDK debug overlay, whose Analytics panel shows delivery for each SDK provider. It also turns on verbose logging and the SDK's test mode (test card fill helpers). It is kept across the checkout redirect | +| `?debug=true` | Add it to the funnel URL | Prints the SDK's info, warning and debug log lines in the console. It does not open the overlay | +| `analytics.debug: true` | Set it in `window.nextConfig.analytics` in `assets/config.js` | Logs event validation in the console. Delivery does not change. The setting is saved in that browser's `localStorage`, so debug mode stays on after you remove it; clear the site data to turn it off | +| `?nfdebug=true`, then `NextForwarder.getStatus()` | Add the parameter to the URL, then run the call in the console | `[NextForwarder]` log lines, and one entry per template analytics adapter with `name`, `active`, `sent`, `contacts`, `allowed`, `blocked` and `contact`. Logging is on automatically on `localhost` and `127.0.0.1`. The `meta` entry appears only when `meta_advanced_matching_enabled` is on | +| `TriplePixel('State')` | Run it in the console | `Ready` when the Triple Whale pixel is installed. `TriplePixelData` shows `TripleName`, `plat` and `isHeadless`. See Triple Whale's [custom sales platform guide](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform) | + +### In the network panel + +Open your browser's developer tools, choose the network panel, and filter on the host for the platform you are checking. + +| Platform | Filter on | What you see | +| --- | --- | --- | +| NEXT Campaigns API | `campaigns.apps.29next.com` | Cart, prospect cart and order requests, and the NEXT campaign analytics script when the `nextCampaign` provider is on | +| Meta | `facebook.com/tr` | One request per event. On the purchase, `eid` is the event ID and `cd[order_id]` and `cd[value]` carry the order number and value | +| TikTok | `analytics.tiktok.com` | Pixel requests on each page | +| GA4 | `google-analytics.com/g/collect` | GA4 event requests | +| Triple Whale | `api.config-security.com` | Event requests sent to `/event` | +| Google Tag Manager | `googletagmanager.com/gtm.js` | The container load only. Events reach GTM as `window.dataLayer` pushes, not network requests | +| AppLovin Axon | `s.axon.ai` | The pixel script load | +| Taboola | `cdn.taboola.com` | The pixel script load | +| Northbeam | `j.northbeam.io` | The script load | +| RudderStack | `cdn.rudderlabs.com` | The SDK loader | + +### In the vendor's tools + +NEXT did not check any vendor dashboard in the 2026-11-16 test. These are the vendor tools to use. + +| Tool | How to use | What it shows | +| --- | --- | --- | +| Meta Pixel Helper | Meta's browser extension, open on a funnel page | The browser events the Meta pixel sent from that page. It does not show the server Purchase | +| Meta Events Manager Test Events | Open **Test Events** for your pixel in Events Manager | The events Meta receives while you test. The Meta Pixel app's server Purchase reaches Test Events only when **Enable Sending Test Data** is on and the order's attribution metadata carries `fb_test_code`, which the app passes as the test event code. You can add it before paying with, for example, `next.addMetadata('fb_test_code', 'TEST12345')`. This path was not tested | +| GA4 DebugView | In GA4, open **Admin**, then **DebugView**, or use Google Tag Assistant | The events GA4 received from your test session | +| GTM Preview | Start Preview mode in your GTM container and open the funnel URL | Each `dl_*` push to `window.dataLayer` and the tags that fired on it | +| Triple Whale Pixel Helper | Triple Whale's Chrome extension (beta). Use a real browser: the pixel does not send events from headless browsers | Whether the pixel is detected, the events it fires and their payloads | +| TikTok Events Manager | Open your pixel in TikTok Events Manager | The events TikTok received for the pixel | + +## Step-by-step check + +Run this on a production build in a fresh private window. On each page, check `window.NextDataLayer` and `NextForwarder.getStatus()` in the console and keep the network panel open. The expected results below are what the 2026-11-16 test order showed with Meta, GA4, TikTok and Triple Whale turned on. + +1. Open your first funnel page with UTM parameters and click IDs on the URL, for example `?utm_source=test&utm_medium=cpc&utm_campaign=tracking-test&utm_content=a&utm_term=b&gclid=TEST&fbclid=TEST&aff=AFF1&sub1=S1&nfdebug=true`. Expected: `next.getAttribution()` shows all five `utm_*` fields, `gclid`, `affiliate` set to `AFF1`, `subaffiliate1` set to `S1`, `funnel` (the campaign name when the URL has no `funnel` parameter), and `metadata.fbclid`. `fb_pixel_id` is filled when the Meta pixel is on the page. `ttclid` is not captured on SDK 0.4.43. +2. Go to checkout. Expected: the query string is still on the URL. `window.NextDataLayer` holds `dl_user_data`, `dl_cart_updated` and `dl_begin_checkout`, and the GA4, Meta and TikTok requests appear. A checkout that opens with a package already selected sends `dl_cart_updated` and no `dl_add_to_cart`. +3. Type an email, then a phone number. Expected: with `triplewhale_contact_enabled` on, Triple Whale receives a `Contact` event for each, before any purchase, and the `contacts` count for `triplewhale` in `NextForwarder.getStatus()` goes up. +4. Enter the shipping address and choose a shipping method. Expected: `dl_add_shipping_info`, a GA4 `add_shipping_info` request with `item_id` set to the product SKU, and a Meta `AddShippingInfo` custom event. +5. Pay with a test card. Expected: the checkout page itself sends no purchase. The browser moves to the next page with `ref_id` on the URL. +6. On the first page after payment (an upsell page, or the receipt if there is no upsell). Expected: `dl_purchase` with `transaction_id` and `event_id` set to the order number, for example `100041`, and `value` set to the item revenue with tax and shipping excluded. The Meta purchase request carries `eid=your-store-100041` when `storeName` is set to your store subdomain, plus `cd[order_id]` and `cd[value]`. TikTok and Triple Whale send their purchase on this page too. Reload the page: no second `dl_purchase`, and `localStorage` key `nextDataLayer_reportedPurchases` lists the order number. +7. Accept the upsell. Expected: on the next page, `dl_upsell_purchase` with `transaction_id` set to the order reference plus `-US1` and `value` set to the upsell line only. Triple Whale sends `UpsellPurchase` and TikTok sends another `Purchase`. Meta receives no event for the accepted upsell. +8. Open the order in the store dashboard, or fetch it from the Admin API. Expected: the order is marked as a Test Order and its attribution has the `utm_*` fields, `gclid`, `affiliate`, `subaffiliate1`, `funnel`, and `metadata.fbclid`. `metadata.landing_page` is the checkout URL, not your first funnel page, because checkout overwrites it. `fb_fbp` and `fb_fbc` are filled only when a real Meta pixel has set its cookies. +9. If the Meta Pixel app is installed and **Enable Sending Test Data** is on, wait about 10 minutes (**Enable Delay Order Confirmation**, on by default, holds the event to wait for order updates such as upsells) and look for the server Purchase in Meta. This step was not tested by NEXT. + +## Common problems + +| Symptom | Cause | Fix | +| --- | --- | --- | +| No vendor requests on any page | The funnel was built with `npm run dev`, which leaves out the analytics markup | Build with `npm run build` and deploy that build | +| No events at all, and `NextAnalytics.getStatus()` shows `ignored: true` | `?ignore=true` was used earlier in this tab | Remove it from the URL and run `window.NextAnalyticsClearIgnore()`, or open a new private window | +| `NextAnalytics.getStatus()` shows `initialized: false` and no `dl_user_data` | `window.nextConfig.analytics.enabled` is not `true`, or the `analytics` block is missing | Set `enabled: true` in `assets/config.js` | +| Checkout events appear but no `dl_user_data` or `dl_purchase` | `analytics.mode` is not `'auto'`. Any other value, including `'disabled'` or no value, starts no automatic tracking; `'disabled'` does not turn analytics off | Set `mode: 'auto'`. To turn analytics off, set `enabled: false` | +| GTM container loads but receives no `dl_*` events, or the Meta pixel loads but sends no events | The SDK provider is off. `analytics.providers.gtm.enabled` and `analytics.providers.facebook.enabled` are `false` in the template's `config.js`. The Meta provider is also skipped when `settings.pixelId` is empty | Set the provider's `enabled: true`. For Meta, also set `settings.pixelId` to the same ID as `fb_pixel_id`. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) and [Meta](/docs/campaigns/tracking/meta#set-up) | +| One vendor sends nothing | Its ID key in `_data/campaigns.json` is missing or empty | Add the ID to the campaign entry and rebuild | +| Requests go to a vendor you have not set up | A placeholder value was left in a vendor key. Any non-empty value turns the vendor on | Set the key to `""` or remove it | +| Cart and order requests to `campaigns.apps.29next.com` are rejected | The funnel domain is not in **Allowed Domains** | Add it in the Campaigns app under **Settings**, **Global Settings**, **Allowed Domains** | +| NEXT campaign analytics show no sessions or sales from the funnel | The domain is set to **Development**, where NEXT campaign analytics are ignored | Set the domain to **Production** before launch | +| Meta shows two PageView events per page | The pixel is also loaded through GTM with its own PageView tag, or a manual `fbq('track', 'PageView')` was added, while the SDK's Meta provider sends PageView from `dl_user_data` | Remove the extra PageView tag, or add `blockedEvents: ["dl_user_data"]` to `analytics.providers.facebook`. `blockedEvents` matches `dl_*` names exactly, so `"PageView"` blocks nothing. SDK 0.5.0 does not read `blockedEvents` | +| Meta counts each purchase twice | `storeName` is not set, so the browser Purchase has no event ID; or it is still the template's `'store-name'` or another value, so the ID does not match the Meta Pixel app's `your-store-100041` format; or a second server sender, such as a Shopify-side app, sends the same order to the same pixel | Set `window.nextConfig.storeName` to your store subdomain. Keep one server sender per pixel: Meta never deduplicates two server events. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place) | +| Meta never receives the server Purchase | The Meta Pixel app is not installed or has no pixel added; the order is a test order and **Enable Sending Test Data** is off; the order's `fb_pixel_id` does not match any pixel added in the app, in which case nothing is sent and there is no fallback; or the 10-minute delay has not passed | Install the app and add the pixel. Turn on **Enable Sending Test Data** for tests. Add every pixel your funnels load to the app. An empty `fb_pixel_id`, for example when the pixel is loaded through GTM, routes to the app's default pixel. Not tested by NEXT | +| Purchase value is lower than the order total | `dl_purchase` `value` is item revenue. Tax and shipping are sent separately and upsells arrive as separate events. The Meta Pixel app's server Purchase uses the order total including tax, so platforms report different revenue for the same order | Report on item revenue, or add `tax` and `shipping` from the event. See [Events and attribution](/docs/campaigns/tracking/events-and-attribution) | +| Upsell revenue is missing | Each platform receives `dl_upsell_purchase` differently: GA4 as a custom `upsell_purchase` event, Triple Whale as a custom `UpsellPurchase` event, TikTok as another `Purchase`. The SDK's Meta provider sends nothing for it | Follow the upsell section of each platform guide, for example [GA4](/docs/campaigns/tracking/google-analytics-4#purchases-revenue-and-upsells) and [Meta](/docs/campaigns/tracking/meta#purchases-revenue-and-upsells) | +| No purchase event after a test order | The shopper never loaded a page after payment, so `dl_purchase` was never built; or the order was already reported in this browser; or the page loaded with `payment_failed=true` | Load the upsell or receipt page. Use a fresh private window for every test | +| `fb_fbp` or `fb_fbc` is empty on orders | The SDK reads the `_fbp` and `_fbc` cookies once when a page loads and again when the checkout form starts. On a first visit the Meta pixel may not have set them yet, and on SDK 0.4.38 to 0.4.43 a cart update can put the empty value back. The SDK does not build `_fbc` from `fbclid`. A placeholder pixel ID never sets the cookies | Set `fb_pixel_id` in `_data/campaigns.json`: the template's Meta adapter then copies the cookies onto the attribution after they appear and on cart updates. Hand-built funnels have no workaround. Test with your real pixel ID. SDK 0.5.0 has the same limit | +| `ttclid`, `msclkid`, `gbraid` or `wbraid` is missing on orders | SDK 0.4.x does not store them. It only carries them on the URL to later pages | SDK 0.5.0 stores them in the order's attribution metadata. TikTok's own pixel also sets a first-party `ttclid` cookie, so TikTok can read the click ID in the browser | +| Triple Whale shows no attributed sales | Triple Whale attributes an order only when it gets both a pixel purchase and a matching order record. A store without Shopify sends it no order record. On Shop Sync stores the result depends on how the Shopify connection and the funnel purchase are set up | See [Triple Whale](/docs/campaigns/tracking/triple-whale#attribution-requirements) | +| A store app you installed does nothing on the funnel | The TikTok Pixel Events, Google Analytics 4, Google Tag Manager, AppLovin AXON and Taboola apps load on the NEXT storefront only | Use the template analytics adapter keys or the SDK providers. See [Supported integrations](/docs/campaigns/tracking#supported-integrations) | +| Attribution is lost when the shopper moves between domains or tabs | The SDK keeps attribution in the tab's session storage, which pages on another domain cannot read, and a new tab starts over. Only `evclid` and the funnel name are kept across tabs | Keep every funnel page on one domain. If you must link to another domain, turn on `window.nextConfig.utmTransfer` with `enabled: true` and `applyToExternalLinks: true`, which copies the URL parameters onto links when they are clicked | +| GTM tags built for a Shopify or Elevar data layer read empty values | The SDK pushes its own `dl_*` events unchanged to `window.dataLayer` and `window.ElevarDataLayer`. The event names look familiar but the payload is the SDK's: attribution sits under `attribution` (for example `attribution.utm_source`), not at the root | Rebuild the tags on the SDK's payload. Listen to one array only: a tag on both sees every event twice. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | +| Every GA4 event is counted twice | GA4 is loaded by the template adapter and also by GTM or a page script | Send GA4 from one place. See [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#browser-and-server-events) | +| The order's attribution shows `utm_source` `konami_code` | The order was placed with the SDK's debug test-order tool, which replaces the real attribution with test values | Place test orders through the normal checkout form with a test card | + +## Get help + +Before you ask for help, collect: + +- The order number of the test order. +- The full funnel URL you opened first, including its query string. +- The SDK version: `sdk_version` in `_data/campaigns.json`, or `metadata.sdk_version` from `next.getAttribution()`. +- Whether the domain is set to **Development** or **Production** in **Allowed Domains**. +- The output of `NextForwarder.getStatus()` and `window.NextAnalytics.getStatus()` on the page where the problem shows. +- A network capture from the browser's network panel, covering the page where the event should have fired. +- For server events, which store apps are installed and how their test-order settings are set. + +`window.NextDataLayer` events and network captures include the shopper's email, phone, name and address. Use test details when you reproduce a problem, and remove real customer data before you share a capture. diff --git a/content/docs/campaigns/tracking/tiktok.mdx b/content/docs/campaigns/tracking/tiktok.mdx new file mode 100644 index 0000000..893e606 --- /dev/null +++ b/content/docs/campaigns/tracking/tiktok.mdx @@ -0,0 +1,209 @@ +--- +title: TikTok +description: Send NEXT Campaigns funnel product views, checkout steps, purchases and upsells to a TikTok pixel with the starter template TikTok adapter, keep the TikTok click ID on the order, and check the events arrive. +sidebar_label: TikTok +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| Setting `tiktok_pixel_id` loads the TikTok pixel and the TikTok adapter on every funnel page | Verified | Starter template source, and a production build of the Olympus template | 2026-11-16 | 0.4.43 | +| The adapter sends funnel events to TikTok on the checkout, upsell and receipt pages | Verified | Test order, `analytics.tiktok.com` requests and the adapter's sent counts observed in the browser | 2026-11-16 | 0.4.43 | +| An accepted upsell is sent as a second `Purchase` with its own event ID | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | +| The SDK does not store `ttclid` on the NEXT order | Verified | SDK source, and the test order's attribution read back | 2026-11-16 | 0.4.43 | +| TikTok's own pixel sets a first-party `ttclid` cookie | Verified | Observed in the browser during the test order | 2026-11-16 | 0.4.43 | +| Advanced matching sends email and phone with `ttq.identify` on the prospect cart | Unconfirmed | Starter template source only | | 0.4.43 | +| Capturing `ttclid` on the order with `next.addMetadata` | Unconfirmed | SDK source only; the snippet was not run in the test | | 0.4.43 | +| SDK 0.5.0 stores `ttclid` on the order by itself | Unconfirmed | SDK source only | | 0.5.0 | +| Events appear in TikTok Events Manager and attribute to ads | Unconfirmed | Not checked: the test used a placeholder pixel ID | | | +| How TikTok's Shopify integration treats orders pushed by Shop Sync | Unconfirmed | Not documented and not tested | | | +| Server-side TikTok events for campaign orders | Not supported | No NEXT app sends TikTok events from the server | 2026-11-16 | | + +The browser side was checked with a placeholder pixel ID, so what TikTok does with the events after it receives them, including attribution and deduplication, was not checked. + +## What it does + +The TikTok adapter loads TikTok's pixel with your pixel ID on every funnel page and sends the SDK's funnel events to it as TikTok standard events. It covers presell, landing, checkout, upsell and receipt pages. It runs in the browser only. + +NEXT does not send TikTok events from the server. The **TikTok Pixel Events** store app does not help here either: it loads on your NEXT storefront only, runs in the browser only, and does not reach campaign funnels. + +## Before you start + +- A TikTok pixel. Copy its pixel ID from TikTok Events Manager, under **Data sources**. +- A funnel built from a starter template. The adapter ships with every template family except `landing`. +- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. +- If you plan to turn on advanced matching, check that your privacy policy and consent handling cover sending the shopper's email and phone to TikTok. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). + +## Set up + + + + +1. Open `_data/campaigns.json` and find the entry for your campaign. +2. Add your pixel ID: + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX" + } +} +``` + +3. Optional: add `"tiktok_advanced_matching_enabled": "true"` to send the shopper's email and phone to TikTok. The adapter also accepts `"1"` and `"yes"`. +4. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds, so tracking does not load in the development server. +5. Deploy, then follow [Verify it works](#verify-it-works). + +The key is off when it is absent or empty. Any other value, including a placeholder, loads the pixel. Do not also add a TikTok pixel in Google Tag Manager or in the page for the same pixel ID. Two paths send every event twice. + + + + +The TikTok adapter is documented for starter templates only. It was not tested on a hand-built page, and it is not published as a standalone package. On a hand-built funnel, send the SDK's `dl_*` events to TikTok from your own Google Tag Manager container instead. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). + + + + +## Events sent + +The pixel sends a page view with `ttq.page()` on every page load. On top of that, the adapter forwards these SDK events by default: + +| SDK event | TikTok event | When it fires | +| --- | --- | --- | +| `dl_view_item` | `ViewContent` | A page shows a package | +| `dl_add_to_cart` | `AddToCart` | An item is added to the cart | +| `dl_begin_checkout` | `InitiateCheckout` | The checkout form loads | +| `dl_add_payment_info` | `AddPaymentInfo` | Payment details are complete | +| `dl_purchase` | `Purchase` | The first page after payment | +| `dl_upsell_purchase` | `Purchase` | The page after an upsell is accepted | + +Each event is sent with `ttq.track(name, properties, { event_id })`. A checkout that opens with a package already selected sends no `AddToCart`, because the SDK emits no `dl_add_to_cart` for it. + +To send fewer events, add `tiktok_blocked_events` with a comma-separated list, for example `"tiktok_blocked_events": "dl_add_payment_info"`. You can use `dl_*` names or TikTok names. A TikTok name matches every SDK event mapped to it, so blocking `Purchase` blocks both the order and the upsell purchase. To send more, list them in `tiktok_allowed_events`, or use `"all"` to send every event the adapter can map, which adds `Search` (`dl_view_search_results`), `CompleteRegistration` (`dl_sign_up`) and `Subscribe` (`dl_subscribe`). A list in `tiktok_allowed_events` replaces the default set rather than adding to it. + +### Advanced matching + +With `tiktok_advanced_matching_enabled` on, the adapter calls `ttq.identify` with the shopper's email and `phone_number`. It does this only when the SDK creates the prospect cart, which happens once per session when the checkout has a valid email or phone, a first and last name, and items in the cart. It does not fire as the shopper types. + +| Detail | Behaviour | +| --- | --- | +| Values sent | The raw email, and the phone in E.164 format (`+` and country code). A phone without a country code is not sent | +| Marketing checkbox | If the checkout has an accepts-marketing checkbox and it is unchecked, nothing is sent. If the page has no such checkbox, the call is not blocked | + +## Attribution requirements + +TikTok's click ID is the `ttclid` parameter on your ad's landing URL. Keep it there, and do not strip query strings on your landing pages. In the test order, TikTok's own pixel read `ttclid` from the landing URL and stored it in a first-party cookie, so TikTok can still read the click ID on later pages. Keep every funnel page on the same domain, or on subdomains of one domain, so that cookie is available on the checkout, upsell and receipt pages. + +The NEXT order is a separate matter. SDK 0.4.43 does not store `ttclid` in the order's attribution: it carries the parameter from page to page in the URL, but it never saves it. That does not stop the pixel from attributing, but it means you cannot see the TikTok click ID on the order, export it, or send it from a server of your own. SDK 0.5.0 stores `ttclid` in the order's attribution metadata by itself (from the 0.5.0 source; not tested). + +### Keep ttclid on the order with SDK 0.4.x + +On SDK 0.4.x you can copy the click ID into the order's attribution metadata yourself with `next.addMetadata`. Add this script to every funnel page, for example in each page layout under `_layouts/`, after the SDK loader: + +```html title="_layouts/base.html" + +``` + +Run it on the checkout page as well as the landing page. The checkout re-reads attribution when it loads, and the order is created from that page. This snippet was not run in NEXT's test order, so check it before you rely on it: on the checkout page, `next.getAttribution().metadata.ttclid` should show the value, and the order's attribution metadata should carry it. On a Shop Sync store you can then copy it to a Shopify order metafield the same way as the other click IDs in the [Shop Sync metadata guide](https://guides.nextcommerce.com/guides/shop-sync-metadata). + +## Purchases, revenue and upsells + +| Field | Order purchase | Upsell | +| --- | --- | --- | +| TikTok event | `Purchase` | `Purchase` | +| `event_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | +| `value` | Item revenue, excluding shipping and, on tax-exclusive stores, tax | The upsell line only | +| `currency` | The order currency | The order currency | + +The order purchase also carries `content_type: 'product'`, a `contents` list (`content_id`, `content_name`, `content_category`, `brand`, `price`, `quantity`) and `query` set to the coupon code when one was used. + +TikTok has no separate upsell event in this adapter. Each accepted upsell arrives as another `Purchase` with its own event ID, so TikTok's purchase count includes upsells: an order with two accepted upsells counts as three purchases. If you want TikTok to count one purchase per order, add `"tiktok_blocked_events": "dl_upsell_purchase"`. Upsell revenue then does not reach TikTok. + +## Browser and server events + +TikTok receives browser events only. No NEXT app sends TikTok events from the server for campaign orders: the **TikTok Pixel Events** store app is storefront-only and browser-only, and NEXT has no TikTok Events API sender. There is nothing to deduplicate, so the only duplicate risk is a second TikTok pixel on the same pages. + +TikTok should receive each purchase once, from one sender, and for a NEXT funnel that sender is the funnel pixel unless you deliberately add another. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +### If you add your own Events API sender + +TikTok deduplicates a pixel event and an Events API event only when both carry the same event name and the same `event_id`, within 48 hours of the first. It keeps the first one it receives. Deduplication is not needed when the pixel and the Events API send different events. See [TikTok event deduplication](https://ads.tiktok.com/resources/help/article/event-deduplication?lang=en). + +So a server `Purchase` you send yourself must use the same `event_id` as the pixel: + +- Order purchase: the NEXT order number, for example `100041`. +- Upsell purchase: the order reference plus `-US1`, `-US2` and so on. + +The adapter passes the SDK's `event_id` for every event. A code comment in the adapter says purchases use `transaction_id`; in practice they are the same value, because the SDK sets a purchase's `event_id` to its `transaction_id`, and the test order showed both as the order number. Non-purchase events get a random `event_id` generated in the browser, so a server cannot reproduce it. Send only `Purchase` from the server, or block the matching browser events. + +The TikTok Pixel Events store app uses a different purchase ID format on the storefront: your store subdomain, a hyphen and the order number, for example `your-store-100041`. That format does not apply to funnels, and the funnel adapter does not use it. + +### Shop Sync stores + +NEXT has not confirmed whether TikTok's Shopify integration reports orders that Shop Sync pushes into Shopify. Those orders are tagged `NEXT` and carry no UTM parameters or click IDs unless you map them. If your Shopify-side TikTok setup does report them, TikTok can get each purchase twice: once from the funnel pixel and once from Shopify. Pick one sender. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). + +## Worked example + +A campaign that sends TikTok with advanced matching on, counts one purchase per order, and keeps the TikTok click ID on the order with the snippet from [Attribution requirements](#attribution-requirements): + +```json title="_data/campaigns.json" +{ + "summer-offer": { + "name": "Summer Offer", + "sdk_version": "0.4.43", + "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX", + "tiktok_advanced_matching_enabled": "true", + "tiktok_blocked_events": "dl_upsell_purchase" + } +} +``` + +With this setup, a shopper who clicks a TikTok ad, buys one package and accepts one upsell sends: page views on every page, `ViewContent` where a package is shown, `InitiateCheckout` when the checkout loads, one `identify` call when the prospect cart is created (if the marketing checkbox allows it), `AddPaymentInfo`, and one `Purchase` with the order number as `event_id` on the first page after payment. No `Purchase` is sent for the upsell. + +## Verify it works + +1. Open a funnel page on your production domain with `?ttclid=test&nfdebug=true` added to the URL. Do not add `?ignore=true`, which turns all tracking off for the browser tab. +2. In the browser console, run `NextForwarder.getStatus()`. The `tiktok` entry should show `active: true`, and `sent` should increase as you move through the funnel. +3. In the browser's network panel, filter for `analytics.tiktok.com`. You should see pixel requests on every page. +4. Place a test order with a [test card](/docs/testing). On the upsell or receipt page the TikTok entry's `sent` count should include the `Purchase`. Accept an upsell and you should see another `Purchase` on the next page, unless you blocked `dl_upsell_purchase`. +5. If you added the `ttclid` snippet, run `next.getAttribution().metadata.ttclid` on the checkout page before you pay. It should return `test`. +6. In TikTok Events Manager, check that the events arrive for your pixel. NEXT has not checked this step. + + +The adapter does not skip test orders. A test-card order that reaches the upsell or receipt page sends a real `Purchase` to the pixel ID in your campaign. Place test orders before you switch to your live pixel ID, or expect them in your TikTok reports. + + +More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Troubleshooting and limits + +| Symptom | Likely cause | Fix | +| --- | --- | --- | +| No TikTok requests at all | Built with `npm run dev`, `tiktok_pixel_id` empty, or `?ignore=true` set earlier in the tab | Build with `npm run build`; check the key; open a new tab without `?ignore=true` | +| Every event counted twice | TikTok also loaded by GTM or a page script | Remove the other TikTok pixel | +| More purchases in TikTok than orders | Accepted upsells are sent as extra `Purchase` events | Expected; block `dl_upsell_purchase` if you want one purchase per order | +| No `AddToCart` | The checkout opened with a package already selected | Expected; the SDK sends no add-to-cart event for a preselected package | +| No `identify` call | Advanced matching is off, the marketing checkbox is unchecked, or the prospect cart was never created (missing name, email or phone, or empty cart) | Check the key and the checkout fields | +| No `Purchase` after a test order | The shopper never reached a page after payment, or the order was already reported in that browser | Load the upsell or receipt page; use a fresh browser profile for each test | +| `ttclid` missing on the NEXT order | SDK 0.4.x does not store it | Add the `ttclid` snippet, or move to SDK 0.5.0 | + +- TikTok receives no event for subscription renewals or other orders created without a funnel visit. +- Accepting an upsell bundle of several items through the accept-upsell button sends one upsell event per item, each valued at the whole bundle total (SDK 0.4.43 source). On TikTok that becomes several `Purchase` events with inflated revenue. Block `dl_upsell_purchase` if your funnel offers bundles as upsells. +- The **TikTok Pixel Events** store app does not load on campaign funnels and has no setting to skip test orders. Do not rely on it for funnel tracking. +- On SDK 0.5.0, `ttclid` reaches the order and the `dl_*` events, but not the SDK's own tracking-event attribution (from the 0.5.0 source; not tested). diff --git a/content/docs/campaigns/tracking/triple-whale.mdx b/content/docs/campaigns/tracking/triple-whale.mdx new file mode 100644 index 0000000..889f70f --- /dev/null +++ b/content/docs/campaigns/tracking/triple-whale.mdx @@ -0,0 +1,243 @@ +--- +title: Triple Whale +description: Load the Triple Whale pixel on NEXT Campaigns funnel pages with the starter template adapter, see exactly which events it sends, and learn why Triple Whale can show no sales for funnel orders on stores with Shop Sync and on stores without Shopify. +sidebar_label: Triple Whale +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; +import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; + +## Verification status + +| Claim | Status | How it was checked | Date | SDK | +| --- | --- | --- | --- | --- | +| Setting `triplewhale_name` loads the headless Triple Pixel on every funnel page; `TriplePixel('State')` returns `Ready` | Verified | Starter template source, and a production build of the Olympus template with a placeholder TripleName | 2026-11-16 | 0.4.43 | +| With `triplewhale_contact_enabled` on, `Contact` fires when an email is entered and again when a phone number is entered | Verified | Test order, adapter counts and console checks in the browser | 2026-11-16 | 0.4.43 | +| `Purchase` is sent on the first page after payment, and `UpsellPurchase` on the page after an accepted upsell | Verified | Test order with an accepted upsell; adapter `sent` counts and requests to `api.config-security.com` observed | 2026-11-16 | 0.4.43 | +| The `Purchase` and `UpsellPurchase` fields listed in [Events sent](#events-sent) | Partial | The SDK purchase values (order number, value) were observed in the test order. The field names come from source; the Triple Whale request bodies were not inspected | 2026-11-16 | 0.4.43 | +| `AddToCart` is sent once per cart item | Unconfirmed | Source only. The test checkout opened with a preselected bundle, which sends no add-to-cart event | 2026-11-16 | 0.4.43 | +| `triplewhale_blocked_events` stops the funnel purchase events | Unconfirmed | Source only, not tested | 2026-11-16 | 0.4.43 | +| Triple Whale attributes funnel orders on a Shop Sync store with funnel purchases blocked and Contact on | Unconfirmed | Not checked: no Shop Sync store or Triple Whale account was used | | | +| Triple Whale attributes funnel orders on a Shop Sync store with the pixel `Purchase` left on | Unconfirmed | Not checked: no Shop Sync store or Triple Whale account was used | | | +| Triple Whale attributes funnel orders on a store without Shopify | Not supported | Triple Whale requires an order record, and NEXT sends none to Triple Whale | | | +| Triple Whale Sonar and the Meta Pixel app both send the order to Meta | Unconfirmed | Triple Whale documentation and NEXT app source only | | | + +The test used a placeholder TripleName and no Triple Whale account, so nothing inside Triple Whale was checked: not whether it accepted the events, not attribution, and not Sonar. + +## What it does + +The Triple Whale adapter in the starter templates loads Triple Whale's headless Triple Pixel on every funnel page (presell, landing, checkout, upsell and receipt) and sends add-to-cart, purchase and upsell events from the shopper's browser. With one setting turned on it also sends the shopper's email and phone as a `Contact` event. NEXT sends nothing to Triple Whale from its servers. + + +Triple Whale attributes an order only when it receives both a pixel purchase and a matching order record, according to its [guide for custom sales platforms](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform). The funnel supplies the pixel events. The order record has to come from somewhere else. + +- On a store with Shop Sync, where Triple Whale is connected to that Shopify store, the synced Shopify order is the order record. NEXT has not confirmed which funnel configuration makes Triple Whale match it. See [Attribution requirements](#attribution-requirements). +- On a store without Shopify, Triple Whale receives the pixel events but no order record, because NEXT does not send orders to Triple Whale's Orders API. Triple Whale attribution for funnel orders is not supported on these stores today. + + +## Before you start + +- A Triple Whale account. Know whether it is connected to a Shopify store that receives your orders through Shop Sync, because the setup and the outcome differ. +- A funnel built from a starter template. The adapter ships with every template family except `landing`. +- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. +- On a Shop Sync store, Shop Sync set up so that campaign orders reach Shopify with the `NEXT` tag. See the [Shop Sync onboarding guide](https://guides.nextcommerce.com/guides/shop-sync-onboarding) and [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). +- If your funnel sends a Content Security Policy, allow `api.config-security.com` and `conf.config-security.com` and allow `eval()`. The Triple Pixel needs both. + +## Set up + + + + +1. In Triple Whale, open **Settings**, then **Business Configurations**, then **Pixel Settings**, and select the **Pixel Installation** tab. +2. Save a **Shopify Headless** Account Setup. Triple Whale's [headless installation guide](https://kb.triplewhale.com/en/articles/6266255-how-to-add-the-triple-pixel-to-a-headless-business-or-custom-website) requires this before it shows the **Headless Installation** snippet under **Recommended installation for your business**. NEXT has not checked which Account Setup to choose for a Triple Whale account without Shopify. +3. In the **Headless Installation** snippet, find `TriplePixelData` and copy the `TripleName` value. For an account connected to Shopify it is your myshopify.com domain, for example `your-store.myshopify.com`. Note the `plat` value in the same object. +4. Do not paste the snippet into your pages. The template already contains the headless snippet and fills in your values. Pixel Settings also offers a Third-Party Landing Page script and a Third-Party/Custom Checkout script for thank-you pages. Do not add either one to the funnel. +5. Open `_data/campaigns.json` and add the keys to your campaign's entry: + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "triplewhale_name": "your-store.myshopify.com", + "triplewhale_platform": "SHOPIFY", + "triplewhale_contact_enabled": "true" + } +} +``` + +6. On a Shop Sync store, decide whether to block the funnel purchases. See [Stores with Shop Sync](#attribution-requirements) and test both options with the [Worked example](#worked-example). +7. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds. +8. Deploy, then follow [Verify it works](#verify-it-works). + +| Key | Value | What it does | +| --- | --- | --- | +| `triplewhale_name` | Your TripleName | Turns the adapter on. Empty or missing turns it off. Any non-empty value goes live, including a placeholder | +| `triplewhale_platform` | `SHOPIFY` for a Triple Whale account connected to Shopify. Leave it out on other stores to use the template default, `custom-msp` | Sets `plat` in `TriplePixelData`. Triple Whale says `plat` defaults to Shopify when it is missing and that a wrong value may send data to the wrong shop. Match the `plat` in your Triple Whale snippet | +| `triplewhale_contact_enabled` | `"true"` (`1` and `yes` are also accepted) | Sends `Contact` with the shopper's email or phone. Off unless set | +| `triplewhale_allowed_events` | Comma-separated event names | Sends only these events. Empty means the default set | +| `triplewhale_blocked_events` | Comma-separated event names, for example `"dl_purchase, dl_upsell_purchase"` | Stops these events. Applied after the allowed list | + + +With `triplewhale_contact_enabled` on, the adapter sends the shopper's email and phone to Triple Whale unhashed, as soon as each is entered. It is not tied to the newsletter checkbox on the checkout. Turn it on only when your privacy policy and consent handling cover it. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). With it off, the adapter reads no personal data. + + + + + +The Triple Whale adapter is documented for starter templates only. It was not tested on a hand-built page and is not published as a standalone package. NEXT has no tested Triple Whale path for hand-built funnels; the tested path is a [starter template](/docs/campaigns/templates). + + + + +## Events sent + +| Triple Whale event | When it is sent | Sent by | Fields | +| --- | --- | --- | --- | +| Page load | Every page load | The headless snippet itself. Triple Whale has no page view call, so the adapter does not send one | Captured by Triple Whale | +| `AddToCart` | An item is added to the cart (`dl_add_to_cart`) | Adapter, one call per cart item | `item` = product SKU, `q` = quantity, `v` = NEXT variant ID (the SKU when there is none) | +| `Contact` | A valid email or phone is entered at checkout, and when the prospect cart is created. Only with `triplewhale_contact_enabled` on | Adapter | `email` or `phone`, or both | +| `Purchase` | The first page after payment (`dl_purchase`) | Adapter | `orderId`, `value`, `currency`, `lineItems` | +| `UpsellPurchase` (custom event) | The page after an upsell is accepted (`dl_upsell_purchase`) | Adapter | `orderId`, `value`, `currency` | + +- `Contact` is sent once per email address and once per phone number on each page load. The phone is sent in international format starting with `+` when the checkout knows the country code. The adapter never guesses a dial code; without one, no phone is sent. +- A checkout that opens with a package already in the cart sends no `dl_add_to_cart`, so no `AddToCart` is sent for that package. +- The adapter maps only these three events from the SDK (`AddToCart`, `Purchase`, `UpsellPurchase`), and all three are in the default set. Setting `triplewhale_allowed_events` to `"all"` adds nothing; the allowed and blocked lists are only useful for sending fewer. Use the `dl_` names in both lists. +- Triple Whale also documents checkout events (`checkoutStarted`, `contactSubmitted`, `addressSubmitted`, `shippingSubmitted`, `paymentSubmitted`) and a `NewSubscription` event. The template sends none of them. + +## Attribution requirements + +Triple Whale's documentation treats `Purchase` as the event that drives attribution, and says a purchase event alone is not enough: Triple Whale must also receive a matching order record. Stores on Shopify get that record through Shopify; custom sales platforms send it through Triple Whale's Orders API. See the [guide for custom sales platforms](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform) and the [headless installation guide](https://kb.triplewhale.com/en/articles/6266255-how-to-add-the-triple-pixel-to-a-headless-business-or-custom-website). + +The template's `Purchase` does not carry everything Triple Whale lists: + +| Triple Whale documents for `Purchase` | The template sends | +| --- | --- | +| `orderId`, required | The NEXT order number | +| Email or phone, required | Neither. Identity comes only from the separate `Contact` event, when it is turned on | +| `lineItems`, required, with product and variant IDs (Triple Whale's examples use Shopify IDs) | `lineItems` with the NEXT SKU as `i` and the NEXT variant ID as `v` | +| `address`, required in the help center guide and optional in the developer guide | Not sent | +| `eventId` and `cotkn`, optional | Not sent | +| A matching order record | Nothing from NEXT. On a Shop Sync store, the synced Shopify order | + +NEXT has not tested what Triple Whale does with a purchase that lacks these fields. Triple Whale's own troubleshooting advice for missing attribution is to make sure the purchase event includes every required field. + +### Stores with Shop Sync + +Shop Sync creates a Shopify order for each campaign order when the order is sent to fulfillment. The Shopify order carries the `NEXT` tag, the buyer's email and phone, and the NEXT order number as its PO number. It carries no UTM parameters or click IDs. If your Triple Whale account is connected to that Shopify store, Triple Whale receives this order as its order record. + +Two funnel configurations exist. NEXT has not confirmed which one gives correct attribution, so neither is a default. + +| | Funnel purchases blocked, Contact on | Pixel `Purchase` left on | +| --- | --- | --- | +| Keys | `"triplewhale_platform": "SHOPIFY"`, `"triplewhale_contact_enabled": "true"`, `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"` | `"triplewhale_platform": "SHOPIFY"`, `"triplewhale_contact_enabled": "true"`, no blocked events | +| How the order is meant to reach the ad | Triple Whale ingests the Shopify order, and the `Contact` event ties the shopper's session to it by email or phone | The pixel `Purchase` plus the Shopify order, as Triple Whale's guides describe | +| Why you might choose it | The starter template notes recommend it, to avoid counting each order twice | It follows Triple Whale's statement that `Purchase` is required for attribution | +| Risk | Triple Whale's documentation does not describe this pattern. Buyers who never type an email or phone into the form send no `Contact` | The pixel `orderId` is the NEXT order number and its line items carry NEXT IDs, so it may not match the Shopify order. Triple Whale may record a second, unmatched order | +| Status | Unconfirmed | Unconfirmed | + +Test both in your own Triple Whale account before you rely on either. The [Worked example](#worked-example) shows how. + + +`Contact` fires when the shopper types an email or phone into the checkout form, or when a prospect cart is created from those fields. A buyer who pays with Apple Pay, Google Pay or PayPal may never type either one, so no `Contact` is sent for them. The template does not handle express wallets for Triple Whale. With funnel purchases blocked, Triple Whale then has nothing from the funnel that ties that order to the session. + + +### Stores without Shopify + +On a NEXT store without Shopify, Triple Whale attribution for funnel orders is not supported. Triple Whale receives the page loads, `AddToCart`, `Contact`, `Purchase` and `UpsellPurchase` from the funnel, but no order record, because NEXT does not send orders to Triple Whale's Orders API. Expect Triple Whale to show no attributed sales for these orders. NEXT has not documented or tested a way to send NEXT orders to that API. + +## Purchases, revenue and upsells + +| Field | Order purchase | Upsell | +| --- | --- | --- | +| Event | `Purchase` | `UpsellPurchase`, sent as `TriplePixel('custom', 'UpsellPurchase', ...)` | +| `orderId` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | +| `value` | Item revenue, excluding tax and shipping | The upsell line only | +| `currency` | The order currency | The order currency | +| `lineItems` | One entry per item: `i` (SKU), `q` (quantity), `v` (variant ID) | None. Custom events are kept to flat values | + +The upsell is a custom event so that Triple Whale's purchase count stays at one per order. Triple Whale lets you mark custom events as conversion events in its settings. NEXT has not confirmed how Triple Whale reports `UpsellPurchase` revenue. + +On a Shop Sync store, an accepted upsell is added to the same NEXT order, so it is part of the Shopify order Shop Sync creates. Triple Whale's order record for that sale therefore includes the upsell. On a store without Shopify there is no order record, for the first sale or the upsell. + +## Browser and server events + +The funnel sends Triple Whale browser events only. No NEXT app sends Triple Whale events from the server. On a Shop Sync store, Triple Whale also receives the synced Shopify order through its Shopify connection, which is a second source for the same sale. + +Every platform should receive each purchase from one place. Decide which sender reports the purchase for each platform before you launch; see [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +### Sonar and the Meta Pixel app + +If you use Triple Whale Sonar to send purchase events to Meta, and the NEXT Meta Pixel app also sends its server `Purchase` for the same order, Meta receives the order twice from two servers. Meta does not deduplicate two server events ([Meta deduplication guide](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)). The Meta Pixel app sends its server `Purchase` for campaign orders. Exclude orders tagged `NEXT` from Sonar if your Sonar setup allows it, or send the Meta purchase from only one of the two. NEXT has not tested Sonar with funnel orders, so treat this as Unconfirmed. See [Meta](/docs/campaigns/tracking/meta) for the Meta side. + +Triple Whale's [Sonar guide for headless Shopify stores](https://kb.triplewhale.com/en/articles/9548187-sonar-setup-for-headless-shopify-stores) also asks for `checkoutStarted` and `paymentSubmitted` on the checkout. The template does not send them, so Sonar's checkout and payment signals get nothing from the funnel. + +## Worked example + +A Shop Sync store with Triple Whale connected to its Shopify store, testing both configurations. + +Start with funnel purchases blocked: + +```json title="_data/campaigns.json" +{ + "summer-offer": { + "name": "Summer Offer", + "sdk_version": "0.4.43", + "triplewhale_name": "your-store.myshopify.com", + "triplewhale_platform": "SHOPIFY", + "triplewhale_contact_enabled": "true", + "triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase" + } +} +``` + +1. Build with `npm run build` and deploy. +2. In a fresh browser profile, open your landing page with UTM parameters you will recognize, for example `?utm_source=tw-test&utm_medium=test&utm_campaign=tw-test-a`. +3. Type an email address in the checkout form and place an order. +4. Check that the order reached Shopify with the `NEXT` tag. A [test order](https://docs.nextcommerce.com/docs/manage/orders/test-orders) is created in Shopify marked as a test, and test orders are not sent to fulfillment automatically. If it does not appear, request fulfillment on it in NEXT. NEXT has not confirmed whether Triple Whale counts Shopify test orders; if it does not, repeat the test with a real order. +5. In Triple Whale, find the order, using the buyer's email or the Shopify order. Note whether it is attributed to your test source or shows as unattributed, and whether it appears once or twice. +6. Remove `triplewhale_blocked_events`, rebuild and redeploy. Repeat steps 2 to 5 with a new browser profile, a different email address and `utm_campaign=tw-test-b`. +7. Keep the configuration that gives one attributed order per sale. + +| What you see in Triple Whale | What it suggests | +| --- | --- | +| One order, attributed to your test source | That configuration attributes on your account | +| One order, unattributed | The Shopify order arrived, but Triple Whale did not tie it to the funnel session | +| Two orders for one sale | The pixel `Purchase` was recorded as a separate order from the Shopify order | +| No order | The Shopify order was not created yet, or Triple Whale is not connected to that Shopify store | + +## Verify it works + +1. Open a funnel page on your production domain with `?nfdebug=true` added to the URL. Do not add `?ignore=true`, which turns all tracking off for the browser tab, and never use it when you are proving a purchase. +2. In the browser console, run `TriplePixelData`. It should return an object with your `TripleName`, your `plat` value and `isHeadless: true`. `undefined` means the pixel is not installed or the page is a cached copy. +3. Run `TriplePixel('State')`. It should return `"Ready"`. +4. Run `NextForwarder.getStatus()`. The `triplewhale` entry should show `active: true`. With Contact on, `contact` is not `null`. `blocked` shows any events you blocked. +5. Type an email on the checkout. With Contact on, `contacts` in the `triplewhale` entry should go up. +6. Place a test order with a [test card](/docs/testing). On the first page after payment, `sent` should go up for `Purchase` (unless you blocked it), and you should see a request to `api.config-security.com`. Accept an upsell and `UpsellPurchase` is sent on the next page. +7. For a visual check, use Triple Whale's Pixel Helper Chrome extension in a normal Chrome window. It does not report from headless or automated browsers. +8. In Triple Whale's Pixel Settings, "Online Store: Not Installed" is expected for a headless install. That check looks only at the Shopify theme app embed. + +These steps prove the events leave the page. They do not prove attribution; for that, run the [Worked example](#worked-example). More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Troubleshooting and limits + +| Symptom | Likely cause | Fix | +| --- | --- | --- | +| Triple Whale shows no sales for funnel orders, store without Shopify | Triple Whale has no order record for them | Not supported today. See [Stores without Shopify](#attribution-requirements) | +| Triple Whale shows no sales for funnel orders, Shop Sync store | The Shopify order was not created yet, Triple Whale is not connected to that Shopify store, `triplewhale_name` or `triplewhale_platform` points at another shop, or the configuration does not attribute on your account | Check the order in Shopify with the `NEXT` tag; check the two keys against your Triple Whale snippet; run the [Worked example](#worked-example) | +| Orders counted twice in Triple Whale | Pixel `Purchase` on alongside the synced Shopify order | Test the configuration with funnel purchases blocked | +| `TriplePixelData` is `undefined` | Built with `npm run dev`, `triplewhale_name` empty, or a cached page | Build with `npm run build`; check the key; reload the page without the cache | +| No Triple Whale requests at all | Pixel blocked by a Content Security Policy, or `?ignore=true` set earlier in the tab | Allow `eval()` and the `config-security.com` hosts; open a new tab without `?ignore=true` | +| No `Purchase` after a test order | Blocked by `triplewhale_blocked_events`, the shopper never reached a page after payment, or the order was already reported in that browser | Check `getStatus()`; load the upsell or receipt page; use a fresh browser profile for each test | +| No `Contact` | `triplewhale_contact_enabled` not set, the email is not valid yet, or the buyer used an express wallet | Set the key to `"true"`; finish typing the email; see the express wallet note above | +| Pixel Helper shows nothing | Headless or automated browser | Use a normal Chrome window | +| Data lands in the wrong Triple Whale shop | Wrong `triplewhale_platform` or `triplewhale_name` | Copy both values from your Triple Whale snippet | +| Meta counts the order twice | Triple Whale Sonar and the Meta Pixel app both send it | Send the Meta purchase from one of them | + +- Leave Triple Whale's Eval Restriction setting off unless Triple Whale support asks you to turn it on. +- The template pins Triple Pixel snippet version `2.17`. It does not use the `ver` value from your copied snippet. +- No NEXT app sends orders or events to Triple Whale from the server. +- Triple Whale says subscription renewals are sent through its Orders API. NEXT does not send them, and the funnel sends nothing for a renewal. +- This guide covers SDK 0.4.43, which the starter templates pin. Triple Whale behaviour on SDK 0.5.0 was not tested. diff --git a/content/docs/storefront/checkout-links.mdx b/content/docs/storefront/checkout-links.mdx index 6542fc1..a326abd 100644 --- a/content/docs/storefront/checkout-links.mdx +++ b/content/docs/storefront/checkout-links.mdx @@ -38,7 +38,7 @@ Checkout link parameters can be broadly split into two groups, [Cart Parameters] ### Attribution Parameters -In addition to populating the cart, you can pass attribution parameters to attribute the order to your marketing channel. +In addition to populating the cart, you can pass attribution parameters to attribute the order to your marketing channel. Campaign funnels capture a similar set from the landing URL; see the [Events and attribution reference](/docs/campaigns/tracking/events-and-attribution). | Parameter | Description | | -----------| -------- | @@ -48,7 +48,7 @@ In addition to populating the cart, you can pass attribution parameters to attri | `utm_term` | Identify the paid keywords | | `utm_content` | Use to differentiate ads | | `funnel` | Use to attribute funnels | -| `gclid` | Adwords click ID | +| `gclid` | Google Ads click ID | | `evclid` | Everflow Click ID | | `aff` | Main affiliate / network | | `sub1` | Sub affiliate 1 | diff --git a/content/docs/storefront/event-tracking.mdx b/content/docs/storefront/event-tracking.mdx index 5959036..2c3aad5 100644 --- a/content/docs/storefront/event-tracking.mdx +++ b/content/docs/storefront/event-tracking.mdx @@ -4,11 +4,16 @@ description: Subscribe to storefront customer events with JavaScript event track sidebar_label: Event Tracking sidebar_position: 3 --- +import { Callout } from 'fumadocs-ui/components/callout'; ## Overview Event Tracking allows merchants and third-party integrations to subscribe to customer engagement events on your storefront for robust customer behavior tracking. + +These events fire on the NEXT storefront only. Campaign funnels built with the Campaign Cart SDK emit their own events. See [Tracking](/docs/campaigns/tracking). + + ## Getting Started To add new custom Event Trackers, in your store go to Settings > Tracking Events > Add Event Tracker. From 951ece685c57d98ee75df4111ed88e9eef952a08 Mon Sep 17 00:00:00 2001 From: Brett Bond Date: Mon, 16 Nov 2026 21:19:37 +1100 Subject: [PATCH 02/10] Tracking guides: fix tax-basis wording, Triple Whale Shop Sync default, dev-domain scope Co-Authored-By: Claude Opus 5.5 --- content/docs/campaigns/tracking/google-ads.mdx | 6 +++--- content/docs/campaigns/tracking/google-tag-manager.mdx | 6 +++--- content/docs/campaigns/tracking/meta.mdx | 2 +- content/docs/campaigns/tracking/shop-sync.mdx | 4 ++-- .../docs/campaigns/tracking/testing-and-troubleshooting.mdx | 2 +- content/docs/campaigns/tracking/triple-whale.mdx | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/content/docs/campaigns/tracking/google-ads.mdx b/content/docs/campaigns/tracking/google-ads.mdx index 3eef932..f1a42d4 100644 --- a/content/docs/campaigns/tracking/google-ads.mdx +++ b/content/docs/campaigns/tracking/google-ads.mdx @@ -56,7 +56,7 @@ The [Google Analytics 4 store app](https://docs.nextcommerce.com/docs/apps/googl ## Before you start - A Google Ads account with auto-tagging turned on. Without auto-tagging, ad clicks carry no `gclid`. -- A funnel built from a starter template, with your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. Analytics and event tracking are ignored on development domains. +- A funnel built from a starter template, with your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. On a development domain only NEXT campaign analytics ignores the events; vendor tags still fire. - For the GA4 import path: - GA4 set up on the funnel and working. Follow [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) first. - Your Google Analytics and Google Ads accounts linked. @@ -136,7 +136,7 @@ Metafields are written once, when the Shopify order is created. This mapping is | --- | --- | --- | | Event | `dl_purchase`, sent to GA4 as `purchase` | `dl_upsell_purchase`, sent to GA4 as `upsell_purchase` | | `transaction_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | -| `value` | Item revenue, excluding tax and shipping | The upsell line only | +| `value` | Item revenue without shipping (tax excluded on stores that show prices without tax, included on tax-inclusive stores) | The upsell line only | | `currency` | The order currency | The order currency | Upsells are sent as separate events. If you import only `purchase`, or add only a `dl_purchase` tag, Google Ads counts the first sale and not the upsell revenue. Because `value` excludes tax and shipping, Google Ads conversion value will be lower than the order total. @@ -194,7 +194,7 @@ More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/tes | No `gclid` on the order | Auto-tagging is off, or the ad's URL drops the query string before the funnel loads | Turn on auto-tagging; check the landing URL in the browser carries `gclid` | | Every conversion counted twice | Both paths run for the same conversion, or a Shopify-side Google app also counts the synced order | Keep one sender per conversion | | Upsell revenue missing in Google Ads | `upsell_purchase` was not imported, or there is no `dl_upsell_purchase` tag | Import the key event or add the tag | -| Conversion value lower than the order total | `value` excludes tax and shipping by design | Compare against item revenue in NEXT | +| Conversion value lower than the order total | `value` is item revenue and leaves out shipping, and tax on tax-exclusive stores | Compare against item revenue in NEXT | | Imported conversion not used for bidding | It was created as a secondary conversion action | Change it in Google Ads | | Cannot create a conversion from GA4 | Missing access, unlinked accounts, or the feature is not available to the property | Check the prerequisites in [Google's help](https://support.google.com/google-ads/answer/10632359?hl=en) | | Google Ads settings in the Google Analytics 4 store app have no effect | That app runs on the storefront only | Use one of the two paths on this page | diff --git a/content/docs/campaigns/tracking/google-tag-manager.mdx b/content/docs/campaigns/tracking/google-tag-manager.mdx index c1507c4..7e9f436 100644 --- a/content/docs/campaigns/tracking/google-tag-manager.mdx +++ b/content/docs/campaigns/tracking/google-tag-manager.mdx @@ -39,7 +39,7 @@ The provider runs in the browser only. It covers every funnel page of the starte - A Google Tag Manager web container. Copy its ID, which has the form `GTM-XXXXXXX`. - A funnel built from a starter template. -- Your funnel domain added under **Allowed Domains** in the Campaigns app, under **Settings**, as a **Production** domain. Analytics and event tracking are ignored for development domains. +- Your funnel domain added under **Allowed Domains** in the Campaigns app, under **Settings**, as a **Production** domain. On a development domain only NEXT campaign analytics ignores the events; vendor tags still fire. - The NEXT Google Tag Manager app covers the storefront only. It does not run on campaign funnels, so the setup below is still needed. See the [app documentation](https://docs.nextcommerce.com/docs/apps/google-tag-manager). ## Set up @@ -176,7 +176,7 @@ Keep every funnel page on one domain. The SDK keeps attribution in the browser f | --- | --- | --- | | When it fires | The first SDK page with a `ref_id` after payment | The next SDK page after the upsell is accepted | | `event_id` and `ecommerce.transaction_id` | The order number, for example `100041` | The order reference plus `-US1`, `-US2`, and so on | -| `ecommerce.value` | Item revenue, excluding tax and shipping | The accepted upsell line, or the bundle total | +| `ecommerce.value` | Item revenue without shipping. Tax is excluded on stores that show prices without tax and included on stores that show tax-inclusive prices, where `ecommerce.tax` is also sent, so do not add the two together | The accepted upsell line, or the bundle total | | `ecommerce.tax` and `ecommerce.shipping` | Order tax and shipping | `0` and `0` | | `ecommerce.affiliation` | `Online Store` | `Upsell` | | Other fields | `currency`, `coupon`, `discount`, `items` | `currency`, `coupon`, `items`, `upsell_metadata` with `original_order_id`, `upsell_number`, `package_id` and `package_name` | @@ -234,7 +234,7 @@ More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/tes | No `dl_purchase` after a test order | The order is unpaid, the shopper never reached a page with a `ref_id` after payment, or that order was already reported in this browser | Load the upsell or receipt page, and use a fresh browser profile for each test | | `dl_upsell_purchase` appears one page late | The SDK holds it until the next SDK page | Expected. Check the next page. | | Upsell revenue is higher than expected | Each bundle item pushes an event with the whole bundle total | Handle bundle totals in the tag or the report | -| Purchase value is lower than the order total | `value` excludes tax and shipping | Read `ecommerce.tax` and `ecommerce.shipping` alongside it | +| Purchase value is lower than the order total | `value` is item revenue and leaves out shipping, and tax on stores that show prices without tax | Read `ecommerce.shipping`, and `ecommerce.tax` on tax-exclusive stores, alongside it | | A `dl_page_view` trigger never fires | The SDK does not send `dl_page_view` at 0.4.43 | Trigger on `dl_user_data` for page loads | - The SDK does not skip test orders, so a test purchase reaches GTM and fires `dl_purchase`. Filter test data in GTM if your reports need it clean. diff --git a/content/docs/campaigns/tracking/meta.mdx b/content/docs/campaigns/tracking/meta.mdx index 5d16605..c653c1f 100644 --- a/content/docs/campaigns/tracking/meta.mdx +++ b/content/docs/campaigns/tracking/meta.mdx @@ -227,7 +227,7 @@ On a return visit the SDK refills the phone field after `InitiateCheckout` has b | When | The first page after payment | After the order is created; 10 minutes later when **Enable Delay Order Confirmation** is on | | Event ID | `{storeName}-{order number}`, for example `your-store-100041`. None when `storeName` is not set | `{store}-{order number}`, using the store subdomain | | `order_id` | The NEXT order number | The NEXT order number | -| `value` | Item revenue, excluding tax and shipping, for the first sale | The order total including tax (`total_incl_tax`) | +| `value` | Item revenue without shipping, for the first sale (tax excluded on stores that show prices without tax, included on tax-inclusive stores) | The order total including tax (`total_incl_tax`) | | `num_items` | Number of order lines | Sum of item quantities | | Other fields | `currency`, `content_type`, `content_ids`, `contents` | | | Upsells | Not included. Nothing is sent for an accepted upsell | With the delay on, the app re-reads the order before sending, so upsells accepted before then are expected to be included. Not confirmed | diff --git a/content/docs/campaigns/tracking/shop-sync.mdx b/content/docs/campaigns/tracking/shop-sync.mdx index 2d4dad2..3466336 100644 --- a/content/docs/campaigns/tracking/shop-sync.mdx +++ b/content/docs/campaigns/tracking/shop-sync.mdx @@ -94,7 +94,7 @@ For each ad platform, decide which one place sends the purchase. A campaign orde | Platform | Senders that can reach it | Recommended single sender | How to stop the others | Status | | --- | --- | --- | --- | --- | | Meta | Funnel browser `Purchase` (SDK Meta provider); NEXT Meta Pixel app server `Purchase`; a Shopify-side server sender | The funnel browser `Purchase` and the NEXT Meta Pixel app, as one pair. They use the same event ID, `{store}-{order number}`, so Meta can deduplicate them | Exclude orders tagged `NEXT` in the Shopify-side sender, or turn its purchase events off for that pixel. If you keep the Shopify-side sender instead, turn off the NEXT Meta Pixel app and add `"dl_purchase"` to `analytics.providers.facebook.blockedEvents` | Partial: the funnel event ID was observed; the server side was not | -| Triple Whale | Funnel adapter `Purchase` and `UpsellPurchase`; the synced Shopify order Triple Whale ingests | The Shopify order Triple Whale ingests, with the funnel sending `Contact` to tie the session to it | `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"`, with `triplewhale_name` set to `your-store.myshopify.com`, `triplewhale_platform` set to `SHOPIFY` and `triplewhale_contact_enabled` on | Unconfirmed, and see the note below | +| Triple Whale | Funnel adapter `Purchase` and `UpsellPurchase`; the synced Shopify order Triple Whale ingests | No default yet. Two configurations exist: the Shopify order as the only purchase, with the funnel sending `Contact` to tie the session to it; or the funnel `Purchase` left on, which Triple Whale's documentation says attribution needs | For the first, `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"` with `triplewhale_contact_enabled` on. Express wallet buyers may never type an email, so `Contact` may not fire for them. Test both in your own account as the [Triple Whale](/docs/campaigns/tracking/triple-whale#worked-example) guide describes | Unconfirmed, and see the note below | | Northbeam | Funnel adapter `purchase`; the synced Shopify order Northbeam ingests | The Shopify order from Northbeam's Shopify connector, with identity sent from the funnel | `"northbeam_blocked_events": "dl_purchase, dl_upsell_purchase"`, with `northbeam_identity_enabled` on. See [Northbeam](/docs/campaigns/tracking/more-integrations#northbeam) | Unconfirmed | | GA4 and Google Ads | Funnel GA4 adapter; any Shopify-side Google app that reports synced orders (not confirmed that one does) | The funnel GA4 adapter, with Google Ads importing GA4 key events | Exclude orders tagged `NEXT` in the Shopify-side Google app, or, to keep that app instead, `"ga4_blocked_events": "dl_purchase, dl_upsell_purchase"` | Unconfirmed | | TikTok | Funnel TikTok adapter `Purchase`; any Shopify-side TikTok app that reports synced orders (not confirmed that one does) | The funnel TikTok adapter. NEXT sends no TikTok server event for campaign orders | Exclude orders tagged `NEXT` in the Shopify-side TikTok app, or, to keep that app instead, `"tiktok_blocked_events": "dl_purchase, dl_upsell_purchase"` | Unconfirmed | @@ -160,5 +160,5 @@ Place an order with a [test card](/docs/testing), then request fulfillment for i - SDK 0.4.43 does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`, so they cannot be mapped. SDK 0.5.0 stores them in attribution metadata, which should make them mappable; this has not been checked. - Coupon codes are not synced to the Shopify order, according to internal NEXT notes. Unconfirmed: not checked in Shop Sync source. - Triple Whale's documentation expects Shopify product and variant IDs in pixel events. The funnel sends NEXT SKUs. The effect on matching is not known. -- Revenue differs by sender for the same order. The funnel's GA4 purchase `value` excludes tax and shipping, while the NEXT Meta Pixel app sends the order total including tax. +- Revenue differs by sender for the same order. The funnel's GA4 purchase `value` is item revenue without shipping (and without tax on tax-exclusive stores), while the NEXT Meta Pixel app sends the order total including tax. - More on what the SDK captures is in [Events and attribution](/docs/campaigns/tracking/events-and-attribution). Testing steps are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). diff --git a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx index ae8dcf4..1d34ffc 100644 --- a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx +++ b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx @@ -124,7 +124,7 @@ Run this on a production build in a fresh private window. On each page, check `w 3. Type an email, then a phone number. Expected: with `triplewhale_contact_enabled` on, Triple Whale receives a `Contact` event for each, before any purchase, and the `contacts` count for `triplewhale` in `NextForwarder.getStatus()` goes up. 4. Enter the shipping address and choose a shipping method. Expected: `dl_add_shipping_info`, a GA4 `add_shipping_info` request with `item_id` set to the product SKU, and a Meta `AddShippingInfo` custom event. 5. Pay with a test card. Expected: the checkout page itself sends no purchase. The browser moves to the next page with `ref_id` on the URL. -6. On the first page after payment (an upsell page, or the receipt if there is no upsell). Expected: `dl_purchase` with `transaction_id` and `event_id` set to the order number, for example `100041`, and `value` set to the item revenue with tax and shipping excluded. The Meta purchase request carries `eid=your-store-100041` when `storeName` is set to your store subdomain, plus `cd[order_id]` and `cd[value]`. TikTok and Triple Whale send their purchase on this page too. Reload the page: no second `dl_purchase`, and `localStorage` key `nextDataLayer_reportedPurchases` lists the order number. +6. On the first page after payment (an upsell page, or the receipt if there is no upsell). Expected: `dl_purchase` with `transaction_id` and `event_id` set to the order number, for example `100041`, and `value` set to the item revenue without shipping (and without tax on stores that show prices without tax). The Meta purchase request carries `eid=your-store-100041` when `storeName` is set to your store subdomain, plus `cd[order_id]` and `cd[value]`. TikTok and Triple Whale send their purchase on this page too. Reload the page: no second `dl_purchase`, and `localStorage` key `nextDataLayer_reportedPurchases` lists the order number. 7. Accept the upsell. Expected: on the next page, `dl_upsell_purchase` with `transaction_id` set to the order reference plus `-US1` and `value` set to the upsell line only. Triple Whale sends `UpsellPurchase` and TikTok sends another `Purchase`. Meta receives no event for the accepted upsell. 8. Open the order in the store dashboard, or fetch it from the Admin API. Expected: the order is marked as a Test Order and its attribution has the `utm_*` fields, `gclid`, `affiliate`, `subaffiliate1`, `funnel`, and `metadata.fbclid`. `metadata.landing_page` is the checkout URL, not your first funnel page, because checkout overwrites it. `fb_fbp` and `fb_fbc` are filled only when a real Meta pixel has set its cookies. 9. If the Meta Pixel app is installed and **Enable Sending Test Data** is on, wait about 10 minutes (**Enable Delay Order Confirmation**, on by default, holds the event to wait for order updates such as upsells) and look for the server Purchase in Meta. This step was not tested by NEXT. diff --git a/content/docs/campaigns/tracking/triple-whale.mdx b/content/docs/campaigns/tracking/triple-whale.mdx index 889f70f..22271dc 100644 --- a/content/docs/campaigns/tracking/triple-whale.mdx +++ b/content/docs/campaigns/tracking/triple-whale.mdx @@ -154,7 +154,7 @@ On a NEXT store without Shopify, Triple Whale attribution for funnel orders is n | --- | --- | --- | | Event | `Purchase` | `UpsellPurchase`, sent as `TriplePixel('custom', 'UpsellPurchase', ...)` | | `orderId` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | -| `value` | Item revenue, excluding tax and shipping | The upsell line only | +| `value` | Item revenue without shipping (tax excluded on stores that show prices without tax, included on tax-inclusive stores) | The upsell line only | | `currency` | The order currency | The order currency | | `lineItems` | One entry per item: `i` (SKU), `q` (quantity), `v` (variant ID) | None. Custom events are kept to flat values | From 8ad9bc0aeec6f827b0b5306165946fcc20fbbd4f Mon Sep 17 00:00:00 2001 From: masmalsah Date: Mon, 16 Nov 2026 16:20:43 -0600 Subject: [PATCH 03/10] Tracking guides: simplify, correct against source, and restructure Rewrites the Tracking section in plain language for merchants and developers, and corrects it against the SDK (v0.4.43), starter templates, store app and Shop Sync source. - Remove per-claim verification tables, "Unconfirmed" framing and SDK 0.5.0 content; the section describes SDK 0.4.43. - Triple Whale: one Shop Sync setup (block funnel purchases, Contact on); add a section for stores without Shopify. - Everflow: new page covering redirect and direct links, the bridge, reporting from GTM, and more than one affiliate network. - AppLovin Axon: new page, with a server function that keeps Axon's cookie for a year. - Fold Google Ads into the GA4 page and TikTok into More integrations. - Replace the Events and attribution page with links to the SDK reference; point Shop Sync detail at the existing Shop Sync guides. - Fix source-contradicted claims (Everflow postback fields and repeats, purchase reporting, amounts and tax, Shop Sync orders). - Campaigns page: shorten the Analytics section and link to Tracking. Co-Authored-By: Claude Fable 5.2 --- content/capabilities.yaml | 3 - .../admin-api/guides/external-checkout.mdx | 2 +- content/docs/campaigns/api/index.mdx | 2 +- content/docs/campaigns/index.mdx | 40 +- .../docs/campaigns/tracking/applovin-axon.mdx | 98 +++++ .../tracking/events-and-attribution.mdx | 181 --------- content/docs/campaigns/tracking/everflow.mdx | 195 ++++++++++ .../campaigns/tracking/getting-started.mdx | 167 +++----- .../docs/campaigns/tracking/google-ads.mdx | 207 ---------- .../campaigns/tracking/google-analytics-4.mdx | 140 +++---- .../campaigns/tracking/google-tag-manager.mdx | 245 ++++-------- content/docs/campaigns/tracking/index.mdx | 113 +++--- content/docs/campaigns/tracking/meta.json | 11 +- content/docs/campaigns/tracking/meta.mdx | 366 +++++------------- .../campaigns/tracking/more-integrations.mdx | 180 ++++----- content/docs/campaigns/tracking/shop-sync.mdx | 177 +++------ .../tracking/testing-and-troubleshooting.mdx | 196 +++------- content/docs/campaigns/tracking/tiktok.mdx | 209 ---------- .../docs/campaigns/tracking/triple-whale.mdx | 251 +++--------- content/docs/storefront/checkout-links.mdx | 2 +- 20 files changed, 881 insertions(+), 1904 deletions(-) create mode 100644 content/docs/campaigns/tracking/applovin-axon.mdx delete mode 100644 content/docs/campaigns/tracking/events-and-attribution.mdx create mode 100644 content/docs/campaigns/tracking/everflow.mdx delete mode 100644 content/docs/campaigns/tracking/google-ads.mdx delete mode 100644 content/docs/campaigns/tracking/tiktok.mdx diff --git a/content/capabilities.yaml b/content/capabilities.yaml index 9b5b645..d7edfc9 100644 --- a/content/capabilities.yaml +++ b/content/capabilities.yaml @@ -290,10 +290,7 @@ capabilities: - /docs/campaigns/tracking/getting-started - /docs/campaigns/tracking/triple-whale - /docs/campaigns/tracking/meta - - /docs/campaigns/tracking/tiktok - - /docs/campaigns/tracking/google-ads - /docs/campaigns/tracking/shop-sync - - /docs/campaigns/tracking/events-and-attribution - /docs/campaigns/tracking/testing-and-troubleshooting api_operations: [tag:campaigns] webhooks: [] diff --git a/content/docs/admin-api/guides/external-checkout.mdx b/content/docs/admin-api/guides/external-checkout.mdx index 9e9fdc9..5b139df 100644 --- a/content/docs/admin-api/guides/external-checkout.mdx +++ b/content/docs/admin-api/guides/external-checkout.mdx @@ -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. ## 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. For how NEXT Campaigns funnels fill these fields, see the [Events and attribution reference](/docs/campaigns/tracking/events-and-attribution). +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": { diff --git a/content/docs/campaigns/api/index.mdx b/content/docs/campaigns/api/index.mdx index 74a6f3e..88acd17 100644 --- a/content/docs/campaigns/api/index.mdx +++ b/content/docs/campaigns/api/index.mdx @@ -36,7 +36,7 @@ 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) and the [Events and attribution reference](/docs/campaigns/tracking/events-and-attribution). +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. diff --git a/content/docs/campaigns/index.mdx b/content/docs/campaigns/index.mdx index 4672556..c4f24d5 100644 --- a/content/docs/campaigns/index.mdx +++ b/content/docs/campaigns/index.mdx @@ -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 | @@ -234,7 +234,7 @@ 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 | NEXT campaign analytics | | --- | --- | --- | @@ -244,7 +244,7 @@ Domains are configured in your store's **Campaign Settings** and apply across al 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). -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. @@ -255,41 +255,19 @@ 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 and payment info, purchase, and upsells) through the internal `nextCampaign` provider, which templates ship turned on. No code required. +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. -Setup guides for every supported platform (Triple Whale, Meta, TikTok, Google Ads, GA4, GTM and more), the event and attribution reference, and testing steps are in [Tracking](/docs/campaigns/tracking). - -To also forward those events to **Google Tag Manager** or **Facebook Pixel**, add your IDs in `_data/campaigns.json`: - -```json -{ - "my-campaign": { - "name": "My Campaign", - "...": "...", - "gtm_id": "GTM-XXXXXXX", - "fb_pixel_id": "123456789012345" - } -} -``` - - -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. The [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) and [Meta](/docs/campaigns/tracking/meta) guides cover the full wiring, and the other platforms use one key each in `_data/campaigns.json`. - +To send those events to Meta, Google, TikTok, Triple Whale and other platforms, see [Tracking](/docs/campaigns/tracking). -Two mechanisms keep test traffic out of your campaign dashboards, so they reflect **real customer conversions**, not internal QA: +Two things keep test traffic out of NEXT's campaign reports: -- **Development domains**: NEXT campaign analytics ignores events from any domain marked *development* in your store's Campaign Settings. Add `localhost`, staging URLs, and preview hosts here. Vendor pixels on those pages still fire. -- **`?ignore=true` URL parameter**: append it to any URL to silence all SDK tracking for the browser session, useful for one-off testing on a production domain. Clear it with `window.NextAnalyticsClearIgnore()`. +- **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. -Do not use `?ignore=true` when you are testing that a purchase event fires: it stops every event, including the purchase. +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). - -### 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 - --- ## Non-interactive setup (agents, CI) diff --git a/content/docs/campaigns/tracking/applovin-axon.mdx b/content/docs/campaigns/tracking/applovin-axon.mdx new file mode 100644 index 0000000..664a85d --- /dev/null +++ b/content/docs/campaigns/tracking/applovin-axon.mdx @@ -0,0 +1,98 @@ +--- +title: AppLovin Axon +description: Track a NEXT Campaigns funnel in AppLovin Axon. Turn on the Axon pixel in a starter template, and keep Axon's cookie for a year with a small server function. +sidebar_label: AppLovin Axon +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- + +The starter templates include the AppLovin Axon pixel. Add your event key and the funnel reports page views, checkout steps and purchases to Axon from the shopper's browser. + +The **AppLovin AXON** store app covers your NEXT storefront, not funnels. + +## Before you start + +- Your Axon event key, from your AppLovin account. +- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). + +## Set up + +1. In `_data/campaigns.json`, add your event key to your campaign: + +```json title="_data/campaigns.json" +{ + "my-campaign": { + "name": "My Campaign", + "axon_event_key": "your-event-key" + } +} +``` + +2. Build with `npm run build` and deploy. +3. Add the server function in [Keep Axon's cookie for a year](#keep-axons-cookie-for-a-year) below. + +## What gets tracked + +Page views, product views, add to cart, checkout started, payment details and purchases. + +Each accepted upsell counts as another purchase, so an order with two upsells shows in Axon as three purchases. + +## Shopper details + +To send the shopper's email, phone and customer ID with each purchase, add this to your campaign: + +```json +"axon_send_user_data": "true" +``` + +Turn it on only when your privacy policy covers it. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). + +## Keep Axon's cookie for a year + +Axon's pixel recognises a returning shopper with a cookie named `_axwrt`. Some browsers, including Safari, shorten the life of cookies that a script sets. AppLovin [strongly recommends](https://support.applovin.com/en/growth/promoting-your-websites/track-and-optimize/google-tag-manager) that your site's server sets the same value again as a one-year cookie named `axwrt`. + +A starter template funnel is a static site, so this needs a small server function. On Netlify, add this one file. It runs on every page request, and when the shopper already has `_axwrt`, it adds `axwrt` to the response: + +```js title="netlify/edge-functions/axwrt.js" +const ROOT_DOMAIN = 'example.com'; + +export default async (request, context) => { + const response = await context.next(); + + const cookies = request.headers.get('cookie') || ''; + const match = cookies.match(/(?:^|;\s*)_axwrt=([A-Za-z0-9._-]+)/); + if (!match) return response; + + // Share the cookie across your subdomains. Leave Domain off on preview hosts. + const host = new URL(request.url).hostname; + const onRoot = host === ROOT_DOMAIN || host.endsWith(`.${ROOT_DOMAIN}`); + const domain = onRoot ? `; Domain=.${ROOT_DOMAIN}` : ''; + + response.headers.append( + 'Set-Cookie', + `axwrt=${match[1]}${domain}; Path=/; Max-Age=31536000; SameSite=Lax; Secure` + ); + return response; +}; + +export const config = { + path: '/*', + // Pages only, so the cookie is never attached to cached files. + excludedPath: ['/*.css', '/*.js', '/*.json', '/*.png', '/*.jpg', '/*.jpeg', '/*.webp', '/*.svg', '/*.ico', '/*.woff2'], +}; +``` + +Set `ROOT_DOMAIN` to your funnel's root domain, without `www`. There is nothing to add to your pages or to `netlify.toml`. The cookie is in place from the shopper's second page view. + +Any server or edge platform can do the same thing; Netlify is the example. + +## Verify it works + +1. Open your funnel in a new private window and go through it. +2. Place an order with a [test card](/docs/testing) and continue to the next page. +3. In your AppLovin account, check that the events arrive, including the purchase. +4. Open a second funnel page, then check in your browser's developer tools that a cookie named `axwrt` is set. + +More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). diff --git a/content/docs/campaigns/tracking/events-and-attribution.mdx b/content/docs/campaigns/tracking/events-and-attribution.mdx deleted file mode 100644 index b0a8b09..0000000 --- a/content/docs/campaigns/tracking/events-and-attribution.mdx +++ /dev/null @@ -1,181 +0,0 @@ ---- -title: Events and attribution reference -description: Look up Campaign Cart SDK event names, purchase values and the attribution fields sent with your orders. Compare SDK 0.4.43 with the source-checked changes in 0.5.0. -sidebar_label: Events and attribution -audience: [merchant, developer] -last_verified: 2026-11-16 -tags: - - Guide ---- - -## Event names by SDK version - -Starter templates pin SDK 0.4.43. Use the 0.4.x column for those funnels. The table lists events emitted by 0.4.43, including events you trigger manually. The last column describes the 0.4.43 trigger unless it explicitly says otherwise. - -| Moment | SDK 0.4.x event | SDK 0.5.0 event | Fires on | -| --- | --- | --- | --- | -| Page load or user context refresh | `dl_user_data` | `page_viewed` | Every page load in auto mode; also on supported context refreshes | -| Product list viewed | `dl_view_item_list` | `product_list_viewed` | A page with multiple packages, a configured view-item-list meta tag, or `next.trackViewItemList()` | -| Product viewed | `dl_view_item` | `product_viewed` | A single or selected package, a configured view-item meta tag, or `next.trackViewItem()` | -| Item added | `dl_add_to_cart` | `product_added_to_cart` | Cart item added in auto mode; 0.5.0 also reports carts filled before page load | -| Item removed | `dl_remove_from_cart` | `product_removed_from_cart` | Cart item removed in auto mode | -| Package swapped | `dl_package_swapped` | No direct equivalent | Package selector in swap mode; 0.5.0 removes this event and sends removal and addition events | -| Cart updated | `dl_cart_updated` | `cart_updated` | Cart update in auto mode | -| Checkout started | `dl_begin_checkout` | `checkout_started` | Checkout form initialization with a non-empty cart, in any mode | -| Shipping entered | `dl_add_shipping_info` | `checkout_shipping_address_submitted`, `checkout_shipping_method_submitted` | Shipping method selection, autofill or address autocomplete, in any mode | -| Payment entered | `dl_add_payment_info` | `checkout_payment_info_submitted` | Complete card fields, an express payment button press or redirect payment submission, in any mode | -| Order purchased | `dl_purchase` | `checkout_completed` | First SDK page that freshly fetches the paid order, in auto mode | -| Upsell viewed | `dl_viewed_upsell` | `upsell_viewed` | Upsell page | -| Upsell skipped | `dl_skipped_upsell` | `upsell_skipped` | Shopper skips an upsell | -| Upsell purchased | `dl_upsell_purchase` | `upsell_completed` | Next SDK page after acceptance, from the queued event | -| Scroll threshold reached | `dl_scroll_depth` | No mapping confirmed | Configured scroll-tracking meta tag thresholds, once per threshold per page, in any mode | -| Exit intent shown | `dl_exit_intent_shown` | No direct tracking event; data layer only | Exit-intent popup shown, in auto mode | -| Exit intent accepted | `dl_exit_intent_accepted` | No direct tracking event; data layer only | Exit-intent popup clicked, in auto mode | -| Exit intent dismissed | `dl_exit_intent_dismissed` | No direct tracking event; data layer only | Exit-intent popup dismissed, in auto mode | -| Exit intent closed | `dl_exit_intent_closed` | No direct tracking event; data layer only | Exit-intent popup closed, in auto mode | -| Exit intent action | `dl_exit_intent_action` | No direct tracking event; data layer only | Exit-intent action, in auto mode | -| Sign-up | `dl_sign_up` | No mapping confirmed | Your call to `next.trackSignUp(email)` | -| Login | `dl_login` | No mapping confirmed | Your call to `next.trackLogin(email)` | -| Custom event | Your event name | No mapping confirmed | Your call to `next.trackCustomEvent(name, data)` | - -SDK 0.4.43 defines `dl_page_view`, `dl_route_changed`, `dl_view_cart`, `dl_select_item`, `dl_view_search_results` and `dl_subscribe`, but never emits them. The SDK Meta provider's `PageView` comes from `dl_user_data`. - -The `dl_*` event stream still exists on 0.5.0 as a deprecated compatibility layer. Its shipping compatibility event is sent only for the first shipping-address or shipping-method event per checkout. Unconfirmed: the 0.5.0 mappings and behavior above were checked in source, but not in a live funnel. No 0.5.0 mapping is confirmed for scroll depth, sign-up, login or your custom event names. - -## Purchase event - -On SDK 0.4.43, `dl_purchase` fires on the first SDK page that does a fresh fetch of the order from `?ref_id=` or `?order_ref_id=` after payment. This can be your upsell page before the receipt. Creating the order on the checkout page does not emit it. A cached order with the same reference, loaded less than 15 minutes ago, does not emit it again. - -Set `window.nextConfig.analytics.enabled` to `true` and `window.nextConfig.analytics.mode` to `'auto'` for automatic `dl_purchase`. Only `mode === 'auto'` starts the auto-trackers; omitting `mode` does not enable them. - -| Field | SDK 0.4.43 value | -| --- | --- | -| `ecommerce.transaction_id` | Order number, stringified. If absent, the SDK falls back to `order.ref_id`, then `orderId`, then `transactionId`. Without an identifier it does not build the event | -| `event_id` | Same value as `ecommerce.transaction_id` | -| `ecommerce.value` | Item revenue: sum of item price multiplied by quantity. Tax and shipping are not added | -| `ecommerce.tax` | `order.total_tax` | -| `ecommerce.shipping` | Shipping on your store's displayed tax basis | -| `ecommerce.currency` | Order currency, or campaign currency if absent | -| `ecommerce.items` | Order line items | -| `ecommerce.items[].item_id` | Product SKU, falling back to `SKU-` | -| `ecommerce.items[].item_variant_id` | Variant identifier, when available | - -For tax-exclusive stores, `value` excludes tax and shipping. The per-unit price uses the store's displayed basis: tax-exclusive for tax-exclusive stores, tax-inclusive for VAT stores. On a VAT store, item tax is already in `value`, and `tax` is also sent separately. - -An unpaid order with `payment_complete_url` does not fire `dl_purchase`. A payment-failure landing also vetoes it. The failure check uses the recorded failure path, or `?payment_failed=true` unless the current path matches the recorded success path. - -The SDK deduplicates purchases in `localStorage` under `nextDataLayer_reportedPurchases`, keeping the last 20 transaction IDs without a time expiry. The key can have the SDK's scope suffix. It records an ID after the event is pushed to `window.NextDataLayer`. - -In the live SDK 0.4.43 test, `transaction_id` and `event_id` were the order number. The purchase fired on the upsell page with `value: 12`, `tax: 0` and `shipping: 0`. The order total became 15 after the upsell. Revisiting the upsell page did not send another `dl_purchase`. - -## Upsell event - -On SDK 0.4.43, `dl_upsell_purchase` uses `transaction_id: -US`, where `n` counts accepted upsells. Its `event_id` is the same string. The reference can differ from the order number used by `dl_purchase`. - -The event reports the accepted upsell line only, with `tax: 0` and `shipping: 0`, except for the bundle behavior below. It is queued in `sessionStorage` and replayed on the next SDK page where analytics initializes. If it is more than 5 minutes old at replay, it is dropped. Acceptance without navigation leaves it queued. - -The value basis varies by acceptance path: - -| Acceptance path | `value` basis | -| --- | --- | -| Accept-upsell button, single package | Added order line on the store's displayed tax basis | -| Accept-upsell button, bundle | One event per bundle item, each with the whole bundle total. Summing these events overcounts bundle revenue | -| Upsell page or `next.addUpsell` | Added line's `price_incl_tax`, falling back to campaign package price multiplied by quantity | -| Package toggle | Campaign package price multiplied by quantity | - -No attribution is sent on upsell API calls. The added lines belong to the original order, which received attribution when it was created. The analytics event itself carries the current attribution at replay time. - -## Attribution captured from the URL - -On SDK 0.4.43, these URL values become fields in your order's `attribution` object. The last column is relative to that object. - -| URL parameter | Stored as | Sent on order | -| --- | --- | --- | -| `utm_source` | `attribution.utm_source` | `utm_source` | -| `utm_medium` | `attribution.utm_medium` | `utm_medium` | -| `utm_campaign` | `attribution.utm_campaign` | `utm_campaign` | -| `utm_content` | `attribution.utm_content` | `utm_content` | -| `utm_term` | `attribution.utm_term` | `utm_term` | -| `gclid` | `attribution.gclid` | `gclid` | -| `aff` or `affid` | `attribution.affiliate` | `affiliate`; `affid` takes precedence | -| `sub1` to `sub5`, or `subaffiliate1` to `subaffiliate5` | Corresponding `attribution.subaffiliate1` to `attribution.subaffiliate5` | `subaffiliate1` to `subaffiliate5`; long names take precedence, values truncated to 225 characters | -| `fbclid` | `attribution.metadata.fbclid` | `metadata.fbclid` | -| `clickid` | `attribution.metadata.clickid` | `metadata.clickid` | -| `evclid` | `attribution.metadata.everflow_transaction_id` | `metadata.everflow_transaction_id` and root `everflow_transaction_id` | -| `funnel` | `attribution.funnel` | `funnel` | - -Not supported on SDK 0.4.x: automatic attribution capture of `ttclid`, `msclkid`, `gbraid`, `wbraid` and `sg_evclid`. Keeping these values in the query string does not put them in order attribution. The live test confirmed that `ttclid` was absent from the SDK attribution. - -Unconfirmed live: SDK 0.5.0 captures `ttclid`, `msclkid`, `gbraid` and `wbraid` in order `attribution.metadata`. Source confirms these additions; the live test used 0.4.43. - -The cookies `_fbp` and `_fbc` map to `metadata.fb_fbp` and `metadata.fb_fbc`. On 0.4.43 the SDK reads them once per attribution collection, at SDK boot and again when the checkout form initializes. There is no delayed retry if the pixel sets them later. Missing cookies produce empty strings, which can overwrite earlier values. The SDK does not synthesize `_fbc` from `fbclid`. - -Automatic metadata includes `landing_page`, `referrer`, `device`, `device_type`, `domain`, `timestamp`, `conversion_timestamp`, `sdk_version` and `user_ip`. The SDK also collects `fb_fbp`, `fb_fbc` and `fb_pixel_id`. In the live test, the order's `metadata.landing_page` was the checkout URL, not the first presell URL. - -## How attribution persists - -The last value per parameter wins. A tagged URL replaces the stored value for each parameter it contains; absent parameters keep their earlier values. Alias precedence still applies: a stored `affid` takes precedence over a later `aff`, and stored `subaffiliate1` to `subaffiliate5` take precedence over the corresponding short names. - -SDK 0.4.43 keeps attribution in `sessionStorage` for the browser tab. It also stores `evclid` and the funnel name in `localStorage`. The live test observed the query string carried through checkout, upsell and receipt URLs. - -For links to other domains, configure `window.nextConfig.utmTransfer`: - -| Key | Behavior on SDK 0.4.43 | -| --- | --- | -| `enabled` | Must be `true` to run link parameter transfer | -| `applyToExternalLinks` | Set to `true` to include external links; defaults to `false` | -| `excludedDomains` | String array matched as substrings of external link URLs | -| `paramsToCopy` | String array of URL parameter names. Empty or absent copies all current URL parameters | -| `debug` | Enables extra logging | - -The transfer snapshots the current URL parameters at boot and appends missing parameters when you click a link. It keeps values already present in the destination link. - -Attribution is sent on prospect cart creation and order creation, including express payment orders. A failed prospect cart creation retry omits attribution. Upsell requests do not send it. - -See [checkout-link parameters](/docs/storefront/checkout-links) for checkout links, and [marketing attribution](/docs/apps/guides/marketing-attribution) for reading attribution from the `order.created` webhook. - -## Adding your own attribution values - -Use these SDK 0.4.43 methods to inspect or add attribution before your order is created: - -| Method | Behavior | -| --- | --- | -| `next.addMetadata(key, value)` | Merges one key into `attribution.metadata`; returns void | -| `next.setMetadata(metadata)` | Merges an object into existing metadata, without replacing it; returns void | -| `next.setAttribution(attribution: Record)` | Shallow-merges top-level attribution fields and merges any supplied `metadata`; returns void | -| `next.getAttribution()` | Returns the order-API attribution shape | -| `next.debugAttribution()` | Prints attribution in a console group; returns void | - -`setAttribution` does not update the separate stored URL-parameter copies. Collection on the next page can overwrite values you set with it. - -For example, capture `ttclid` as custom metadata on SDK 0.4.x: - -```javascript -window.nextReady = window.nextReady || []; -window.nextReady.push(function (next) { - const ttclid = new URLSearchParams(window.location.search).get('ttclid'); - if (ttclid) { - next.addMetadata('ttclid', ttclid); - } -}); -``` - -On Shop Sync stores, metadata keys reach Shopify only if you map them. See [tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). Unconfirmed live: Shop Sync metadata delivery was source-checked but was not part of the live test. - -## Where to read attribution - -Read your order's `attribution` object in the Admin API or the [Campaigns API](/docs/campaigns/api). The live test checked the Admin API order and confirmed the UTM fields, `gclid`, `affiliate`, `subaffiliate1`, `funnel` and `metadata.fbclid`. - -| Field in `attribution` | Contents | -| --- | --- | -| `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` | Captured campaign parameters | -| `affiliate` | Affiliate value | -| `subaffiliate1` to `subaffiliate5` | Subaffiliate values | -| `gclid` | Google click ID | -| `funnel` | Funnel name | -| `everflow_transaction_id` | Captured `evclid` | -| `metadata` | Captured metadata and values you added | - -The SDK sends non-empty top-level attribution fields and the metadata object. It does not send `first_visit_timestamp` or `current_visit_timestamp` to the API. - -For order notifications, read attribution from the `order.created` [webhook](/docs/webhooks). diff --git a/content/docs/campaigns/tracking/everflow.mdx b/content/docs/campaigns/tracking/everflow.mdx new file mode 100644 index 0000000..862b1f2 --- /dev/null +++ b/content/docs/campaigns/tracking/everflow.mdx @@ -0,0 +1,195 @@ +--- +title: Everflow +description: Report NEXT Campaigns funnel sales to Everflow with the Everflow app, for both redirect links and direct links, and avoid duplicate or missing conversions. +sidebar_label: Everflow +audience: [merchant, developer] +last_verified: 2026-11-16 +tags: + - Guide +--- +import { Callout } from 'fumadocs-ui/components/callout'; + +Everflow pays affiliates for sales, so a missing or duplicated conversion costs real money. This guide shows the setup we recommend and the mistakes to avoid. + +## How it works + +Everflow gives every ad click an ID, called the transaction ID. To report a sale, Everflow needs that same ID back. + +1. The shopper clicks an affiliate link, and Everflow creates a transaction ID. +2. Your funnel saves the transaction ID on the order. +3. The NEXT Everflow app sends the sale to Everflow from NEXT's servers, with that ID. + +The rule that keeps this working: **one order, one transaction ID, one thing reporting the sale.** + +## What we recommend + +- **Let the NEXT Everflow app report the sale.** It runs on NEXT's servers and only reports real, placed orders. +- **Use redirect links where you can.** They are the simplest and most reliable way to get the transaction ID onto the order. +- **Use direct links when the ad platform needs them**, with the bridge snippet below. +- **Do not also report the sale from Google Tag Manager.** A purchase tag in GTM alongside the app is the usual cause of duplicate conversions. + +## Before you start + +- Your Everflow network ID and postback URL, from your Everflow account or your affiliate network. +- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). + +## Set up the Everflow app + +1. In your store dashboard, open **Apps**, then **Everflow**. +2. Enter your **Everflow Postback URL** and **Everflow Network ID**. Only the domain of the postback URL is used; anything after it is ignored. +3. Keep **Enable Everflow S2S Postback** on. + +| Setting | What it does | +| --- | --- | +| **Everflow Postback Delay Minutes** | 0 by default, so the conversion is sent straight away and does not include upsells. Set it to up to 10 minutes so upsells accepted in that time are included in the amount | +| **Everflow Verification Token** | Optional. Sent with each conversion if your network requires one | +| **Include Tax in Conversion Value** | Off by default. The amount is the order total without tax unless you turn this on | +| **Enable S2S Postback for test orders** | Off by default. Test orders are skipped unless this is on | + +See the [Everflow app docs](https://docs.nextcommerce.com/docs/apps/everflow) for more. + +## Get the transaction ID onto the order + +Which setup you need depends on how your affiliate links work. + +| | Redirect links | Direct links | +| --- | --- | --- | +| How the shopper arrives | Through Everflow first, then to your funnel | Straight to your funnel | +| Where the transaction ID comes from | It is on the link, as `evclid` | Everflow's click script creates it in the browser | +| What you add to the funnel | Nothing | The bridge snippet | +| Use it when | The ad platform allows a redirecting link | The ad platform does not. Google Ads requires the final URL to stay on one domain | + +### Redirect links + +Set up your Everflow offer so the link to your funnel carries Everflow's transaction ID in a parameter named `evclid`: + +```text +https://funnel.example.com/?evclid=EVERFLOW_TRANSACTION_ID +``` + +Use Everflow's transaction ID macro for the value. See Everflow's [guide to parameters and macros](https://helpdesk.everflow.io/en/articles/6173403-a-guide-to-parameters-and-macros). + +The funnel saves it on the order by itself. Nothing else is needed. + +### Direct links + +With a direct link there is no `evclid`. Everflow's click script, which your affiliate partner usually runs in their own Google Tag Manager container, creates the transaction ID when the page loads. That ID then has to be handed to the funnel, or the order has no ID and nothing is reported. + +Keep the partner's own `EF.click` call as it is, and add this to what happens after it. It saves the ID and puts it on the order: + +```js +EF.click({ + // ...the partner's usual click settings (offer, affiliate, subs) +}).then(function (transactionId) { + // Do nothing when Everflow returns no ID, so a good ID is never replaced by an empty one. + if (!transactionId) return; + var id = String(transactionId); + + // Keep the ID for later pages. + try { localStorage.setItem('evclid', id); } catch (e) {} + + // Put the ID on the order. + var apply = function (next) { + next.setMetadata({ everflow_transaction_id: id }); + }; + if (window.next && typeof window.next.setMetadata === 'function') apply(window.next); + else if (Array.isArray(window.nextReady)) window.nextReady.push(apply); +}); +``` + + +Each time the click script runs, Everflow can create a new transaction ID. If that happens on the checkout or upsell page, the order and the conversion can end up with different IDs. Use one of these: + +- Run the click once per visit, on the page the shopper lands on. +- Or run it on every page, but pass the saved ID back in as `transaction_id`, so Everflow reuses it. If you run more than one offer on a domain, only pass an ID back for the offer it was created for. + +Either way, do not attach the click script to a purchase or upsell tag. + + +Direct links are less reliable than redirect links. If the click script does not return an ID, for example because it was blocked, that order has no ID and is not reported. + +## Affiliate details on the link + +The funnel 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). + +## What the app sends + +For each order with a transaction ID, the app sends a conversion to Everflow with: + +- Your network ID +- The transaction ID +- The order number, as Everflow's Order ID +- The amount and currency + +The app sends only these fields, plus the verification token if you set one. If your affiliate network's postback needs extra parameters, such as `aid` or `adv1`, set the Everflow offer up to work with the standard fields. + +An order is not sent when it has no transaction ID, or when it is canceled. + +If an order is reopened later, for example after being archived, the app sends its conversion again with the same transaction ID. Keep **Allow Duplicate Conversions** off on the Everflow offer so Everflow rejects the repeat. + +## More rules to avoid duplicate and missing conversions + +- **Never pay affiliates from a GTM purchase tag alone.** A browser tag can fire without a completed order behind it. The app cannot. +- **Funnel-step events are fine in GTM.** A partner can send page views, checkout started and similar events from their own container. Those are not sales. +- **Changing setups? Add before you remove.** When moving a partner from a GTM conversion tag to the app, add the bridge, check one test order end to end, and only then remove the old tag. + +## If a partner also reports from GTM + +Some partners want their own Everflow conversion tag in GTM as well as the app. That only works when the tag sends the same transaction ID that is on the order. + +- **Pass the ID yourself.** Read it from where the click script saved it: + +```js +EF.conversion({ + // ...the partner's other fields + transaction_id: localStorage.getItem('evclid') +}); +``` + +- **Do not let Everflow pick the ID.** A conversion sent without `transaction_id`, or one that uses `EF.getTransactionId()` or `EF.getAdvertiserTransactionId()`, can send a different click's ID, or several IDs joined together. The sale is then credited to the wrong click, or counted twice. +- **Turn off Allow Duplicate Conversions** on the Everflow offer. Everflow then rejects the second copy of a sale it already has. +- **Put quotes around GTM variables** inside the tag, for example `'{{DLV - Order ID}}'`. Without quotes, a value that is not a number breaks the whole tag and the conversion never fires. + +## More than one affiliate network + +**Several affiliates in one Everflow network** need nothing extra. Each click gets its own transaction ID, and the app reports every sale to that network. + +**A second Everflow network on the same store** needs its own setup. The app holds one network ID, and it sends whatever is in the order's Everflow transaction ID to that network. So the second network must stay out of that slot: + +1. **Put the second network's click ID in a `sub` parameter** on its links, for example `sub2`. Do not use `evclid`. +2. **Let the second network report its own sales** from a conversion tag in its own GTM container, sending that click ID. +3. **Keep its click script separate.** It must not save its ID as `evclid`, and must not set `everflow_transaction_id` on the order. +4. **Run each network's scripts only on its own traffic.** If both containers can load on the same pages, make each network's tags fire only for visits that came from that network. + +| | First network | Second network | +| --- | --- | --- | +| Click ID arrives as | `evclid`, or the bridge | A `sub` parameter, for example `sub2` | +| Sale reported by | The NEXT Everflow app | The network's own GTM conversion tag | +| Saved on the order as | Everflow transaction ID | Subaffiliate 2 | + +If the second network's ID ends up in `evclid`, its sales are sent to the first network and credited there. + +## Verify it works + +1. Turn on **Enable S2S Postback for test orders** in the app. +2. Open your funnel through an Everflow test link, in a new private window. +3. Place an order with a [test card](/docs/testing). +4. Open the order in your store dashboard. Its attribution should show an Everflow transaction ID. +5. In Everflow, search for that transaction ID. You should see one conversion with your order number as the Order ID. +6. **Reject the test conversion in Everflow.** If you do not, it counts as a real conversion and the affiliate is paid for it. +7. Turn **Enable S2S Postback for test orders** off again. + +## Comparing your numbers with your partner's + +- **Match on the order number.** Everflow's Order ID is the NEXT order number. The transaction ID is the click's ID and never matches an order number. +- **Use the same timezone.** NEXT reports in your store's timezone and Everflow defaults to UTC. Line them up before comparing counts. + +## Troubleshooting + +| Problem | Likely cause | Fix | +| --- | --- | --- | +| No conversions in Everflow | The orders have no transaction ID | Redirect links: check `evclid` is on the link. Direct links: check the bridge is in the click script | +| Some direct-link orders are missing | The click script did not return an ID for those visits | Use redirect links where the ad platform allows | +| Conversions counted twice | A GTM conversion tag and the app both report the sale with different IDs | Remove the GTM tag, or make it send the order's transaction ID. See [If a partner also reports from GTM](#if-a-partner-also-reports-from-gtm) | +| A sale is credited to the wrong affiliate or offer | The conversion used an ID from an earlier click | Pass `transaction_id` from the saved ID, and run the click once per visit | +| The amount is lower than expected | Tax is left out, or the upsell was accepted after the conversion was sent | Turn on **Include Tax in Conversion Value**, or set a postback delay | diff --git a/content/docs/campaigns/tracking/getting-started.mdx b/content/docs/campaigns/tracking/getting-started.mdx index ee7b5f4..9a00eee 100644 --- a/content/docs/campaigns/tracking/getting-started.mdx +++ b/content/docs/campaigns/tracking/getting-started.mdx @@ -1,6 +1,6 @@ --- title: Set up tracking -description: The first steps for tracking a NEXT Campaigns funnel. What NEXT does for you, what you configure, how to turn vendors on in a starter template, and how to run your first test order. +description: Turn on tracking for a NEXT Campaigns funnel. 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 @@ -9,140 +9,91 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -This page gets a funnel ready to track and walks you through your first test. Do it once per funnel, then open the guide for each platform you use. How the parts fit together is explained in the [Tracking overview](/docs/campaigns/tracking#how-tracking-works). - -## What NEXT handles and what you configure - -| NEXT handles | You configure | -| --- | --- | -| The Campaign Cart SDK captures UTM parameters and click IDs from the landing URL and attaches them to the order | Your vendor IDs, one key per vendor in `_data/campaigns.json` | -| The SDK emits an ecommerce event stream (`dl_*` events in `window.NextDataLayer`) on every funnel page | Turning on the SDK providers for Google Tag Manager, Meta and RudderStack in `assets/config.js` | -| NEXT campaign analytics (session tracking) is on by default through the `nextCampaign` provider | Your funnel domain, added as a **Production** domain in the Campaigns app | -| Once you install the Meta Pixel app, it sends a server-side Purchase for campaign orders | Installing the Meta Pixel app, adding your pixel ID and access token, and setting `storeName` in `assets/config.js` | -| On Shop Sync stores, Shop Sync pushes campaign orders to Shopify | Choosing one purchase sender for each platform | -| | Consent handling. NEXT Campaigns has no built-in consent banner; see [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent) | -| | Testing with a test order before you launch | - -The Meta Pixel app's server Purchase and the Shop Sync order push were not part of NEXT's test order on 2026-11-16. Treat them as unconfirmed until you check them on your own store. +This page turns tracking on for a funnel and walks you through a first test. Do it once per funnel. For how tracking works, see the [Tracking overview](/docs/campaigns/tracking). ## Before you start -- A NEXT store with a campaign in the Campaigns app. See [NEXT Campaigns](/docs/campaigns). -- A funnel built from a [starter template](/docs/campaigns/templates) with the [Page Kit](/docs/campaigns/page-kit), or a funnel you built by hand with the Campaign Cart SDK. The `landing` template family loads no SDK and no analytics, so it cannot be tracked as shipped. -- Your funnel domain added in the Campaigns app. Open **Settings**, then **Allowed Domains**, click **Add Domain**, enter the **Domain** and set **Environment** to **Production** or **Development**. Requests from a domain that is not listed are rejected. -- An account with each ad or analytics platform you plan to use, and the ID each guide asks for. - - -The Campaigns app says "Analytics and event tracking are ignored for development domains." That applies to NEXT's own campaign analytics: it ignores events from a development domain. The SDK has no domain check, so on a development domain the `dl_*` events still fire and vendor pixels still send to your ad accounts. The starter templates leave out their tracking markup only when you build with `npm run dev`, whatever the domain. If test traffic must stay out of a vendor's data, leave that vendor's key empty in builds you deploy to a development domain. - +You need: -## Choose your path +- A funnel built from a [starter template](/docs/campaigns/templates). The `landing` template family has no tracking, so use one of the others. +- Your funnel's domain added in the Campaigns app. Open **Settings**, then **Allowed Domains**, click **Add Domain**, and set **Environment** to **Production**. +- The ID for each platform you advertise on, such as your Meta pixel ID or GA4 measurement ID. Each platform guide says where to find it. -- Starter template funnel: add one key per vendor to the campaign's entry in `_data/campaigns.json`. For Google Tag Manager and Meta, also turn on the matching provider flag in `assets/config.js`. Follow [Configure a starter template funnel](#configure-a-starter-template-funnel). -- Hand-built funnel: you can use the SDK providers for Google Tag Manager, Meta and RudderStack, set in `window.nextConfig.analytics`, and send everything else from your own GTM container. The SDK does not load the GTM container, the Meta pixel or the RudderStack SDK, so your pages must include them. The template analytics adapters for GA4, Triple Whale, TikTok and the others are not packaged for hand-built funnels, and no hand-built page was tested. See [Known gaps](/docs/campaigns/tracking#known-gaps) and the [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) guide. -- Shop Sync store: read [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) first. Some Shopify-side tools already see the synced orders, which changes where each purchase should come from. +Built your funnel by hand instead of from a starter template? See [Hand-built funnels](#hand-built-funnels). -## Configure a starter template funnel +## Step 1: Add your platform IDs -1. Open `_data/campaigns.json` and find the entry for your campaign. -2. Add the key for each vendor you use. A missing or empty key leaves that vendor off. Any other value, including a placeholder, turns it on. - -| Vendor | Key in `_data/campaigns.json` | Guide | -| --- | --- | --- | -| Google Tag Manager | `gtm_id` | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | -| Meta pixel | `fb_pixel_id` | [Meta](/docs/campaigns/tracking/meta) | -| Google Analytics 4 | `ga4_id` | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | -| Triple Whale | `triplewhale_name` | [Triple Whale](/docs/campaigns/tracking/triple-whale) | -| TikTok | `tiktok_pixel_id` | [TikTok](/docs/campaigns/tracking/tiktok) | -| Google Ads and YouTube | No key of its own | [Google Ads and YouTube](/docs/campaigns/tracking/google-ads) | -| Northbeam | `northbeam_client_id` | [Northbeam](/docs/campaigns/tracking/more-integrations#northbeam) | -| Snapchat | `snap_pixel_id` | [Snapchat](/docs/campaigns/tracking/more-integrations#snapchat) | -| Pinterest | `pinterest_tag_id` | [Pinterest](/docs/campaigns/tracking/more-integrations#pinterest) | -| Taboola | `taboola_account_id` (numbers only) | [Taboola](/docs/campaigns/tracking/more-integrations#taboola) | -| AppLovin Axon | `axon_event_key` | [AppLovin Axon](/docs/campaigns/tracking/more-integrations#applovin-axon) | -| RudderStack | `rudderstack_write_key` and `rudderstack_dataplane_url` (both required) | [RudderStack](/docs/campaigns/tracking/more-integrations#rudderstack) | - -Each guide lists the optional keys for its vendor, such as event filters and identity settings. +Open `_data/campaigns.json`, find your campaign, and add a line for each platform you use. ```json title="_data/campaigns.json" { "my-campaign": { "name": "My Campaign", - "sdk_version": "0.4.43", - "gtm_id": "GTM-XXXXXXX", "fb_pixel_id": "123456789012345", "ga4_id": "G-XXXXXXXXXX", - "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX", - "triplewhale_name": "your-store.myshopify.com" + "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX" } } ``` -If you set both `gtm_id` and `ga4_id`, do not also add a GA4 tag for the same property inside your GTM container. Two paths send every GA4 event twice. - -3. For Google Tag Manager, Meta and RudderStack, also turn on the provider in `assets/config.js`. The key in `_data/campaigns.json` loads the vendor's script; the provider flag makes the SDK send its events to it. With only the key set, the GTM container loads but receives no `dl_*` events from the SDK, and the Meta pixel loads but sends no events. - - Google Tag Manager: set `analytics.providers.gtm.enabled` to `true`. - - Meta: set `analytics.providers.facebook.enabled` to `true`, and set `settings.pixelId` to the same ID as `fb_pixel_id`. - - RudderStack: set `analytics.providers.rudderstack.enabled` to `true`. -4. Set `storeName` to your store subdomain, for example `your-store`. The templates ship with `'store-name'`. The SDK's Meta provider uses it to give the browser Purchase the event ID `your-store-`, the same format the Meta Pixel app uses for its server Purchase. Without it, the browser Purchase has no event ID. -5. Keep `analytics.enabled: true` and `mode: 'auto'`. Only `'auto'` starts the SDK's automatic tracking. Any other value, including `'manual'`, `'disabled'` or no `mode` at all, sends no `dl_user_data` and no `dl_purchase`. To turn analytics off, set `enabled: false`; `mode: 'disabled'` does not do it. -6. Build for production with `npm run build`. The tracking markup is left out of `npm run dev` builds. -7. Deploy to the domain you added as **Production**. - -The `analytics` block with Google Tag Manager and Meta turned on looks like this. Leave the other entries as they ship. - -```js title="assets/config.js (excerpt)" - storeName: 'your-store', - analytics: { - enabled: true, - mode: 'auto', - providers: { - nextCampaign: { - enabled: true - }, - gtm: { - enabled: true - }, - facebook: { - enabled: true, - settings: { - pixelId: "123456789012345" - } - }, - rudderstack: { - enabled: false, - settings: {} - } - } - }, -``` +| Platform | Line to add | Guide | +| --- | --- | --- | +| Google Tag Manager | `gtm_id` | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | +| Google Analytics 4 | `ga4_id` | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | +| Google Ads and YouTube | No line of its own. Uses GA4 | [Use GA4 purchases in Google Ads](/docs/campaigns/tracking/google-analytics-4#use-ga4-purchases-in-google-ads) | +| Meta | `fb_pixel_id` | [Meta](/docs/campaigns/tracking/meta) | +| Triple Whale | `triplewhale_name` | [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| AppLovin Axon | `axon_event_key` | [AppLovin Axon](/docs/campaigns/tracking/applovin-axon) | +| TikTok, Snapchat, Pinterest, Taboola, Northbeam | One line each | [More integrations](/docs/campaigns/tracking/more-integrations) | +| RudderStack | Two lines | [More integrations](/docs/campaigns/tracking/more-integrations#rudderstack) | - -The starter templates pin SDK 0.4.43 through `sdk_version`, and this page describes that version. SDK 0.5.0 reads these settings from `analytics.destinations` and still maps the 0.4.x `providers` keys and `storeName`. That mapping was not tested. - +Leave a line out, or leave it empty, to keep that platform off. Anything else turns it on, so do not leave placeholder values in. + +## Step 2: Finish the setup in each platform guide + +Open the guide for each platform you added and follow its **Set up** section. Some platforms need one more setting: + +- **Meta, Google Tag Manager and RudderStack** also need to be switched on in `assets/config.js`. +- **Meta** also needs your store name in `assets/config.js`, and the Meta Pixel app if you want purchases sent from NEXT's servers. + +Leave the rest of the `analytics` settings in `assets/config.js` as they ship. + +## Step 3: Publish -## Pick one purchase sender +Build with `npm run build` and deploy to the domain you added as **Production**. -A campaign order can reach the same platform from the funnel's browser pixel, from a NEXT store app on the server, and on Shop Sync stores from a Shopify-side app that reads the synced order. Decide which one sends the purchase for each platform before you launch. For Meta, the browser Purchase and the Meta Pixel app's server Purchase are built to share the event ID `your-store-` when `storeName` is set, so Meta can deduplicate them. For any other platform, send the purchase from one place only. The rules are in [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +`npm run dev` leaves tracking out, so you will not see any events there. Test on a deployed production build. + -## Run your first test +## Step 4: Run a test order -1. Open a fresh browser profile, then open your first funnel page on the production domain with UTM parameters and `nfdebug=true` on the URL: +1. Open a new private browser window. +2. Open your funnel with test details on the link: ```text -https://funnel.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch-test&nfdebug=true +https://funnel.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch-test ``` -2. In the browser console, run `next.getAttribution()`. You should see your `utm_*` values, and any click ID you added, such as `gclid` or `metadata.fbclid`. SDK 0.4.43 does not store `ttclid`. -3. Move through checkout and place a test order with a [test card](/docs/testing). -4. On the first page after payment (the upsell page, or the receipt if there is no upsell), check `window.NextDataLayer`. It should contain one `dl_purchase` with your order number as `transaction_id`. If you accept an upsell, the next page should show `dl_upsell_purchase` with a `transaction_id` ending in `-US1`. -5. Run `NextForwarder.getStatus()`. Each template adapter you turned on should show `active: true`, and its `sent` count should rise as you move through the funnel. `NextForwarder` exists only on starter templates with at least one adapter vendor set. Google Tag Manager and RudderStack never appear in it, and Meta appears only when `meta_advanced_matching_enabled` is on. -6. Open the **Verify it works** section of each platform guide, for example [Meta](/docs/campaigns/tracking/meta#verify-it-works), and check the vendor's own tools. +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. +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`. - -`?ignore=true` turns off every analytics event for the browser tab, including `dl_purchase`, and the SDK carries it to the next pages. If you used it earlier, open a new tab or run `window.NextAnalyticsClearIgnore()` before you test. - +Things to know when testing: + +- A test order still reports a purchase to your ad platforms. Platforms cannot tell it is a test. +- Each order is reported once. Reloading the page after payment, or coming back to it, does not report it again. +- Do not add `?ignore=true` to the link. It turns tracking off for that browser tab. + +Something not showing up? See [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Before you launch + +Make sure each platform hears about a sale once. If more than one thing reports purchases to the same platform, the sale is counted twice. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +If your orders sync to Shopify through Shop Sync, read [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) before you launch. -Test orders still fire the browser events. The Meta Pixel app skips test orders unless **Enable Sending Test Data** is on in its settings. The SDK sends `dl_purchase` once per order in each browser, so use a fresh browser profile for each test order. +## Hand-built funnels -More checks and fixes are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). +The steps above are for starter templates, which include the tracking code for every supported platform. A funnel you built by hand does not include it. For a hand-built funnel, load your own Google Tag Manager container on every page and send events to your platforms from there. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). diff --git a/content/docs/campaigns/tracking/google-ads.mdx b/content/docs/campaigns/tracking/google-ads.mdx deleted file mode 100644 index f1a42d4..0000000 --- a/content/docs/campaigns/tracking/google-ads.mdx +++ /dev/null @@ -1,207 +0,0 @@ ---- -title: Google Ads and YouTube -description: Count NEXT Campaigns funnel purchases as Google Ads conversions, including for YouTube ads, by importing GA4 key events or by adding Google Ads tags to your own GTM container. Support is partial; this guide lists what exists and what does not. -sidebar_label: Google Ads and YouTube -audience: [merchant, developer] -last_verified: 2026-11-16 -tags: - - Guide ---- -import { Callout } from 'fumadocs-ui/components/callout'; -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - -## Verification status - -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| The SDK captures `gclid` from the landing URL and stores it on the order as `attribution.gclid` | Verified | SDK source, and a test order: `gclid` seen in `next.getAttribution()` on the first page and on the order's attribution through the Admin API | 2026-11-16 | 0.4.43 | -| The GA4 adapter sends `purchase` and `upsell_purchase` from the funnel | Verified | Test order, `gtag` calls and GA4 requests observed in the browser (see [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#verification-status)) | 2026-11-16 | 0.4.43 | -| The SDK pushes `dl_purchase` and `dl_upsell_purchase` to `window.dataLayer` with `transaction_id`, `value` and `currency` | Verified | SDK source, and the same test order with the SDK's GTM provider on and no container loaded | 2026-11-16 | 0.4.43 | -| `gbraid` and `wbraid` are not stored on the order on SDK 0.4.x, and are stored in attribution metadata on SDK 0.5.0 | Unconfirmed | SDK source for both versions; not walked | 2026-11-16 | 0.4.43, 0.5.0 | -| GA4 key events imported into Google Ads count as Google Ads conversions | Unconfirmed | Google's help documentation only | 2026-11-16 | | -| Google Ads conversion tags in your GTM container fire on `dl_purchase` and `dl_upsell_purchase` | Unconfirmed | SDK source only; no GTM container or Google Ads tag was loaded in the test | 2026-11-16 | 0.4.43 | -| `gclid` reaches the Shopify order on Shop Sync stores through a metadata mapping | Unconfirmed | Shop Sync metadata guide only; not walked | 2026-11-16 | | -| A Google Ads key or adapter in the starter templates, a NEXT server-side Google Ads sender, enhanced conversions | Not supported | Starter template and store app source | 2026-11-16 | | - -NEXT did not use a Google Ads account for this test, so whether conversions arrive and report in Google Ads, by either path, was not checked. - -## What it does - -YouTube ads are bought and measured through Google Ads, so this one guide covers both. Nothing on this page is specific to YouTube. - -NEXT has no dedicated Google Ads integration for campaign funnels. The starter templates have no Google Ads key or adapter, and no NEXT store app sends Google Ads conversions from the server for campaign orders. What NEXT does provide: - -- The SDK captures the Google click ID (`gclid`) from the ad's landing URL and stores it on the order. -- The GA4 adapter and the SDK's GTM provider send each purchase and accepted upsell from the funnel with the order number, value and currency. - -You get those purchases into Google Ads in one of two ways: - -| Path | How it works | Guide you set up first | -| --- | --- | --- | -| Import GA4 key events | The GA4 adapter sends `purchase` and `upsell_purchase` to your GA4 property. You mark them as key events and import them into Google Ads as conversions | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | -| Google Ads tags in your GTM container | Your own GTM container listens for the SDK's `dl_purchase` and `dl_upsell_purchase` events and fires your Google Ads conversion tags | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | - -Use one path for each conversion, not both. Running both counts every purchase twice. - -These are not available: - -- A dedicated Google Ads key in `_data/campaigns.json` or a Google Ads adapter. -- Enhanced conversions. Nothing in the templates or the SDK sends hashed customer data to Google Ads. -- Server-side conversion upload. Storing `gclid` on the order does not send anything to Google Ads, and NEXT has no feature that uploads orders or click IDs to Google Ads. - - -The [Google Analytics 4 store app](https://docs.nextcommerce.com/docs/apps/google-analytics-4) has its own Google Ads conversion settings. That app runs on your NEXT storefront only and does not load on a campaign funnel, so those settings do nothing for campaign orders. - - -## Before you start - -- A Google Ads account with auto-tagging turned on. Without auto-tagging, ad clicks carry no `gclid`. -- A funnel built from a starter template, with your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. On a development domain only NEXT campaign analytics ignores the events; vendor tags still fire. -- For the GA4 import path: - - GA4 set up on the funnel and working. Follow [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) first. - - Your Google Analytics and Google Ads accounts linked. - - Administrator or editor access to the GA4 property. Google's help says you need at least Marketer access to import. -- For the GTM path: - - Your own GTM container loading on the funnel with the SDK's GTM provider on. Follow [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) first. - - A Google Ads conversion action for purchases, and one for upsells if you want to count them separately. - -## Set up - - - - -### Import GA4 key events - -1. Set up the GA4 adapter with your measurement ID (`ga4_id`) as described in [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#set-up), and check that `purchase` arrives. -2. In GA4, mark `purchase` as a key event. Mark `upsell_purchase` too if you want upsell revenue to count in Google Ads. -3. Link your Google Analytics property to your Google Ads account, and turn on auto-tagging in Google Ads. -4. In GA4, open **Advertising**, then **Tools**, then **Conversion management**, and select **New conversion**. Pick your Google Ads account, pick the key events, choose a conversion category and save. Events you pick from the events list in this flow are marked as key events. Google's steps are in [Create Google Ads conversions from GA4 key events](https://support.google.com/google-ads/answer/10632359?hl=en). -5. In Google Ads, check how the new conversion actions are set to count. Google's help explains why a conversion created this way can be marked as a secondary conversion action. Secondary actions are not used for bidding until you change them. - -Google notes that this feature may not be available to every Google Analytics property. - -### Google Ads tags in your GTM container - -1. Load your GTM container on the funnel and turn on the SDK's GTM provider, as described in [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager#set-up). The SDK does not load GTM itself. -2. In GTM, add data layer variables for `ecommerce.transaction_id`, `ecommerce.value` and `ecommerce.currency`. -3. Add a trigger that fires on the `dl_purchase` event. -4. Add a Google Ads conversion tag for your purchase conversion action. Set its transaction ID, value and currency from the variables in step 2, and attach the `dl_purchase` trigger. -5. To count upsells, add a second trigger on `dl_upsell_purchase` and a second Google Ads conversion tag that uses it. -6. Publish the container, build the funnel with `npm run build`, and deploy. The analytics markup is left out of `npm run dev` builds. - -If you use this path, do not also import the GA4 `purchase` key event for the same conversion. - - - - -This guide is documented for starter templates only for now. It was written against the starter template set-up, and no hand-built page was tested. On a hand-built funnel, the closest supported path is your own GTM container reading the SDK's `dl_*` events. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). - - - - -## Events sent - -Google Ads receives nothing from NEXT directly. It receives what your GA4 property or your GTM tags pass on. - -| Funnel event | GA4 import path | GTM path | When it fires | -| --- | --- | --- | --- | -| `dl_purchase` | GA4 `purchase`, imported as a conversion | Trigger for your purchase conversion tag | The first page after payment (upsell or receipt), once per order | -| `dl_upsell_purchase` | GA4 `upsell_purchase`, imported as a conversion if you choose | Trigger for your upsell conversion tag, if you add one | The page after an upsell is accepted | - -The other funnel events (page views and checkout steps) also reach GA4 and your GTM container. See their guides for the full lists. This guide covers purchase conversions only. - -## Attribution requirements - -- Auto-tagging must be on in Google Ads so the landing URL carries `gclid`. -- The SDK reads `gclid` from the landing URL, keeps it for the browser tab session, and sends it on the order as `attribution.gclid`. A new `gclid` on a later page replaces the old one. -- The SDK carries the query string through the checkout, upsell and receipt pages, so Google's tags on those pages see the same URL parameters as the landing page. -- Keep every funnel page on one domain, or on subdomains of one domain, so the GA4 cookie is shared across the funnel. See [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#attribution-requirements). -- SDK 0.4.x does not store `gbraid` or `wbraid` on the order. It keeps them in the funnel's page links, but they are not in the order's attribution. SDK 0.5.0 stores both in the order's attribution metadata. - -### Shop Sync stores - -On a store that uses Shop Sync, campaign orders are copied into Shopify. A Google Ads conversion tracked on the Shopify side, for example by a Shopify Google app, does not see the funnel visit, because the shopper never loaded a Shopify page. - -Shop Sync does not copy `gclid` to the Shopify order on its own. According to the [Shop Sync metadata guide](https://guides.nextcommerce.com/guides/shop-sync-metadata), it reaches the Shopify order only when: - -1. A metadata field for it exists in NEXT, under **Settings**, then **Metadata Fields**, on the attribution object. See [Metadata fields and tags](https://docs.nextcommerce.com/docs/build-a-store/technical-settings/metadata-fields-and-tags). -2. The value is in the order's attribution metadata. The guide notes that `gclid` is a standard attribution field rather than metadata, so it has to be copied into metadata first, with the SDK's `next.addMetadata('gclid', ...)`. -3. The field is mapped to a Shopify order metafield in Shop Sync with **Add Metadata Sync**. The types must match, for example a NEXT text field to a Shopify single line text field. - -Metafields are written once, when the Shopify order is created. This mapping is Unconfirmed: NEXT has not walked it. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) for which Shopify-side tools see synced orders. - -## Purchases, revenue and upsells - -| Field | Order purchase | Upsell | -| --- | --- | --- | -| Event | `dl_purchase`, sent to GA4 as `purchase` | `dl_upsell_purchase`, sent to GA4 as `upsell_purchase` | -| `transaction_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | -| `value` | Item revenue without shipping (tax excluded on stores that show prices without tax, included on tax-inclusive stores) | The upsell line only | -| `currency` | The order currency | The order currency | - -Upsells are sent as separate events. If you import only `purchase`, or add only a `dl_purchase` tag, Google Ads counts the first sale and not the upsell revenue. Because `value` excludes tax and shipping, Google Ads conversion value will be lower than the order total. - -`dl_purchase` is sent once per order in a browser. A reload or revisit of the page does not send it again. - -## Browser and server events - -Google Ads gets campaign conversions from the browser only, through GA4 or your GTM tags. NEXT sends no Google Ads events from the server, so there is no server event to deduplicate against. - -Send each purchase from one place: either the GA4 import or a GTM conversion tag, and not a Shopify-side Google app on top. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). - -## Worked example - -A Google Ads click to a funnel that uses the GA4 import path. The campaign entry sets only GA4: - -```json title="_data/campaigns.json" -{ - "summer-offer": { - "name": "Summer Offer", - "sdk_version": "0.4.43", - "ga4_id": "G-XXXXXXXXXX" - } -} -``` - -With auto-tagging on, a shopper lands on `https://offers.example.com/presell/?utm_source=google&utm_medium=cpc&utm_campaign=summer-offer&gclid=EXAMPLE_GCLID`, buys the $12 main offer and accepts a $3 upsell. - -| Where | What you see | -| --- | --- | -| The NEXT order | `attribution.gclid` is `EXAMPLE_GCLID`, with `utm_source`, `utm_medium` and `utm_campaign` alongside it | -| GA4, upsell page | `purchase` with `transaction_id` `100041` and `value` 12 | -| GA4, receipt page | `upsell_purchase` with `transaction_id` set to the order reference plus `-US1` and `value` 3 | -| Google Ads | One conversion for `purchase`, plus one for `upsell_purchase` if you imported it (Unconfirmed) | - -## Verify it works - -1. Open a funnel page on your production domain with a test click ID on the URL, for example `?gclid=EXAMPLE_GCLID&nfdebug=true`. Do not add `?ignore=true`, which turns all tracking off for the browser tab. -2. In the browser console, run `next.getAttribution()`. It should show your `gclid`. -3. Place a test order with a [test card](/docs/testing) and accept an upsell. -4. Check the order's attribution, for example through the Admin API. `attribution.gclid` should hold your test value. -5. For the GA4 path, confirm `purchase` and `upsell_purchase` as described in [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#verify-it-works). -6. For the GTM path, use Google Tag Assistant to confirm your conversion tags fire on `dl_purchase` and `dl_upsell_purchase` with the order number, value and currency. - - -The SDK does not check whether an order is a test order. A test order sends `purchase` to your GA4 property and fires your GTM tags like a real one, so it can be counted in Google Ads through either path. - - -More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). - -## Troubleshooting and limits - -| Symptom | Likely cause | Fix | -| --- | --- | --- | -| No `gclid` on the order | Auto-tagging is off, or the ad's URL drops the query string before the funnel loads | Turn on auto-tagging; check the landing URL in the browser carries `gclid` | -| Every conversion counted twice | Both paths run for the same conversion, or a Shopify-side Google app also counts the synced order | Keep one sender per conversion | -| Upsell revenue missing in Google Ads | `upsell_purchase` was not imported, or there is no `dl_upsell_purchase` tag | Import the key event or add the tag | -| Conversion value lower than the order total | `value` is item revenue and leaves out shipping, and tax on tax-exclusive stores | Compare against item revenue in NEXT | -| Imported conversion not used for bidding | It was created as a secondary conversion action | Change it in Google Ads | -| Cannot create a conversion from GA4 | Missing access, unlinked accounts, or the feature is not available to the property | Check the prerequisites in [Google's help](https://support.google.com/google-ads/answer/10632359?hl=en) | -| Google Ads settings in the Google Analytics 4 store app have no effect | That app runs on the storefront only | Use one of the two paths on this page | - -- There is no Google Ads key or adapter in the starter templates. -- There are no enhanced conversions and no server-side conversion upload from NEXT. -- NEXT has not verified that imported conversions or GTM conversion tags report correctly in Google Ads. -- SDK 0.4.x does not store `gbraid` or `wbraid` on the order. -- An upsell accepted as a bundle sends one `dl_upsell_purchase` per item in the bundle, each valued at the whole bundle total (from SDK source, not walked). A conversion tag or imported key event counts each of them. -- Google Ads receives no conversion for subscription renewals or other orders created without a funnel visit. diff --git a/content/docs/campaigns/tracking/google-analytics-4.mdx b/content/docs/campaigns/tracking/google-analytics-4.mdx index fb35f11..0fb87ac 100644 --- a/content/docs/campaigns/tracking/google-analytics-4.mdx +++ b/content/docs/campaigns/tracking/google-analytics-4.mdx @@ -1,44 +1,25 @@ --- title: Google Analytics 4 -description: Send NEXT Campaigns funnel page views, checkout steps, purchases and upsells to a GA4 property with the starter template GA4 adapter, and check the events arrive. +description: Track a NEXT Campaigns funnel 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 tags: - Guide --- -import { Callout } from 'fumadocs-ui/components/callout'; -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; -## Verification status +The starter templates include Google Analytics 4. Add your measurement ID and the funnel reports page views, checkout steps and purchases to your GA4 property. -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| Setting `ga4_id` loads `gtag.js` and the GA4 adapter on every funnel page | Verified | Starter template source, and a production build of the Olympus template | 2026-11-16 | 0.4.43 | -| Funnel events reach `gtag` with the names below | Verified | Test order, `gtag` calls and `/g/collect` requests observed in the browser | 2026-11-16 | 0.4.43 | -| Accepted upsells arrive as a separate `upsell_purchase` event | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | -| Events appear in GA4 reports and DebugView | Unconfirmed | Not checked: the test used a placeholder measurement ID | | | - -The browser side was checked with a placeholder measurement ID, so what GA4 does with the events after it receives them was not checked. - -## What it does - -The GA4 adapter loads Google's `gtag.js` with your measurement ID on every funnel page and sends the SDK's funnel events to GA4 as GA4 ecommerce events. It covers presell, landing, checkout, upsell and receipt pages. It runs in the browser only. NEXT does not send GA4 events from the server, and the Google Analytics 4 store app does not load on campaign funnels. +GA4 events are sent from the shopper's browser only. The **Google Analytics 4** store app covers your NEXT storefront, not funnels. ## Before you start -- A GA4 property and a web data stream. Copy its measurement ID (it starts with `G-`). -- A funnel built from a starter template. The adapter ships with every template family except `landing`. -- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. -- Match the property's currency and time zone to your NEXT store so reports line up. +- Your GA4 measurement ID. It starts with `G-`. +- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up - - - -1. Open `_data/campaigns.json` and find the entry for your campaign. -2. Add your measurement ID: +1. In `_data/campaigns.json`, add your measurement ID to your campaign: ```json title="_data/campaigns.json" { @@ -49,92 +30,71 @@ The GA4 adapter loads Google's `gtag.js` with your measurement ID on every funne } ``` -3. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds, so tracking does not load in the development server. -4. Deploy, then follow [Verify it works](#verify-it-works). +2. Build with `npm run build` and deploy. -Do not also add a GA4 tag in Google Tag Manager or in the page for the same property. Two paths send every event twice. +Do not also add a GA4 tag for the same property in Google Tag Manager. Two copies send every event twice. - - +## What gets tracked -The GA4 adapter is documented for starter templates only. It was not tested on a hand-built page, and it is not published as a standalone package. On a hand-built funnel, send the SDK's `dl_*` events to GA4 from your own Google Tag Manager container instead. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). +| When | GA4 event | +| --- | --- | +| Any page loads | `page_view` | +| A page shows a product | `view_item` | +| An item is added to the cart | `add_to_cart` | +| The checkout loads | `begin_checkout` | +| A shipping address is entered | `add_shipping_info` | +| Payment details are entered | `add_payment_info` | +| 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. -## Events sent +To stop an event, add `ga4_blocked_events` to your campaign, for example `"ga4_blocked_events": "dl_add_shipping_info"`. -By default the adapter forwards eight SDK events. The table shows what each becomes in GA4. +## Purchases and upsells -| SDK event | GA4 event | When it fires | +| | Order | Upsell | | --- | --- | --- | -| `dl_user_data` | `page_view` | Every page load | -| `dl_view_item` | `view_item` | A page shows a package | -| `dl_add_to_cart` | `add_to_cart` | An item is added to the cart | -| `dl_begin_checkout` | `begin_checkout` | The checkout form loads | -| `dl_add_shipping_info` | `add_shipping_info` | A valid shipping address is entered | -| `dl_add_payment_info` | `add_payment_info` | Payment details are complete | -| `dl_purchase` | `purchase` | The first page after payment | -| `dl_upsell_purchase` | `upsell_purchase` | The page after an upsell is accepted | - -`gtag` is configured with `send_page_view: false`, so the adapter's `page_view` is the only one. - -To send fewer events, add `ga4_blocked_events` with a comma-separated list, for example `"ga4_blocked_events": "dl_add_shipping_info, dl_add_payment_info"`. To send more, list them in `ga4_allowed_events`, or use `"all"` to send every event the adapter can map, including `view_item_list`, `select_item`, `remove_from_cart`, `view_cart`, `sign_up` and `login`. - -## Attribution requirements +| GA4 event | `purchase` | `upsell_purchase` | +| Transaction 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 | -GA4 reads campaign source from the page URL, so keep your UTM parameters on the ad's landing URL. The SDK carries the query string through to the checkout, upsell and receipt pages. Every page should be on the same domain, or on subdomains of one domain, so the GA4 cookie is shared across the funnel. If your funnel spans two different domains, set up GA4 cross-domain measurement in your Google tag settings. +Upsells are sent as their own event, so your purchase count and average order value describe the first sale. To see upsell revenue in GA4, mark `upsell_purchase` as a key event and include it in your reports. -## Purchases, revenue and upsells +The purchase amount is lower than the order total because it is the item prices only. Shipping is sent as a separate field on the event, and so is tax. -| Field | Order purchase | Upsell | -| --- | --- | --- | -| Event | `purchase` | `upsell_purchase` (custom event) | -| `transaction_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | -| `value` | Item revenue without shipping. Tax is excluded on stores that show prices without tax and included on stores that show tax-inclusive prices | The upsell line only | -| Other fields | `currency`, `tax`, `shipping`, `coupon`, `affiliation`, `items` | `currency`, `affiliation`, `coupon`, `upsell_number`, `package_id`, `package_name`, `original_order_id` | +## Use GA4 purchases in Google Ads -Upsells are kept out of the `purchase` event so purchase counts and average order value describe the first sale. To report upsell revenue in GA4, mark `upsell_purchase` as a key event and include it in your revenue explorations. If you import GA4 key events into Google Ads, import `upsell_purchase` too when you want upsell revenue to count there. See [Google Ads and YouTube](/docs/campaigns/tracking/google-ads). +Google Ads, including YouTube ads, has no ID of its own to add to your funnel. Instead, Google Ads imports the purchases your funnel reports to GA4. -`items[].item_id` is the product SKU. +1. In Google Ads, turn on **auto-tagging**. It adds the Google click ID (`gclid`) to your ad links. +2. In GA4, mark `purchase` as a key event. Mark `upsell_purchase` too if you want upsell revenue counted in Google Ads. +3. Link your GA4 property to your Google Ads account. +4. In GA4, open **Advertising**, then **Tools**, then **Conversion management**, and select **New conversion**. Pick your Google Ads account and the key events, then save. Google's steps are in [Create Google Ads conversions from GA4 key events](https://support.google.com/google-ads/answer/10632359?hl=en). +5. In Google Ads, set the new conversion as a primary conversion action if you want it used for bidding. -## Browser and server events +Things to know: -GA4 receives browser events only. There is no NEXT server event to deduplicate against, so the only duplicate risk is a second GA4 tag on the same pages. Send each GA4 event from one place: this adapter, or your own GTM container, not both. +- If you only import `purchase`, Google Ads misses upsell revenue. +- The conversion value is lower than the order total, because it is the item prices only. +- A test order counts as a conversion. +- The `gclid` is saved on the NEXT order, but NEXT does not send orders to Google Ads from its servers, and enhanced conversions are not available. -## Worked example +If you manage your tags in Google Tag Manager, you can fire a Google Ads conversion tag from there instead. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager#google-ads-conversions). Use one way, not both. -A campaign that sends GA4 and keeps upsells out of the default set, for a property that only wants checkout and purchase data: +## Keeping the source of the visit -```json title="_data/campaigns.json" -{ - "summer-offer": { - "name": "Summer Offer", - "sdk_version": "0.4.43", - "ga4_id": "G-XXXXXXXXXX", - "ga4_blocked_events": "dl_upsell_purchase" - } -} -``` +GA4 reads where a visitor came from off the page link, so keep your UTM parameters on your ad links. Keep every funnel page on one domain, or on subdomains of one domain, so GA4 follows the visitor through the whole funnel. ## Verify it works -1. Open a funnel page on your production domain with `?nfdebug=true` added to the URL. Do not add `?ignore=true`, which turns all tracking off for the browser tab. -2. In the browser console, run `NextForwarder.getStatus()`. The `ga4` entry should show `active: true`, and `sent` should increase as you move through the funnel. -3. In GA4, open **Admin**, then **DebugView**, or use Google Tag Assistant, and walk through checkout. You should see `page_view`, `begin_checkout`, `add_shipping_info` and `add_payment_info`. -4. Place a test order with a [test card](/docs/testing). On the upsell or receipt page you should see `purchase` with your order number as the transaction ID. Accept an upsell and you should see `upsell_purchase` on the next page. +1. In GA4, open **Admin**, then **DebugView**. You can also use Google Tag Assistant. +2. Open your funnel in a new private window and go through checkout. You should see `page_view`, `begin_checkout` and the other events. +3. 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. Accept an upsell. You should see `upsell_purchase` on the page after it. -More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). +## Troubleshooting -## Troubleshooting and limits +If nothing reaches GA4, check that `ga4_id` is set, then rebuild. More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). -| Symptom | Likely cause | Fix | -| --- | --- | --- | -| No GA4 requests at all | Built with `npm run dev`, `ga4_id` empty, or `?ignore=true` set earlier in the tab | Build with `npm run build`; check the key; open a new tab without `?ignore=true` | -| Every event counted twice | GA4 also loaded by GTM or a page script | Remove the other GA4 tag | -| Purchase revenue lower than the order total | `value` is item revenue and leaves out shipping (and tax, on stores that show prices without tax) | Use `tax` and `shipping` from the event, or report on item revenue | -| Upsell revenue missing | `upsell_purchase` is a separate event | Mark it as a key event and include it in reports | -| No `purchase` after a test order | The shopper never reached a page after payment, or the order was already reported in that browser | Load the upsell or receipt page; use a fresh browser profile for each test | - -- GA4 receives no event for subscription renewals or other orders created without a funnel visit. -- The adapter needs SDK 0.4.28 or later. +On a funnel that is not built from a starter template, send events to GA4 from your own [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) container. diff --git a/content/docs/campaigns/tracking/google-tag-manager.mdx b/content/docs/campaigns/tracking/google-tag-manager.mdx index 7e9f436..ff40e92 100644 --- a/content/docs/campaigns/tracking/google-tag-manager.mdx +++ b/content/docs/campaigns/tracking/google-tag-manager.mdx @@ -1,6 +1,6 @@ --- title: Google Tag Manager -description: Send the SDK's dl_* funnel events to your own Google Tag Manager container from starter template funnels, and check that each vendor tag receives every purchase once. +description: Send NEXT Campaigns funnel 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 @@ -8,49 +8,23 @@ tags: - Guide --- import { Callout } from 'fumadocs-ui/components/callout'; -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; -## Verification status +Google Tag Manager (GTM) does not report anything by itself. It is a container for your own tags. Your funnel sends its events to GTM, and the tags you build decide which platforms hear about them. -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| The SDK pushes each `dl_*` event to `window.dataLayer` | Verified | Test order on a production build, with `window.dataLayer` read in the browser on checkout, upsell and receipt pages | 2026-11-16 | 0.4.43 | -| `dl_purchase` fires once per order, on the first page after payment, and not again when the page is revisited | Verified | Test order, then a revisit of the upsell page | 2026-11-16 | 0.4.43 | -| `dl_upsell_purchase` fires on the page after the upsell, with a `transaction_id` of the order reference plus `-US1` | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | -| Each `dl_*` push is preceded by `{ecommerce: null}` | Unconfirmed | Source read only; not checked in the browser | 2026-11-16 | 0.4.43 | -| The container loads when `gtm_id` and the provider flag are both set | Unconfirmed | Starter template source read; the test order had no container | 2026-11-16 | 0.4.43 | -| `npm run dev` builds leave out the analytics markup | Unconfirmed | Template source and repo docs; not walked | 2026-11-16 | 0.4.43 | -| Attribution sits under `attribution`, with no root-level copy on `dl_*` events | Unconfirmed | Source read only | 2026-11-16 | 0.4.43 | -| An accepted upsell bundle pushes one `dl_upsell_purchase` per bundle item, each valued at the bundle total | Unconfirmed | Source read only | 2026-11-16 | 0.4.43 | -| `blockedEvents` on the `gtm` provider keeps a `dl_*` event out of `window.dataLayer` | Unconfirmed | Source read only | 2026-11-16 | 0.4.43 | -| Tags in your container fire and deliver data to a vendor | Unconfirmed | Not walked: no container in the test | 2026-11-16 | 0.4.43 | -| On 0.5.0, `window.ElevarDataLayer` is not written and `dl_*` `user_properties` carry only `visitor_type` | Unconfirmed | SDK 0.5.0 source and docs read; not walked | 2026-11-16 | 0.5.0 | -| A Meta Purchase from the Meta Pixel app uses the same event ID as the browser Purchase | Unconfirmed | Not walked: the Meta Pixel app was not installed on the test store | 2026-11-16 | n/a | - -The test order had no GTM container, so tag firing in GTM, Tag Assistant results and what a vendor received through GTM were not checked. - -## What it does - -The Google Tag Manager provider in the SDK pushes every `dl_*` funnel event to `window.dataLayer` and to `window.ElevarDataLayer`. Each push is preceded by `{ecommerce: null}`. The SDK never loads GTM itself. On a starter template funnel, the template loads your container when you set `gtm_id`, and your GTM tags decide what reaches each platform. - -The provider runs in the browser only. It covers every funnel page of the starter template families except `landing`, which loads no SDK. +Use GTM when you want to manage tags yourself, or for a platform that has no guide in this section. ## Before you start -- A Google Tag Manager web container. Copy its ID, which has the form `GTM-XXXXXXX`. -- A funnel built from a starter template. -- Your funnel domain added under **Allowed Domains** in the Campaigns app, under **Settings**, as a **Production** domain. On a development domain only NEXT campaign analytics ignores the events; vendor tags still fire. -- The NEXT Google Tag Manager app covers the storefront only. It does not run on campaign funnels, so the setup below is still needed. See the [app documentation](https://docs.nextcommerce.com/docs/apps/google-tag-manager). +- A GTM web container and its ID, which looks like `GTM-XXXXXXX`. +- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). -## Set up +The **Google Tag Manager** store app covers your NEXT storefront, not funnels. - - +## Set up -Setup has two parts, and both are required. +Setup has two parts, and you need both. -1. Open `_data/campaigns.json` and find the entry for your campaign. -2. Add your container ID: +1. In `_data/campaigns.json`, add your container ID to your campaign. This loads your container on every page: ```json title="_data/campaigns.json" { @@ -61,181 +35,96 @@ Setup has two parts, and both are required. } ``` -3. Open `assets/config.js` and turn the GTM provider on. The template ships it set to `false`. Leave `mode: 'auto'` as it is, because the purchase and cart events come from automatic tracking. +2. In `assets/config.js`, switch `gtm` on. This makes the funnel send its events to the container: ```js title="assets/config.js" -// Inside analytics.providers, change only the gtm entry: +// Inside analytics.providers: gtm: { enabled: true }, ``` -4. Build with `npm run build`. The analytics markup is left out of `npm run dev` builds, so GTM does not load in the development server. -5. Deploy, then follow [Verify it works](#verify-it-works). - -Each part does something on its own, which is why both are needed: - -| Set | What happens | -| --- | --- | -| Only `gtm_id` | The container loads, but the SDK sends it no `dl_*` events. Inferred from the template's config comment; not walked. | -| Only the provider flag | The SDK pushes `dl_*` events to `window.dataLayer`, and no container loads to read them. Observed in the test order. | - - - - -On a hand-built funnel you add your GTM container to every page yourself, then turn on the SDK's `gtm` provider in `window.nextConfig.analytics` as described in the [Campaign Cart SDK analytics docs](https://cart-sdk.nextcommerce.com/latest/analytics/). The events are the same as on a starter template. NEXT has not tested this on a hand-built page for this guide, so check it with GTM Preview before you rely on it. - - - - -The config key depends on the SDK version your template pins. The version comes from `sdk_version` in `_data/campaigns.json`, and the starter templates pin 0.4.43. - - - - -The flag is `analytics.providers.gtm.enabled`, set as in step 3 above. You can also list `dl_*` names in `blockedEvents`: - -```js title="assets/config.js" -gtm: { - enabled: true, - blockedEvents: ['dl_add_payment_info'] -}, -``` - -`blockedEvents` matches exact, case-sensitive event names. A blocked event does not reach `window.dataLayer` for GTM. It still reaches `window.NextDataLayer` and the other providers. - - - +3. Build with `npm run build` and deploy. - -Everything on this tab comes from SDK 0.5.0 source and docs. The test order ran on 0.4.43. + +With only `gtm_id`, the container loads but receives no funnel events. With only the `config.js` setting, the events are sent but there is no container to receive them. -- The key is `analytics.destinations.gtm.enabled`. GTM is on by default on 0.5.0. Set it to `false` to stop the `window.dataLayer` writes. A 0.4.x `providers.gtm.enabled: false` also turns it off when the destination key is not set. -- `window.ElevarDataLayer` is not written. -- Every `dl_*` push carries `user_properties` with `visitor_type` only. Customer email and phone are not sent, so a tag that reads them gets nothing. -- `blockedEvents` is not read. +## 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. -## Events sent - -The SDK emits these `dl_*` events. Most need `mode: 'auto'`, which the template ships with. - -| Event | When it fires | +| Event name | When it happens | | --- | --- | -| `dl_user_data` | Each page load, before the other events on the page. Also on in-funnel navigation, login and logout. | -| `dl_view_item_list` | A page with more than one product | -| `dl_view_item` | A page that shows one product | -| `dl_add_to_cart` | An item is added to the cart, once its price is final | -| `dl_remove_from_cart` | An item is removed from the cart | -| `dl_package_swapped` | A package is swapped | -| `dl_cart_updated` | The cart changes | -| `dl_begin_checkout` | The checkout form loads with items in the cart, once per form | -| `dl_add_shipping_info` | A shipping method is chosen, or a valid address is entered | -| `dl_add_payment_info` | Payment details are complete, an express payment button is pressed, or a redirect payment method is submitted | -| `dl_purchase` | The first SDK page with a `ref_id` after payment | +| `dl_user_data` | Any page loads. Use this for page view tags | +| `dl_view_item` | A page shows a product | +| `dl_add_to_cart` | An item is added to the cart | +| `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_viewed_upsell` | An upsell page is shown | -| `dl_skipped_upsell` | An upsell is skipped | -| `dl_upsell_purchase` | An upsell is accepted. It is pushed on the next SDK page. | -| `dl_scroll_depth` | A scroll threshold set in the page's meta tag is reached | -| `dl_exit_intent_shown`, `dl_exit_intent_accepted`, `dl_exit_intent_dismissed`, `dl_exit_intent_closed`, `dl_exit_intent_action` | Exit-intent pages | -| `dl_sign_up`, `dl_login` | Only when the page calls `next.trackSignUp` or `next.trackLogin` | - -`dl_page_view` is defined in the SDK but never sent at 0.4.43, so a trigger on it never fires. Page loads reach GTM as `dl_user_data`. The same applies to `dl_route_changed`, `dl_view_cart`, `dl_select_item` and `dl_view_search_results`. +| `dl_upsell_purchase` | An upsell is accepted. Sent on the page after it | -Create one Custom Event trigger for each `dl_*` name you use, with the event name set to that name, for example `dl_purchase`. Each push has the event name in its `event` key, and the `event_id` at the top level. The ecommerce object follows the GA4 shape: `currency`, `transaction_id`, `value`, `tax`, `shipping`, `affiliation` and `items`, with `coupon` or `discount` when they apply. Each item carries `item_id` (the product SKU), `item_name`, `price` and `quantity`. +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). -The SDK does not copy `utm_*` or `gclid` to the top level of a `dl_*` event. Read them under `attribution`. +## Reading values in your tags -## Attribution requirements +Create **Data Layer Variables** in GTM for the values you need. -Every `dl_*` event carries an `attribution` object. The keys that matter for tags: - -| Key | Holds | +| What you want | Data layer variable | | --- | --- | -| `attribution.utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term` | UTM parameters from the landing URL | -| `attribution.gclid` | The Google click ID | -| `attribution.affiliate`, `attribution.subaffiliate1` to `subaffiliate5` | Affiliate and sub-affiliate parameters | -| `attribution.funnel` | The funnel name | -| `attribution.metadata.fbclid` | The Meta click ID | -| `attribution.metadata.clickid` | The `clickid` parameter | -| `attribution.metadata.everflow_transaction_id` | The `evclid` parameter | -| `attribution.metadata.fb_fbp`, `fb_fbc`, `fb_pixel_id` | Meta browser cookies and pixel ID | - -NEXT does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`. A vendor pixel on the page can still read its own click ID cookie, as the TikTok pixel did in the test order. - -Each event also carries a `user_properties` object. In 0.4.43 it holds the shopper's email, phone, name and address fields in plain text. Decide which tags may read these fields, and see [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). +| Order number | `ecommerce.transaction_id` | +| Amount | `ecommerce.value` | +| Currency | `ecommerce.currency` | +| Items | `ecommerce.items` | +| Shipping and tax | `ecommerce.shipping`, `ecommerce.tax` | +| UTM parameters | `attribution.utm_source`, `attribution.utm_medium`, `attribution.utm_campaign` | +| Google click ID | `attribution.gclid` | +| Meta click ID | `attribution.metadata.fbclid` | -Keep every funnel page on one domain. The SDK keeps attribution in the browser for the current tab and carries query parameters from page to page during SDK navigation, so a page on another domain gets attribution only when the parameters reach it. A new tab starts attribution again, except for the funnel name and `evclid`. +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). -## Purchases, revenue and upsells +## Purchases and upsells -| Field | `dl_purchase` | `dl_upsell_purchase` | +| | `dl_purchase` | `dl_upsell_purchase` | | --- | --- | --- | -| When it fires | The first SDK page with a `ref_id` after payment | The next SDK page after the upsell is accepted | -| `event_id` and `ecommerce.transaction_id` | The order number, for example `100041` | The order reference plus `-US1`, `-US2`, and so on | -| `ecommerce.value` | Item revenue without shipping. Tax is excluded on stores that show prices without tax and included on stores that show tax-inclusive prices, where `ecommerce.tax` is also sent, so do not add the two together | The accepted upsell line, or the bundle total | -| `ecommerce.tax` and `ecommerce.shipping` | Order tax and shipping | `0` and `0` | -| `ecommerce.affiliation` | `Online Store` | `Upsell` | -| Other fields | `currency`, `coupon`, `discount`, `items` | `currency`, `coupon`, `items`, `upsell_metadata` with `original_order_id`, `upsell_number`, `package_id` and `package_name` | -| Repeat pushes | Suppressed per browser by transaction ID, for the last 20 IDs | Not suppressed | - -`dl_purchase` waits for payment. An order that still has a payment step does not fire, and a payment failure landing does not fire. - - -When a bundle of upsell items is accepted, the SDK pushes one `dl_upsell_purchase` per item, and each carries the whole bundle total. Summing those events overstates upsell revenue. - - - -A tag that listens to both `window.dataLayer` and `window.ElevarDataLayer` counts every event twice. Listen to one array. - +| When | 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 | -## Browser and server events +- A purchase is sent once per order. Reloading the page does not send it again. +- 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. -GTM runs in the browser only, and NEXT sends nothing from the server for it. Send each purchase from one place per vendor, so a single purchase is counted once. [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +If a platform is already turned on in your funnel, for example GA4 or TikTok, do not also send it purchases from GTM. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + -The Meta Pixel app in the NEXT Dashboard sends a server Purchase for new orders. If your GTM container also sends a Meta Purchase, both need the same event ID, `{store}-{order number}`, so Meta can deduplicate them, as described in [Meta's deduplication guide](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events). `dl_purchase` carries the order number but not your store name, so build the prefix in the tag. Not walked: the Meta Pixel app was not installed on the test store, so the server Purchase and its event ID were not checked. +### Google Ads conversions -## Worked example +To count purchases in Google Ads from GTM, add a Google Ads conversion tag on a `dl_purchase` trigger. Set its order ID to `ecommerce.transaction_id`, its value to `ecommerce.value` and its currency to `ecommerce.currency`. Add a second tag on `dl_upsell_purchase` to count upsells. -A campaign that pins SDK 0.4.43 and sends purchases to GTM: +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). -```json title="_data/campaigns.json" -{ - "summer-offer": { - "name": "Summer Offer", - "sdk_version": "0.4.43", - "gtm_id": "GTM-XXXXXXX" - } -} -``` - -The same campaign needs the `gtm` entry set to `enabled: true` in `assets/config.js`, as in Set up. +## Verify it works -In GTM, add a Custom Event trigger that fires only on `dl_purchase`, and attach it to the tag that sends your purchase conversion. That tag reads `ecommerce.transaction_id` for the order number, `ecommerce.value` for item revenue and `ecommerce.currency` for the currency. If the tag is a Meta Purchase, build its event ID as `{store}-{order number}` from `event_id`. +1. Start **Preview** mode in your GTM container and open your funnel. +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. +4. Accept an upsell. `dl_upsell_purchase` appears on the page after it. -## Verify it works +## Troubleshooting -1. Build with `npm run build`, deploy, and open a funnel page on your Production domain. Do not add `?ignore=true`. It turns off every provider in that tab, so GTM receives nothing and a purchase test proves nothing. -2. Open GTM Preview for your container and load the funnel page. You should see `dl_user_data` first, then the events for that page. `window.dataLayer` in the browser console holds the same pushes. -3. Place a test order with a [test card](/docs/testing). In GTM Preview, `dl_purchase` appears on the upsell or receipt page, with `transaction_id` set to the order number. Accept an upsell, and `dl_upsell_purchase` appears on the next page. +| 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 | +| 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 checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). +More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). -## Troubleshooting and limits +## Hand-built funnels -| Symptom | Likely cause | Fix | -| --- | --- | --- | -| No `dl_*` events in the container | The GTM flag is `false` (0.4.x), the build was `npm run dev`, or `?ignore=true` is set in the tab | Set the flag, build with `npm run build`, and open a new tab without `?ignore=true` | -| The container loads, but tags do not fire | `gtm_id` is empty, so no container loads, or the trigger name does not match the `dl_*` name | Set both parts of the setup, and check the trigger name against the event in GTM Preview | -| Every event counted twice | A tag listens to both `dataLayer` and `ElevarDataLayer`, or a second path sends the same vendor | Keep one listener and one path per vendor | -| No `dl_purchase` after a test order | The order is unpaid, the shopper never reached a page with a `ref_id` after payment, or that order was already reported in this browser | Load the upsell or receipt page, and use a fresh browser profile for each test | -| `dl_upsell_purchase` appears one page late | The SDK holds it until the next SDK page | Expected. Check the next page. | -| Upsell revenue is higher than expected | Each bundle item pushes an event with the whole bundle total | Handle bundle totals in the tag or the report | -| Purchase value is lower than the order total | `value` is item revenue and leaves out shipping, and tax on stores that show prices without tax | Read `ecommerce.shipping`, and `ecommerce.tax` on tax-exclusive stores, alongside it | -| A `dl_page_view` trigger never fires | The SDK does not send `dl_page_view` at 0.4.43 | Trigger on `dl_user_data` for page loads | - -- The SDK does not skip test orders, so a test purchase reaches GTM and fires `dl_purchase`. Filter test data in GTM if your reports need it clean. -- An order that never loads a funnel page with a `ref_id` after payment produces no `dl_purchase` in the browser. +On a funnel 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). diff --git a/content/docs/campaigns/tracking/index.mdx b/content/docs/campaigns/tracking/index.mdx index 11b474d..e882e53 100644 --- a/content/docs/campaigns/tracking/index.mdx +++ b/content/docs/campaigns/tracking/index.mdx @@ -1,6 +1,6 @@ --- title: Tracking overview -description: How ad and analytics tracking works on NEXT Campaigns funnels, which integrations are supported and how well each is verified, and which guide to follow for Triple Whale, Meta, TikTok, Google Ads, GA4 and GTM. +description: How ad and analytics tracking works on NEXT Campaigns funnels, 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 @@ -9,98 +9,75 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -A NEXT Campaigns funnel is a set of your own pages (presell, landing, checkout, upsells, receipt) that load the Campaign Cart SDK and talk to the Campaigns API. Because the funnel is not a Shopify or storefront checkout, the tracking apps you may already use elsewhere do not see it automatically. This section explains what tracks a funnel today, how to set each platform up, and how to prove it works. +Tracking tells your ad platforms which clicks turned into sales. A NEXT Campaigns funnel is made of your own pages, so tracking is something you turn on for each platform you advertise on. This section shows you how. Start with [Set up tracking](/docs/campaigns/tracking/getting-started), then open the guide for your platform. ## How tracking works -Three parts can send tracking data for a campaign order. Each guide says which part it configures. - -| Part | Where it runs | What it does | Where you configure it | -| --- | --- | --- | --- | -| Campaign Cart SDK | The shopper's browser | Captures UTM parameters and click IDs from the landing URL, emits an ecommerce event stream (`dl_*` events in `window.NextDataLayer`), and forwards it to GTM, the Meta pixel and RudderStack through built-in providers | `assets/config.js` (`window.nextConfig.analytics`) | -| Starter template analytics adapters | The shopper's browser | Load a vendor's pixel on every page and translate the SDK's `dl_*` events into that vendor's events: GA4, Triple Whale, TikTok, Northbeam, Snapchat, Pinterest, Taboola and AppLovin Axon | One key per vendor on the campaign entry in `_data/campaigns.json` | -| Store apps | NEXT's servers | Send order events server to server after the order exists. For campaign orders this covers the Meta Pixel app's Conversions API Purchase, Everflow postbacks and Klaviyo order events | The store dashboard, under **Apps** | +1. **A shopper clicks your ad.** The link carries details about the ad, such as UTM parameters and a click ID. +2. **Your funnel remembers where they came from.** It keeps those details as the shopper moves from page to page, and saves them on the order. +3. **Your funnel tells each platform what happened.** Page views, checkout steps and purchases are sent to the platforms you have turned on. ```mermaid flowchart LR - A[Ad click with UTMs and click IDs] --> B[Funnel pages: SDK + vendor pixels] - B -->|attribution on cart and order| C[Campaigns API order] - B -->|browser events| V[Ad and analytics platforms] - C --> D[Store apps: Meta Pixel app, Everflow, Klaviyo] - D -->|server events| V - C -->|Shop Sync stores only| S[Shopify order tagged NEXT] - S --> T[Shopify-side tools such as Triple Whale] + A[Ad click] --> B[Your funnel pages] + B -->|page views, checkout, purchase| C[Ad and analytics platforms] + B -->|order with ad details| D[NEXT order] ``` - -The TikTok Pixel Events, Google Analytics 4, Google Tag Manager, AppLovin AXON and Taboola apps inject their scripts into your NEXT storefront only. They do not load on a campaign funnel. On a funnel, use the template adapters or the SDK providers instead. The Meta Pixel app is the exception for one event: its server-side Purchase is sent for campaign orders too. - - -## What happens at each step of a funnel - -This is the behaviour of a starter template funnel on SDK 0.4.43 with the vendors turned on. It was checked with a test order on 2026-11-16. - -| Step | What NEXT records | What the browser sends | -| --- | --- | --- | -| Shopper clicks your ad | The SDK stores `utm_source`, `utm_medium`, `utm_campaign`, `utm_content`, `utm_term`, `gclid`, `aff` or `affid`, `sub1` to `sub5` and `fbclid` from the landing URL for the browser tab session | Each vendor's page view | -| Presell and landing pages | Nothing new unless a parameter changes. A new value for a parameter replaces the old one | Page views; product views where a page shows packages | -| Checkout loads | The cart | `dl_begin_checkout` and the vendor's checkout-started event | -| Shopper types email or phone | A prospect cart once name, email and items are present | Triple Whale `Contact` (when turned on), and identity calls for vendors whose identity setting is on | -| Shipping and payment entered | | `dl_add_shipping_info`, `dl_add_payment_info` | -| Payment succeeds | The order, with the stored attribution (see [Events and attribution](/docs/campaigns/tracking/events-and-attribution)) | Nothing on the checkout page itself | -| First page after payment (upsell or receipt) | | `dl_purchase` with the order number as `transaction_id` and the item revenue as `value`. Shipping is never included; tax is excluded on stores that show prices without tax and included on stores that show tax-inclusive prices. Sent once per order; a reload or revisit does not send it again | -| Shopper accepts an upsell | The upsell line is added to the same order | `dl_upsell_purchase` on the next page, with `transaction_id` set to the order reference plus `-US1`, `-US2` and so on, and `value` set to the upsell line only | -| After the order | Store apps run server side: Meta Pixel app Purchase, Everflow postback, Klaviyo events. On Shop Sync stores the order is pushed to Shopify | | +You turn a platform on by adding its ID to your funnel. For a few platforms a NEXT store app also sends the purchase from NEXT's servers. Each guide tells you exactly what to add and where. -Upsells reach each platform differently. Some count an accepted upsell as another purchase, some receive it as a separate custom event, and the SDK's Meta provider sends nothing for it. Each platform guide states which. + +Tracking apps you installed for your NEXT storefront, such as TikTok Pixel Events, Google Analytics 4 or Google Tag Manager, only run on the storefront. Set tracking up for your funnel with the guides below. + ## Supported integrations -Each integration has two ratings. **Setup and events** says whether NEXT has confirmed the funnel sends the right events. **Platform reporting** says whether NEXT has confirmed the events arrive and report correctly inside the vendor's own dashboard. - -- **Verified**: checked against the current source and observed in a test order. -- **Partial**: some of the path is verified and some is not, or it needs a workaround. The guide says which part. -- **Unconfirmed**: documented from source code or vendor documentation only. Treat it as untested. -- **Not supported**: no setup exists today. - -| Integration | Setup and events | Platform reporting | Guide | -| --- | --- | --- | --- | -| Triple Whale | Verified | Unconfirmed; not supported on stores without Shopify | [Triple Whale](/docs/campaigns/tracking/triple-whale) | -| Meta pixel and Conversions API | Verified for browser events; server Purchase Unconfirmed | Unconfirmed | [Meta](/docs/campaigns/tracking/meta) | -| TikTok | Verified for browser events; no server event | Unconfirmed | [TikTok](/docs/campaigns/tracking/tiktok) | -| Google Ads and YouTube | Partial | Unconfirmed | [Google Ads and YouTube](/docs/campaigns/tracking/google-ads) | -| Google Analytics 4 | Verified | Unconfirmed | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | -| Google Tag Manager | Verified | Not applicable (your tags decide) | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | -| Northbeam, Snapchat, Pinterest, Taboola, AppLovin Axon, RudderStack, Everflow, Klaviyo | Unconfirmed | Unconfirmed | [More integrations](/docs/campaigns/tracking/more-integrations) | +| Platform | Guide | +| --- | --- | +| Google Tag Manager | [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | +| Google Analytics 4 | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | +| Google Ads and YouTube | [Use GA4 purchases in Google Ads](/docs/campaigns/tracking/google-analytics-4#use-ga4-purchases-in-google-ads) | +| Meta (Facebook and Instagram) | [Meta Pixel and Conversions API](/docs/campaigns/tracking/meta) | +| Everflow | [Everflow](/docs/campaigns/tracking/everflow) | +| Triple Whale | [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| AppLovin Axon | [AppLovin Axon](/docs/campaigns/tracking/applovin-axon) | +| TikTok, Snapchat, Pinterest, Taboola, Northbeam, RudderStack, Klaviyo | [More integrations](/docs/campaigns/tracking/more-integrations) | -Every guide opens with a **Verification status** table that lists exactly what was checked, how, on which SDK version and when. +If your orders sync to Shopify through Shop Sync, also read [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). ## Send each purchase from one place -Every ad platform needs to receive a purchase once. A campaign order can reach a platform from up to three places: the funnel's browser pixel, a NEXT store app on the server, and, on Shop Sync stores, a Shopify-side app that reads the synced Shopify order. Decide which one sends the purchase for each platform before you launch. +Each platform should hear about a sale once. If two things report the same sale to the same platform, it is counted twice. -- If the browser and the server both send it, they must share the same event ID so the platform can deduplicate. The Meta guide shows how NEXT does this for Meta. -- If a Shopify-side app also sends the synced order to the same platform, exclude orders tagged `NEXT` in that app, or block the purchase in the funnel. -- Meta deduplicates a browser and server event only when the event name and event ID match within 48 hours. Two server senders are never deduplicated. +A sale can be reported by your funnel pages, by a NEXT store app, and, on Shop Sync stores, by a Shopify app that sees the synced order. For each platform, pick one of them to report the purchase and turn the others off. The platform guides show how. -[Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) has a table of which Shopify-side tools see synced orders. +Meta is the one exception: the funnel and the Meta Pixel app can both report the purchase, because they label it with the same ID and Meta merges the two. See the [Meta](/docs/campaigns/tracking/meta#count-each-purchase-once) guide. ## Privacy and consent -NEXT Campaigns has no built-in consent banner, consent mode, regional blocking or opt-out link. If your funnel needs them, build them into your pages and make sure they also stop the vendor scripts. The identity settings in the template adapters (for example `triplewhale_contact_enabled` and `meta_advanced_matching_enabled`) send the shopper's email and phone to that vendor. Turn them on only when your privacy policy and consent handling cover it. The SDK also stores the shopper's details in a first-party cookie and includes them in its `dl_*` events, so any tag you add in GTM can read them. +NEXT Campaigns does not include a cookie banner or consent tool. If your funnel needs one, add it to your pages and make sure it also stops the tracking scripts. + +Some platforms can receive the shopper's email and phone to improve matching. Those settings are off unless you turn them on. Turn them on only when your privacy policy covers it. + +## Next steps -## Known gaps +- [Set up tracking](/docs/campaigns/tracking/getting-started): turn platforms on and run your first test. +- [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting): check what was sent and fix common problems. -These are the main limits today. Each guide lists its own. +## For developers -- The SDK reads the Meta `_fbp` and `_fbc` cookies once when a page loads. On a first visit the Meta pixel may not have set them yet. The starter templates include a workaround; hand-built funnels do not. -- SDK 0.4.x does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`. SDK 0.5.0 does. -- No NEXT app sends TikTok, Google Ads or Triple Whale events from the server for campaign orders. -- Triple Whale attributes an order only when it receives both a pixel purchase and a matching order record. On a store without Shopify, Triple Whale receives no order record. -- The template adapters are not packaged for hand-built funnels. +The funnel'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: -## Maintenance +| 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) | -This section is maintained by the NEXT Campaigns team. It is re-checked when a Campaign Cart SDK minor version is released, when the starter template analytics adapters change, and when the Meta Pixel app changes. Each page shows the date it was last verified. +To read the saved ad details from an order, see [Marketing attribution](/docs/apps/guides/marketing-attribution). diff --git a/content/docs/campaigns/tracking/meta.json b/content/docs/campaigns/tracking/meta.json index e5e8555..168a9f8 100644 --- a/content/docs/campaigns/tracking/meta.json +++ b/content/docs/campaigns/tracking/meta.json @@ -3,15 +3,14 @@ "pages": [ "index", "getting-started", - "triple-whale", - "meta", - "tiktok", - "google-ads", - "google-analytics-4", "google-tag-manager", + "google-analytics-4", + "meta", + "everflow", + "triple-whale", + "applovin-axon", "more-integrations", "shop-sync", - "events-and-attribution", "testing-and-troubleshooting" ] } diff --git a/content/docs/campaigns/tracking/meta.mdx b/content/docs/campaigns/tracking/meta.mdx index c653c1f..bd9b32b 100644 --- a/content/docs/campaigns/tracking/meta.mdx +++ b/content/docs/campaigns/tracking/meta.mdx @@ -1,6 +1,6 @@ --- title: Meta Pixel and Conversions API -description: Send NEXT Campaigns funnel events to a Meta pixel from the browser, send the order Purchase from the server with the Meta Pixel app, and set up both so Meta counts each purchase once. +description: Track a NEXT Campaigns funnel in Meta. Turn on the Meta pixel on your funnel pages, send purchases from NEXT's servers with the Meta Pixel app, and make sure Meta counts each purchase once. sidebar_label: Meta audience: [merchant, developer] last_verified: 2026-11-16 @@ -8,56 +8,25 @@ tags: - Guide --- import { Callout } from 'fumadocs-ui/components/callout'; -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; -## Verification status +Meta tracking on a funnel has two parts: -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| Setting `fb_pixel_id` loads Meta's `fbevents.js` and runs `fbq('init')` on every funnel page | Verified | Starter template source, and requests to `www.facebook.com/tr` in a test order | 2026-11-16 | 0.4.43 | -| The SDK's facebook provider sends `PageView`, `ViewContent`, `AddShippingInfo` (custom) and `Purchase` | Verified | Test order, Meta pixel requests observed in the browser | 2026-11-16 | 0.4.43 | -| The browser `Purchase` carries the event ID `your-store-100041` (store subdomain, then order number), `order_id` and item revenue as `value` | Verified | Test order with `storeName` set, `eid`, `cd[order_id]` and `cd[value]` read from the Purchase request | 2026-11-16 | 0.4.43 | -| No browser Meta event is sent for an accepted upsell; `ViewedUpsell` (custom) is sent on the upsell page | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | -| `AddToCart`, `InitiateCheckout` and `AddPaymentInfo` mappings | Unconfirmed | SDK source only; not recorded in the test order | | | -| The Meta Pixel app sends one server `Purchase` per campaign order, with the event ID `{store}-{order number}` | Unconfirmed | App source and merchant docs; the app was not installed on the test store | | | -| Meta deduplicates the browser and server `Purchase` | Unconfirmed | Meta's documentation only; Events Manager not checked | | | -| The `_fbp` and `_fbc` cookies reach the order's attribution | Unconfirmed | SDK and template source only; the placeholder pixel never set the cookies | | | -| Advanced matching with `meta_advanced_matching_enabled` | Unconfirmed | Template source and its tests | | | -| SDK 0.5.0 `destinations.meta` config | Unconfirmed | SDK 0.5.0 source and docs | | | +- **The Meta pixel** reports page views, checkout steps and purchases from the shopper's browser. You set it up in your funnel files. +- **The Meta Pixel app** reports each purchase again from NEXT's servers. You set it up in your store dashboard. -The browser side was checked with a placeholder pixel ID on a store without the Meta Pixel app, so the server Purchase, deduplication in Events Manager and cookie capture were not checked. - -## What it does - -Meta tracking on a funnel has two parts that you set up separately. - -| Part | Runs in | Sends | Set up in | -| --- | --- | --- | --- | -| Browser pixel | The shopper's browser, on every funnel page | `PageView`, product, checkout and upsell events, and the order `Purchase`, through the Campaign Cart SDK's facebook provider | `_data/campaigns.json` and `assets/config.js` | -| Server Purchase (Conversions API) | NEXT's servers, after the order is created | One `Purchase` per order | The Meta Pixel app in your store dashboard | - -The starter template loads the pixel. The SDK sends the events through it. The Meta Pixel app sends the server Purchase for campaign orders as well as storefront orders. The app's browser scripts run on your NEXT storefront only and do not load on a funnel. - -When both parts send the order `Purchase`, they must use the same event ID so Meta can deduplicate them. NEXT builds that ID from your store subdomain and the order number, so `storeName` in `config.js` has to be your store subdomain. +You can use the pixel on its own, but both together give Meta the most complete picture. When both report a purchase, they label it with the same ID, so Meta counts it once. ## Before you start -- A Meta pixel and its ID. For the server Purchase you also need an access token for that pixel. -- Your store subdomain: the lowercase part before `.29next.store`, for example `your-store` in `your-store.29next.store`. -- A funnel built from a starter template. The Meta pixel code ships with every template family except `landing`. -- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. -- The Meta Pixel app installed on your store, if you want the server Purchase. See the [Meta Pixel app merchant docs](https://docs.nextcommerce.com/docs/apps/meta-pixel). +- Your Meta pixel ID. For the Meta Pixel app you also need an access token for that pixel. +- Your store name: the part before `.29next.store` in your store address. For `your-store.29next.store` it is `your-store`. +- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up - - - -### Part 1: browser pixel - -The browser pixel needs two settings. With only the first, the pixel loads but the SDK sends no events. With only the second, the SDK has no pixel to send through. +### Part 1: Meta pixel -1. Open `_data/campaigns.json`, find your campaign's entry and set `fb_pixel_id`. The key is already there with an empty value. +1. In `_data/campaigns.json`, add your pixel ID to your campaign: ```json title="_data/campaigns.json" { @@ -68,7 +37,7 @@ The browser pixel needs two settings. With only the first, the pixel loads but t } ``` -2. Open `assets/config.js`. Set `storeName` to your store subdomain, turn on the facebook provider and give it the same pixel ID. +2. In `assets/config.js`, set `storeName` to your store name, switch `facebook` on, and enter the same pixel ID: ```js title="assets/config.js" window.nextConfig = { @@ -90,250 +59,123 @@ window.nextConfig = { }; ``` -The template ships with `storeName: 'store-name'` and the facebook provider turned off. Change both. The SDK only checks that `settings.pixelId` is not empty; the events go to the pixel that `fb_pixel_id` loads, so keep the two the same to avoid confusion. - -3. Do not add `fbq('track', 'PageView')` to your pages. The template's pixel code leaves it out on purpose because the SDK sends `PageView` on every page load. A manual call sends every page view twice. -4. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds. - -### Part 2: server Purchase - -5. In your store dashboard, open **Apps**, then **Meta Pixel**. Select **Add Pixel**, enter the **Pixel ID (Dataset ID)** and **Access Token**, and save. Add the same pixel you set as `fb_pixel_id`. -6. Set **Default Meta Pixel**. Orders that do not say which pixel they came from go to this one. -7. Check the app's other settings: - -| Setting | Default | What it does | -| --- | --- | --- | -| **Default Meta Pixel** | Required | The pixel that receives the server Purchase when the order has no `fb_pixel_id` in its attribution metadata | -| **Enable Delay Order Confirmation** | On | Waits 10 minutes before sending, to wait for order updates | -| **Enable Sending Test Data** | Off | Test orders are skipped unless this is on. The merchant docs call it **Enable Test Data** | -| **Ignore Subscription Renewal Orders** | On | Renewal orders are not sent as conversions. Not listed in the merchant docs | - -8. Choose who sends the order Purchase to Meta, and set the matching config. See [Browser and server events](#browser-and-server-events). -9. Deploy, then follow [Verify it works](#verify-it-works). - - - - -The Meta setup is documented for starter templates only. It was not tested on a hand-built page, and a hand-built funnel does not get the template's `_fbp` and `_fbc` workaround. The closest supported path is to build the funnel from a [starter template](/docs/campaigns/templates); the Meta Pixel app's server Purchase does not depend on the funnel's pages. - - - - -### SDK 0.5.0 - -The starter templates pin SDK 0.4.43, and everything else on this page describes 0.4.43. On SDK 0.5.0 the Meta settings move. This is from the 0.5.0 source and docs and has not been tested. - - - - -```js title="assets/config.js" -window.nextConfig = { - storeName: 'your-store', - analytics: { - enabled: true, - mode: 'auto', - providers: { - facebook: { - enabled: true, - settings: { pixelId: '123456789012345' } - } - } - } -}; -``` - - - - -```js title="assets/config.js" -window.nextConfig = { - analytics: { - destinations: { - meta: { - enabled: true, - storeName: 'your-store' - } - } - } -}; -``` - -`destinations.meta.storeName` falls back to the top-level `storeName`, and the 0.4.x keys still turn Meta on. Other changes that affect Meta on 0.5.0: - -- `blockedEvents` is not read, so the server-only option below cannot be set in config. -- The SDK does not send `PageView` and expects the page's own pixel code to. The template pixel code sends none, so check page views before you move a template to 0.5.0. -- An accepted upsell is sent as its own `Purchase` with the event ID `-US`, without the store name. It does not match a server event. -- Prices are sent before tax. - - - - -## Events sent - -The SDK's facebook provider turns these SDK events into Meta events. Custom events are sent with `fbq('trackCustom')`, the rest with `fbq('track')`. +3. Build with `npm run build` and deploy. -| SDK event | Meta event | Type | When it fires | Seen in the test order | -| --- | --- | --- | --- | --- | -| `dl_user_data` | `PageView` | Standard | Every page load | Yes | -| `dl_view_item` | `ViewContent` | Standard | A page shows a package | Yes | -| `dl_add_to_cart` | `AddToCart` | Standard | An item is added to the cart | Not recorded | -| `dl_remove_from_cart` | `RemoveFromCart` | Custom | An item is removed | Not recorded | -| `dl_begin_checkout` | `InitiateCheckout` | Standard | The checkout form loads | Not recorded | -| `dl_add_shipping_info` | `AddShippingInfo` | Custom | A valid shipping address is entered | Yes | -| `dl_add_payment_info` | `AddPaymentInfo` | Standard | Payment details are complete | Not recorded | -| `dl_purchase` | `Purchase` | Standard | The first page after payment | Yes | -| `dl_viewed_upsell` | `ViewedUpsell` | Custom | An upsell page is shown | Yes | -| `dl_skipped_upsell` | `SkippedUpsell` | Custom | The shopper declines an upsell | Not recorded | -| `dl_upsell_purchase` | Nothing | | The page after an upsell is accepted | Yes, nothing sent | - -To stop one event going to Meta, add `blockedEvents` to the facebook provider with the SDK event names, for example `blockedEvents: ['dl_add_shipping_info']`. The names must match exactly. Meta names such as `PageView` or `Purchase` block nothing, even though the template's config comment shows `["PageView"]`. A blocked event still goes to every other provider. + +With only `fb_pixel_id`, the pixel loads but sends nothing. With only the `config.js` setting, there is no pixel to send through. Templates ship with `storeName: 'store-name'` and `facebook` switched off, so change both. + -The SDK's facebook provider sends no customer data. Customer data reaches Meta only through advanced matching, below. +Do not add your own `fbq('track', 'PageView')` to the pages. The funnel already sends page views, and a second call counts each one twice. -## Attribution requirements +### Part 2: Meta Pixel app -Keep `fbclid` on the ad's landing URL. The SDK stores it in the order's attribution metadata and carries the query string through to the checkout, upsell and receipt pages. +1. In your store dashboard, open **Apps**, then **Meta Pixel**. +2. Select **Add Pixel**, enter the **Pixel ID** and **Access Token**, and save. Use the same pixel as in Part 1. +3. Set it as the **Default Meta Pixel**. -The Meta Pixel app reads these keys from the order's attribution metadata: +The app's other settings: -| Metadata key | Set by | Used by the app for | +| Setting | Default | What it does | | --- | --- | --- | -| `fb_fbp` | The SDK, from the `_fbp` cookie | Matching the server Purchase to the browser | -| `fb_fbc` | The SDK, from the `_fbc` cookie | Matching the server Purchase to the click | -| `fb_pixel_id` | The SDK, from the template's `fbq('init')` call | Choosing which pixel receives the server Purchase | -| `fb_test_code` | You, for testing only | Sending the server Purchase to Meta's Test Events | -| `fb_event_source_url` | Not set by the SDK | The event source URL; the app falls back to your store's primary domain | - -The merchant docs list `fb_fbp` and `fb_fbc` as required for the server event. +| **Enable Delay Order Confirmation** | On | Waits 10 minutes before sending the purchase, so upsells accepted in that time are included | +| **Enable Sending Test Data** | Off | Test orders are skipped unless this is on | +| **Ignore Subscription Renewal Orders** | On | Subscription renewals are not sent as purchases | -### The `_fbp` and `_fbc` cookies +See the [Meta Pixel app docs](https://docs.nextcommerce.com/docs/apps/meta-pixel) for more. -SDK 0.4.43 reads `_fbp` and `_fbc` when a page loads and again when the checkout form starts. It does not read them later. On a first visit the Meta pixel may not have set them yet, so the order can carry empty values. SDK 0.5.0 reads them once per tab and has the same gap. - -The starter templates include `meta.adapter.js`, which loads whenever `fb_pixel_id` is set. It reads the two cookies again every 500 ms for up to 10 seconds while they are missing, and after every cart update, and copies them into the attribution metadata with `next.addMetadata`. Hand-built funnels do not have it. - -### Advanced matching +## What gets tracked -Add `"meta_advanced_matching_enabled": true` to the campaign entry in `_data/campaigns.json` to send the shopper's details to Meta through the pixel. `meta.adapter.js` collects the shopper's details from the checkout fields as they are typed, then calls `fbq('init')` once on the page with them, just before the first `InitiateCheckout`, `AddPaymentInfo` or `Purchase` that has an email or phone. It sends `em`, `ph`, `fn`, `ln`, `ct`, `st`, `zp`, `country` and `external_id` (the SDK's anonymous visitor ID). Phone is sent only when the field holds a valid international number. +| When | Meta event | +| --- | --- | +| Any page loads | `PageView` | +| A page shows a product | `ViewContent` | +| An item is added to the cart | `AddToCart` | +| An item is removed from the cart | `RemoveFromCart` (custom event) | +| The checkout loads | `InitiateCheckout` | +| A shipping address is entered | `AddShippingInfo` (custom event) | +| Payment details are entered | `AddPaymentInfo` | +| The order is paid | `Purchase` | +| An upsell page is shown | `ViewedUpsell` (custom event) | +| An upsell is declined | `SkippedUpsell` (custom event) | -Advanced matching is not gated on the marketing opt-in checkbox. Turn it on only when your privacy policy and consent handling cover sending this data to Meta. If you use a consent banner, make it stop the pixel. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). +The `Purchase` is sent on the first page after payment: the upsell page, or the receipt if there is no upsell. -On a return visit the SDK refills the phone field after `InitiateCheckout` has been sent, so that event goes without `ph`. +## Purchases and upsells -## Purchases, revenue and upsells +The browser and the server report the same purchase with different amounts. -| Field | Browser `Purchase` (SDK) | Server `Purchase` (Meta Pixel app) | +| | Meta pixel (browser) | Meta Pixel app (server) | | --- | --- | --- | -| When | The first page after payment | After the order is created; 10 minutes later when **Enable Delay Order Confirmation** is on | -| Event ID | `{storeName}-{order number}`, for example `your-store-100041`. None when `storeName` is not set | `{store}-{order number}`, using the store subdomain | -| `order_id` | The NEXT order number | The NEXT order number | -| `value` | Item revenue without shipping, for the first sale (tax excluded on stores that show prices without tax, included on tax-inclusive stores) | The order total including tax (`total_incl_tax`) | -| `num_items` | Number of order lines | Sum of item quantities | -| Other fields | `currency`, `content_type`, `content_ids`, `contents` | | -| Upsells | Not included. Nothing is sent for an accepted upsell | With the delay on, the app re-reads the order before sending, so upsells accepted before then are expected to be included. Not confirmed | +| When | The first page after payment | 10 minutes after the order, with the delay on | +| Amount | The price of the items in the first sale, as shown on your store, without shipping | The full order total, including tax and shipping | +| Upsells | Not included | Included, when accepted within the 10 minutes | +| ID | `your-store-100041` | `your-store-100041` | -The SDK's facebook provider never sends upsell revenue to Meta from the browser. The upsell page sends `ViewedUpsell` as a custom event, and `dl_upsell_purchase` has no Meta mapping. If you want upsell revenue in Meta, it has to come from the server Purchase. +The pixel sends nothing when an upsell is accepted. Upsell revenue reaches Meta only through the Meta Pixel app. -When Meta deduplicates two events, its documentation says it generally keeps the first one received. With the delay on, the browser Purchase usually arrives first, so Meta may report the browser value (item revenue without upsells) rather than the server total. This was not checked in Events Manager. +Because the IDs match, Meta keeps one of the two. It usually keeps the first one it receives, which is the browser's, so the amount Meta shows can be the first sale without upsells. If you want Meta to see the full order total, use the server-only option below. -## Browser and server events +## Count each purchase once -Every purchase should reach Meta from one place, or from two places that share an event ID. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). - -Meta deduplicates a browser and server event only when the browser `eventID` equals the server `event_id`, the event names match and both go to the same pixel, within 48 hours ([Meta: deduplicate pixel and server events](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)). Two server senders are never deduplicated. - -Choose one of these two options. - -### Option 1: browser events and server Purchase, deduplicated - -The browser sends every event, including `Purchase`. The Meta Pixel app also sends `Purchase`. Both use `your-store-{order number}`, so Meta keeps one. This needs `storeName` set to your store subdomain exactly. - -```js title="assets/config.js" -window.nextConfig = { - storeName: 'your-store', - analytics: { - enabled: true, - mode: 'auto', - providers: { - facebook: { - enabled: true, - settings: { pixelId: '123456789012345' } - } - } - } -}; -``` +Pick one of these. -### Option 2: server Purchase only +**Option 1: pixel and app together (default).** Both report the purchase with the same ID and Meta merges them. This is what the setup above gives you. It only works when `storeName` is exactly your store name. -The browser sends every event except `Purchase`, and the Meta Pixel app is the only Purchase sender. Use this if you cannot be sure the IDs match, or if you want the server value, which is expected to include upsells. +**Option 2: app only.** The pixel reports everything except the purchase, and the app is the only one that reports it. Meta then sees the full order total with upsells. Add `blockedEvents` to the `facebook` settings: ```js title="assets/config.js" -window.nextConfig = { - storeName: 'your-store', - analytics: { - enabled: true, - mode: 'auto', - providers: { - facebook: { - enabled: true, - settings: { pixelId: '123456789012345' }, - blockedEvents: ['dl_purchase'] - } - } - } -}; +facebook: { + enabled: true, + settings: { pixelId: '123456789012345' }, + blockedEvents: ['dl_purchase'] +} ``` - -Never send the same Meta event from a Google Tag Manager tag and from the SDK's facebook provider. If your GTM container also runs a Meta pixel on the funnel, its base code sends its own `PageView`, so add `'dl_user_data'` to the facebook provider's `blockedEvents` to stop a second `PageView`. A pixel loaded only through GTM is not detected by the SDK, so the order's `fb_pixel_id` is empty and the server Purchase goes to the **Default Meta Pixel**. + +If Meta events are also sent from Google Tag Manager, or from a Shopify app on a Shop Sync store, Meta counts purchases twice. Meta cannot merge two purchases that both come from servers. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). -On Shop Sync stores, a Shopify-side Meta sender would be a third sender for the same order. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). +## Optional settings -### Extra pixels and backup ad accounts +### Advanced matching -Add every pixel you use in the Meta Pixel app with **Add Pixel**. A campaign's server Purchase goes to the pixel in that campaign's `fb_pixel_id`, which the SDK records on the order. To send a campaign to a different pixel or a backup ad account, set its `fb_pixel_id` and `settings.pixelId` to that pixel and add the pixel in the app. +Advanced matching sends the shopper's email, phone, name, city, state, postcode and country to Meta through the pixel to improve matching. To turn it on, add this to your campaign in `_data/campaigns.json`: - -If an order's `fb_pixel_id` is not one of the pixels added in the Meta Pixel app, the app sends nothing for that order. It does not fall back to the **Default Meta Pixel**. Add the pixel in the app before you point a campaign at it. - +```json +"meta_advanced_matching_enabled": "true" +``` -## Worked example +It is not tied to the marketing opt-in checkbox on your checkout. Turn it on only when your privacy policy covers it. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). -A store at `your-store.29next.store` runs a campaign on pixel `123456789012345` with advanced matching on, and uses option 1. +### More than one pixel + +Each campaign reports to the pixel in its own `fb_pixel_id`, so two campaigns can use two pixels: ```json title="_data/campaigns.json" { "summer-offer": { "name": "Summer Offer", - "sdk_version": "0.4.43", - "fb_pixel_id": "123456789012345", - "meta_advanced_matching_enabled": true + "fb_pixel_id": "123456789012345" + }, + "winter-offer": { + "name": "Winter Offer", + "fb_pixel_id": "987654321098765" } } ``` -`assets/config.js` uses the option 1 config above, with `storeName: 'your-store'`. In the Meta Pixel app, pixel `123456789012345` is added and set as **Default Meta Pixel**. - -A shopper buys a $12 package, then accepts a $3 upsell. The order number is `100041`. +Set the same ID as `pixelId` in each campaign's `assets/config.js`. Then add every pixel you use in the Meta Pixel app, before you send traffic to the campaign. See the [Meta Pixel app docs](https://docs.nextcommerce.com/docs/apps/meta-pixel). -| Sender | Event | Event ID | Value | -| --- | --- | --- | --- | -| Browser, on the upsell page | `Purchase` | `your-store-100041` | 12 | -| Browser, on the upsell page | `ViewedUpsell` | | | -| Browser, after the upsell is accepted | Nothing | | | -| Meta Pixel app, 10 minutes after the order | `Purchase` | `your-store-100041` | The order total including tax, expected to include the upsell | +## Verify it works -The event IDs match, so Meta should keep one Purchase for order `100041`. The browser rows match what was observed in a test order; the server row is from the app's source. +1. In Meta Events Manager, open **Test Events** for your pixel. +2. Start the test from that page and go through your funnel in the same browser. You should see `PageView` on each page. +3. Place an order with a [test card](/docs/testing). On the next page you should see `Purchase` with the event ID `your-store-` followed by the order number. -## Verify it works +To test the Meta Pixel app as well: -1. Open a funnel page on your production domain. Do not add `?ignore=true`, which turns all tracking off for the browser tab. -2. In the browser console, run `NextAnalytics.getStatus()`. `providers` should include `facebook`. -3. In Meta Events Manager, open **Test Events** for your pixel, or use the Meta Pixel Helper browser extension. Walk through the funnel. You should see `PageView` on each page, and `AddShippingInfo` once you enter a shipping address. -4. Place a test order with a [test card](/docs/testing). On the first page after payment you should see `Purchase` with the event ID `your-store-` followed by your order number. In the browser's network panel this is the `eid` parameter on the request to `www.facebook.com/tr`. -5. To test the server Purchase, turn on **Enable Sending Test Data** in the Meta Pixel app. The app skips test orders otherwise. Then add the test code from **Test Events** to the order's attribution metadata on a funnel page before checkout: +1. Turn on **Enable Sending Test Data** in the app. +2. Copy the test code shown in **Test Events** and add this to a funnel page, with your code in place of `TEST12345`: ```html ``` -6. Place another test order. With **Enable Delay Order Confirmation** on, wait at least 10 minutes. Test Events should show a server `Purchase` with the same event ID as the browser one. -7. Remove the snippet and turn **Enable Sending Test Data** off before launch. The app passes `fb_test_code` to Meta on every order that carries it. +3. Place another test order and wait 10 minutes. **Test Events** should show a second `Purchase`, from the server, with the same event ID. +4. Remove the snippet and turn **Enable Sending Test Data** off before you launch. + +The app keeps a 30-day log of what it sent, under **Logs** in the app. -The app keeps a log of the events it sends for 30 days. Where that log appears in the dashboard was not confirmed for this guide. +Tips for **Test Events**: -More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). +- **Keep the Test Events page open.** A server purchase that arrives while the page is closed does not show up later. +- **Use the same browser for the funnel.** Browser events only appear when the funnel is opened from Test Events, in that browser. A private window or another browser shows nothing. +- **Check the test code is current.** Meta drops events sent with an expired code without telling you. Copy a fresh code before each session. +- **Two purchases listed is normal.** Test Events lists both the browser and the server purchase. Meta still counts them as one when the event IDs match. -## Troubleshooting and limits +## Troubleshooting -| Symptom | Likely cause | Fix | +| Problem | Likely cause | Fix | | --- | --- | --- | -| No requests to Meta at all | Built with `npm run dev`, `fb_pixel_id` empty, or `?ignore=true` set earlier in the tab | Build with `npm run build`; check the key; open a new tab without `?ignore=true` | -| The pixel loads but sends no events | The facebook provider is off, or `settings.pixelId` is empty, so the SDK skips the provider with a console warning | Turn the provider on and set `settings.pixelId` | -| A console warning that `fbq` is missing, about 5 seconds after an event | The provider is on but no pixel is on the page | Set `fb_pixel_id` in `_data/campaigns.json` | -| Two `PageView` events per page | A manual `fbq('track', 'PageView')`, or a Meta pixel in GTM | Remove the manual call, or block `dl_user_data` on the facebook provider | -| Each purchase counted twice | `storeName` missing, left as `store-name`, or not your exact store subdomain, so the browser and server IDs differ | Set `storeName` to your store subdomain in lowercase, or use option 2 | -| No server Purchase for a test order | **Enable Sending Test Data** is off | Turn it on while testing | -| No server Purchase for a live order | The order's `fb_pixel_id` is not added in the app, no pixel is configured, the order is a subscription renewal, or the 10-minute delay has not passed | Add the pixel in the app; wait 10 minutes; check **Ignore Subscription Renewal Orders** | -| Server Purchase goes to the wrong pixel | The pixel is loaded only by GTM, so `fb_pixel_id` is empty and the default pixel is used | Load the pixel with `fb_pixel_id`, or set **Default Meta Pixel** to the right pixel | -| `blockedEvents` has no effect | Meta event names used, or SDK 0.5.0 | Use `dl_*` names; on 0.5.0 `blockedEvents` is not read | -| `fb_fbp` or `fb_fbc` empty on orders | First visit before the pixel set its cookies, or a hand-built funnel without `meta.adapter.js` | Use a starter template; check the order's attribution metadata | - -- Browser and server Purchase values differ by design: the browser sends item revenue without tax or shipping, the server sends the order total including tax. -- Meta receives no browser event for subscription renewals or other orders created without a funnel visit. The server Purchase skips renewals while **Ignore Subscription Renewal Orders** is on. -- The Meta Pixel app's browser scripts run on your NEXT storefront only. On a funnel, browser events come from the SDK. +| Nothing reaches Meta | `fb_pixel_id` is missing or empty | Add your pixel ID and rebuild | +| The pixel loads but sends no events | `facebook` is switched off in `assets/config.js`, or `pixelId` is empty | Switch it on and set `pixelId` | +| Every purchase counted twice | `storeName` is missing, still `store-name`, or not your exact store name | Set `storeName` correctly, or use option 2 | +| No server purchase for a real order | The campaign's pixel is not added in the app, the order is a subscription renewal, or 10 minutes have not passed | Add the pixel in the app and wait 10 minutes | +| `blockedEvents` does nothing | A Meta event name was used | Use `dl_purchase`, not `Purchase` | + +More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). + +## Hand-built funnels + +On a funnel that is not built from a starter template, add Meta's pixel base code to every page yourself, without a `fbq('track', 'PageView')` call, then follow step 2 of Part 1. The Meta Pixel app works the same way for any funnel. diff --git a/content/docs/campaigns/tracking/more-integrations.mdx b/content/docs/campaigns/tracking/more-integrations.mdx index 6b314d4..f2d512f 100644 --- a/content/docs/campaigns/tracking/more-integrations.mdx +++ b/content/docs/campaigns/tracking/more-integrations.mdx @@ -1,6 +1,6 @@ --- title: More integrations -description: Short entries for Northbeam, Snapchat, Pinterest, Taboola, AppLovin Axon, RudderStack, Everflow and Klaviyo, with the settings, events and limits each one has today. None of them has been walked end to end yet. +description: How to turn on TikTok, Snapchat, Pinterest, Taboola, Northbeam, RudderStack and Klaviyo for a NEXT Campaigns funnel. sidebar_label: More integrations audience: [merchant, developer] last_verified: 2026-11-16 @@ -8,127 +8,105 @@ tags: - Guide --- -These integrations exist in the starter templates or as store apps, but NEXT has not walked a test order through them end to end. Each entry is Unconfirmed unless it says otherwise, and a vendor gets its own full guide once it has been tested. Before you add a second sender for a purchase, read [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). +Most platforms here are turned on with one line in `_data/campaigns.json`. Add the line to your campaign, then build with `npm run build` and deploy. See [Set up tracking](/docs/campaigns/tracking/getting-started) for the full steps. -## Northbeam - -| Item | Details | +| Platform | Line to add | | --- | --- | -| Status | Unconfirmed. Built into the starter templates; not walked end to end. | -| Turn it on | Set `northbeam_client_id` on the campaign entry in `_data/campaigns.json`. NEXT has no Northbeam app, so the template snippet is the only path. | -| Optional keys | `northbeam_identity_enabled` (`true`, `1` or `yes`), `northbeam_allowed_events`, `northbeam_blocked_events` | -| Events sent | A page view from the base snippet on load. By default, `purchase` for each order, sent with `Northbeam.firePurchaseEvent`. With identity on, an email identify on the prospect cart and when the shopper enters an email. | -| Upsells | Each accepted upsell is sent as another `firePurchaseEvent`, with the order reference plus `-US1`, `-US2` and so on as the ID, and the upsell amount as the total. | -| Customer data | With `northbeam_identity_enabled` on, the email only. Phone is not sent. Not gated on accepts_marketing. | -| Limits | NEXT has no Northbeam app or server feed. The adapter rebuilds Northbeam's total as value plus tax plus shipping, because the SDK's `value` is product revenue only. | - -On a Shop Sync store, the funnel purchase cannot match the order that Northbeam receives through its Shopify connector, so it creates an unmatched or double-counted order. Block the pixel purchase and rely on identity instead. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). - -```json title="_data/campaigns.json" -{ - "my-campaign": { - "northbeam_client_id": "your-client-id", - "northbeam_identity_enabled": "true", - "northbeam_blocked_events": "dl_purchase, dl_upsell_purchase" - } -} +| [TikTok](#tiktok) | `tiktok_pixel_id` | +| [Snapchat](#snapchat) | `snap_pixel_id` | +| [Pinterest](#pinterest) | `pinterest_tag_id` | +| [Taboola](#taboola) | `taboola_account_id` | +| [Northbeam](#northbeam) | `northbeam_client_id` | +| [RudderStack](#rudderstack) | Two lines and a setting | +| [Klaviyo](#klaviyo) | A store app | + +[Everflow](/docs/campaigns/tracking/everflow) and [AppLovin Axon](/docs/campaigns/tracking/applovin-axon) have their own guides. + +## TikTok + +```json +"tiktok_pixel_id": "your-pixel-id" ``` +- **What it tracks:** page views, product views, add to cart, checkout started, payment details and purchases. +- **Upsells:** each accepted upsell counts as another purchase, so an order with two upsells shows as three purchases. To count one purchase per order, add `"tiktok_blocked_events": "dl_upsell_purchase"`. Upsell revenue then does not reach TikTok. +- **Shopper details:** add `"tiktok_advanced_matching_enabled": "true"` to send email and phone. Nothing is sent unless the marketing opt-in checkbox on your checkout is ticked. + +The TikTok store app covers your NEXT storefront, not funnels. + ## Snapchat -| Item | Details | -| --- | --- | -| Status | Unconfirmed. Built into the starter templates; not walked end to end. | -| Turn it on | Set `snap_pixel_id` on the campaign entry in `_data/campaigns.json`. | -| Optional keys | `snap_advanced_matching_enabled` (`true`, `1` or `yes`), `snap_allowed_events`, `snap_blocked_events` | -| Events sent | Uppercase names. By default: `VIEW_CONTENT` for product views, `ADD_CART`, `START_CHECKOUT`, `ADD_BILLING` for payment details, and `PURCHASE` for each order. | -| Upsells | Sent as another `PURCHASE`, with `transaction_id` set to the order reference plus `-US1`, `-US2` and so on. Snapchat counts each one as a purchase. | -| Customer data | With advanced matching on, the raw email and phone, sent from the prospect cart. The adapter gates this on accepts_marketing. | -| Limits | The purchase value is sent in the `price` field and is product revenue, without tax and shipping. The source notes that adding tax and shipping would give total-paid ROAS, but the adapter does not do that by default. Advanced matching works through a re-initialisation of the pixel, which the source asks to be checked. That check has not been run. | +```json +"snap_pixel_id": "your-pixel-id" +``` + +- **What it tracks:** page views, product views, add to cart, checkout started, payment details and purchases. +- **Upsells:** each accepted upsell counts as another purchase. +- **Shopper details:** add `"snap_advanced_matching_enabled": "true"` to send email and phone. Nothing is sent unless the marketing opt-in checkbox on your checkout is ticked. ## Pinterest -| Item | Details | -| --- | --- | -| Status | Unconfirmed. Built into the starter templates; not walked end to end. | -| Turn it on | Set `pinterest_tag_id` on the campaign entry in `_data/campaigns.json`. | -| Optional keys | `pinterest_enhanced_match_enabled` (`true`, `1` or `yes`), `pinterest_allowed_events`, `pinterest_blocked_events` | -| Events sent | Lowercase conversion events. By default: `addtocart` for add to cart and `checkout` for each order. The adapter sends no product-view, begin-checkout or payment-info event. | -| Upsells | Sent as another `checkout`, with its own event ID and an `order_id` of the order reference plus `-US1`, `-US2` and so on. | -| Customer data | With enhanced match on, the raw email in a `pintrk('load')` call on the prospect cart. Pinterest hashes it in the browser. The adapter gates this on accepts_marketing. | -| Limits | Enhanced match is marked UNVERIFIED in the adapter source. The source notes that a second `load` call may do nothing. This has not been tested. | +```json +"pinterest_tag_id": "your-tag-id" +``` + +- **What it tracks:** page views, add to cart, and a `checkout` event for each order. +- **Upsells:** each accepted upsell counts as another `checkout`. +- **Shopper details:** add `"pinterest_enhanced_match_enabled": "true"` to send email. Nothing is sent unless the marketing opt-in checkbox on your checkout is ticked. ## Taboola -| Item | Details | -| --- | --- | -| Status | Unconfirmed. Built into the starter templates; not walked end to end. | -| Turn it on | Set `taboola_account_id` in `_data/campaigns.json` to your numeric Taboola account ID. The Taboola store app tracks the storefront only and does not load on funnels. | -| Optional keys | `taboola_allowed_events`, `taboola_blocked_events` | -| Events sent | By default: `view_content`, `add_to_cart`, `start_checkout`, `add_payment_info` and `make_purchase`. The base pixel sends `page_view`. | -| Upsells | Sent as the custom event `upsell_purchase`, with `orderid` set to the order reference plus `-US1`, `-US2` and so on, and the revenue for that upsell only. | -| Customer data | None. Hashed-email enhanced matching is not sent. | -| Limits | The account ID is written into the page without quotes, so a value that is not numeric breaks the page script. | +```json +"taboola_account_id": "1234567" +``` -## AppLovin Axon +Use your numeric account ID. -| Item | Details | -| --- | --- | -| Status | Unconfirmed. Built into the starter templates; not walked end to end. | -| Turn it on | Set `axon_event_key` in `_data/campaigns.json`. The AppLovin AXON store app is storefront-only and does not load on funnels. | -| Optional keys | `axon_item_category_id` (positive integer), `axon_send_user_data` (`true`), `axon_allowed_events`, `axon_blocked_events` | -| Events sent | By default: `page_view`, `view_item`, `add_to_cart`, `begin_checkout`, `add_payment_info` and `purchase`. Axon accepts only its standard event names, so there are no custom events. | -| Upsells | Sent as a second `purchase`, with `transaction_id` set to the order reference plus `-US1`, `-US2` and so on, and tax and shipping set to 0. Axon counts each upsell as a purchase. | -| Customer data | With `axon_send_user_data` set to `true`, the purchase event carries `user_data`: the email, the phone digits without the plus sign, and the user ID. The adapter does not gate this on accepts_marketing. | -| Limits | `item_category_id` must be a positive integer. The SDK's item category is the campaign name, and Axon rejects it with HTTP 400. Images are sent only for `.png`, `.jpg` and `.jpeg` URLs. Without `user_data`, Axon still records the revenue and transaction ID. | +- **What it tracks:** page views, product views, add to cart, checkout started, payment details and purchases. +- **Upsells:** sent as a separate `upsell_purchase` event. Create a Taboola conversion for it to count upsell revenue. -## RudderStack +The **Taboola Pixel Events** store app covers your NEXT storefront, not funnels. -| Item | Details | -| --- | --- | -| Status | Unconfirmed. Built into the starter templates; not walked end to end. | -| Turn it on | Set both `rudderstack_write_key` and `rudderstack_dataplane_url` in `_data/campaigns.json`. The loader is added only when both are set. Then set `analytics.providers.rudderstack.enabled` to `true` in `assets/config.js`. On SDK 0.5.0 the flag is `destinations.rudderstack.enabled`, and the 0.4.x key still maps to it. That change has not been walked. | -| Optional keys | None in `campaigns.json`. `blockedEvents` in `assets/config.js` applies to this provider as well. | -| Events sent | `Product Viewed`, `Product Added`, `Product Removed`, `Cart Viewed`, `Checkout Started`, `Checkout Step Completed` (shipping), `Payment Info Entered`, `Order Completed`, `Upsell Viewed`, `Upsell Skipped`, `Signed Up` and `Logged In`. `identify` calls use the email as the user ID. | -| Upsells | Each accepted upsell sends another `Order Completed`, with the order ID set to the order reference plus `-US1`, `-US2` and so on. | -| Customer data | Identify traits include email, first name, last name, phone, city, state, country, postal code and `acceptsMarketing`. The `state` trait is sent on purchase only. | -| Limits | `Order Completed` `total` is value plus tax plus shipping. On a store that shows VAT, `value` already includes tax, so RudderStack counts tax twice. This is inferred from the code paths and has not been run. On SDK 0.4.43 the adapter never calls `page()`. | - -```json title="_data/campaigns.json" -{ - "my-campaign": { - "rudderstack_write_key": "your-write-key", - "rudderstack_dataplane_url": "https://your-dataplane-url" - } -} +## Northbeam + +```json +"northbeam_client_id": "your-client-id" ``` -With the flag off, the loader still runs and the SDK sends nothing. This is inferred from the source and has not been run. +- **What it tracks:** page views, and a purchase for each order. +- **Upsells:** each accepted upsell counts as another purchase. +- **Shopper details:** add `"northbeam_identity_enabled": "true"` to send the shopper's email, which helps Northbeam match orders. -## Everflow +### Northbeam on a Shop Sync store -| Item | Details | -| --- | --- | -| Status | Unconfirmed (source only). Store app; not walked end to end. | -| Turn it on | In the store dashboard, go to Apps, then Everflow. Set **Everflow Postback URL** and **Everflow Network ID**, and keep **Enable Everflow S2S Postback** on. | -| Optional keys | **Everflow Verification Token** (up to 32 characters), **Everflow Postback Delay Minutes** (0 to 10, default 0), **Include Tax in Conversion Value** (off by default). | -| Events sent | One server-side postback to Everflow when an order is placed, and another when its status changes. The fields are the network ID, verification token, transaction ID, currency, amount and order number. | -| Upsells | Not confirmed. The source sends one postback per order, and the amount is the order total when the postback fires, so an upsell added before then should be included. This is inferred and has not been tested. | -| Customer data | None. The postback has no customer fields. | -| Limits | A postback is sent only when the order's attribution has `everflow_transaction_id`, only for open orders that are not on hold, and never for a canceled order. Test orders are skipped unless **Enable S2S Postback for test orders** is on. The configured URL keeps only its scheme and host, so custom query parameters cannot be added. | +Northbeam already receives your orders from Shopify. Stop the funnel sending them too, and turn identity on: + +```json +"northbeam_client_id": "your-client-id", +"northbeam_identity_enabled": "true", +"northbeam_blocked_events": "dl_purchase, dl_upsell_purchase" +``` + +## RudderStack + +RudderStack needs two lines and one setting. + +```json +"rudderstack_write_key": "your-write-key", +"rudderstack_dataplane_url": "https://your-dataplane-url" +``` -The SDK copies the `evclid` URL parameter into `everflow_transaction_id`, so keep `evclid` on the funnel's landing URL. Merchant docs: [Everflow app](https://docs.nextcommerce.com/docs/apps/everflow). +Then switch `rudderstack` on in `assets/config.js`: + +```js title="assets/config.js" +// Inside analytics.providers: +rudderstack: { + enabled: true +}, +``` + +RudderStack is a pipe, like Google Tag Manager. It reports nothing by itself; the destinations you connect in RudderStack do. It receives the shopper's details along with the events, and each accepted upsell arrives as another `Order Completed`. ## Klaviyo -| Item | Details | -| --- | --- | -| Status | Unconfirmed. Store app; source and merchant docs only, not walked end to end. | -| Turn it on | Install the Klaviyo app from the Apps menu in the NEXT dashboard, and connect your existing Klaviyo account through OAuth. Settings are under Actions, then Settings. | -| Optional keys | **Delay Order Confirmation Events**, **Enable Sending Test Data**, **Default Subscription List** and **SMS Consent**, among the other settings on the app page. | -| Events sent | The onsite events (Active on Site, Viewed Product, Added to Cart, Started Checkout) fire on the NEXT storefront only, not on funnel pages. Server events come from store webhooks: Placed Order and one Ordered Product per line on order creation; Fulfilled Order, Canceled Order and Refunded Order on order updates; Started Subscription and Cancelled Subscription on subscription changes. Started Checkout from abandoned carts is sent only when its store setting is on. | -| Upsells | With **Delay Order Confirmation Events** on, Placed Order waits 10 minutes. The merchant docs describe this hold as the window that lets upsells join the order. | -| Customer data | The server events are built from the store's order webhooks. This page does not list the fields Klaviyo receives. | -| Limits | Campaign reach is inferred, not tested. The router does not filter by order source, so a campaign order that fires `order.created` should be sent. Test orders are skipped unless **Enable Sending Test Data** is on. | - -Merchant docs: [Klaviyo app](https://docs.nextcommerce.com/docs/apps/klaviyo). +Klaviyo is a store app, not a line in your funnel. Once installed, it sends order events to Klaviyo from NEXT's servers for funnel orders and storefront orders alike. See the [Klaviyo app docs](https://docs.nextcommerce.com/docs/apps/klaviyo). diff --git a/content/docs/campaigns/tracking/shop-sync.mdx b/content/docs/campaigns/tracking/shop-sync.mdx index 3466336..c46b070 100644 --- a/content/docs/campaigns/tracking/shop-sync.mdx +++ b/content/docs/campaigns/tracking/shop-sync.mdx @@ -1,6 +1,6 @@ --- title: Tracking on Shop Sync stores -description: What reaches Shopify when Shop Sync pushes a NEXT campaign order, which Shopify-side tracking tools see synced orders, how to pick one purchase sender per ad platform, and how to map a click ID such as gclid onto the Shopify order. +description: How to avoid counting funnel sales twice when Shop Sync copies your NEXT campaign orders into Shopify, and where to find the guide for putting a click ID on the Shopify order. sidebar_label: Shop Sync stores audience: [merchant, developer] last_verified: 2026-11-16 @@ -9,156 +9,71 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -This page is for stores where NEXT campaign orders are pushed into Shopify by Shop Sync, and where you also run tracking apps on the Shopify side. On these stores one order can reach an ad platform twice: once from your funnel pages and once from a Shopify app that reads the synced Shopify order. Read [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place) first, then use this page to decide which sender to keep for each platform. +Shop Sync copies your funnel orders into Shopify. That creates one risk for tracking: a sale can be reported twice, once by your funnel and once by a Shopify app that sees the copied order. -## Verification status +This page shows which Shopify tools see those orders, and what to turn off so each sale is counted once. -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| The NEXT order carries the UTM parameters and `gclid` as attribution fields, and `fbclid` in attribution metadata | Verified | Test order placed through a starter template funnel, then read through the Admin API | 2026-11-16 | 0.4.43 | -| An accepted upsell is added to the same NEXT order | Verified | Test order with an accepted upsell; the order total included the upsell line | 2026-11-16 | 0.4.43 | -| The `landing_page` attribution metadata on the order holds the checkout URL, not the first page the shopper landed on | Verified | Same test order, read through the Admin API | 2026-11-16 | 0.4.43 | -| The funnel's Meta `Purchase` carries an event ID in the `{store}-{order number}` format that the Meta Pixel app uses | Verified | Test order, Meta pixel requests observed in the browser | 2026-11-16 | 0.4.43 | -| Shop Sync creates the Shopify order tagged `NEXT`, with no UTM or click ID fields | Unconfirmed | Shop Sync source and the Shop Sync guides | | | -| Only mapped `order` and `attribution` metadata fields are written to the Shopify order, once, when it is created | Unconfirmed | Shop Sync source and the Shop Sync metadata guide | | | -| Copying `gclid` into metadata with `next.addMetadata` lets Shop Sync map it | Unconfirmed | Shop Sync metadata guide and SDK source | | 0.4.43 | -| Which Shopify-side tools see synced orders | Unconfirmed | Shop Sync source, template documentation and vendor documentation | | | -| The template `*_blocked_events` keys and the SDK `blockedEvents` setting stop the funnel purchase | Unconfirmed | Starter template and SDK source; not run in the test order | | 0.4.43 | -| A Meta Pixel app server `Purchase` deduplicates against the funnel's browser `Purchase` | Unconfirmed | Meta Pixel app source and Meta documentation | | | +## What Shop Sync puts in Shopify -No Shop Sync store was used for the test order, so nothing that happens after the order leaves NEXT was observed: the Shopify order, its metafields, and what any Shopify-side app or ad platform did with it. +Two things matter for tracking: -## What reaches Shopify +- **The order arrives when it is sent for fulfillment**, not at the moment of payment, and it is tagged `NEXT`. +- **It carries no ad details.** There are no UTM parameters, click IDs, referrer or landing page on the Shopify order. -Shop Sync creates the Shopify order when your NEXT store sends a fulfillment request for the order. It is not created at the moment of payment. +For everything else about these orders, such as finding one by its PO number or how split shipments are counted, see [Do my NEXT sales show in Shopify analytics?](https://guides.nextcommerce.com/guides/shop-sync-daily-operations#shopify-analytics) in the Shop Sync guide. -| On the Shopify order | Value | -| --- | --- | -| Tags | The NEXT order's tags plus `NEXT`. Subscription renewal orders also get `Recurring` | -| PO number | The NEXT order number | -| Financial status | Paid | -| Processed at | The date the order was placed in NEXT | -| Other fields | Currency, shipping address, line items, email, phone, and the test flag | -| Payment transaction | Added only when payment sync is turned on for your Shop Sync store | -| UTM parameters, click IDs, referrer, landing page | Not sent | -| Metafields | Only the metadata fields you map in Shop Sync (see below) | - -An accepted upsell is added to the same NEXT order, so the NEXT order total includes it. Whether the Shopify order includes an upsell depends on the NEXT order's contents when the fulfillment request is sent; that timing was not checked. - -Subscription renewals are synced like other orders, tagged `Recurring`, and copy the renewal order's own metadata. To carry a value such as a click ID onto renewals, set it on the subscription's attribution metadata through the Admin API. - -### Attribution and metadata - -Shop Sync does not copy attribution to Shopify on its own. After it creates the Shopify order, it writes Shopify order metafields for the keys you have mapped, and nothing else. It can read from two NEXT objects only: the order's `metadata` (object `order`) and the order's `attribution.metadata` (object `attribution`). Empty or null values are skipped. - -The SDK puts some click IDs into `attribution.metadata` and others into top-level attribution fields. `fbclid` is already in metadata. `gclid` and the UTM parameters are top-level fields, so Shop Sync cannot map them until you copy them into metadata. The section Mapping a click ID to Shopify, below, shows how. +## Which Shopify tools see these orders -To map a field: +When Shop Sync creates the order, Shopify notifies every app that listens for new orders. Shopify calls that notification a webhook. -1. In NEXT, open **Settings**, then **Metadata Fields**, click **Add Metadata Definition**, give it a name, choose the object (**Attribution** for click IDs), enter the key, choose the type, and click **Save Changes**. See [Metadata fields and tags](https://docs.nextcommerce.com/docs/build-a-store/technical-settings/metadata-fields-and-tags). -2. In Shopify, open **Settings**, then **Custom data**, and add an **Orders** metafield definition of the matching type. -3. In Shop Sync, click **Add Metadata Sync**. Choose the NEXT field under **Next Commerce Metadata** and the Shopify field under **Shopify Order Metafield**, then save. +**Any tool that uses Shopify order webhooks creates its own purchase event for the synced order, with its own ID.** It builds that ID from Shopify's order details, which did not exist when your funnel reported the sale. The two IDs can never match, so the ad platform sees two separate purchases and counts both. -The two types must match or the save fails with "Metadata type mismatch": - -| NEXT type | Shopify metafield type | +| Tool | Reports funnel orders? | | --- | --- | -| Text | `single_line_text_field` | -| Multi Text | `multi_line_text_field` | -| Integer | `number_integer` | -| Decimal | `number_decimal` | -| Boolean | `boolean` | - -The Shop Sync guides cover the rest of the setup: [Shop Sync onboarding](https://guides.nextcommerce.com/guides/shop-sync-onboarding) and [Shop Sync metadata](https://guides.nextcommerce.com/guides/shop-sync-metadata). - -## Which tools see synced orders - -A synced order is created in Shopify through Shopify's Admin API. The shopper never loads a Shopify storefront or checkout page, so anything that depends on a Shopify browser session does not see the order. Tools that read Shopify orders after they exist do. - -| Tool type | Sees synced orders? | Status | Source | -| --- | --- | --- | --- | -| Shopify admin and reports | Yes. The order shows as imported, unfulfilled, tagged `NEXT` | Unconfirmed | Shop Sync onboarding guide | -| Triple Whale connected to the Shopify store | Yes, it ingests the synced Shopify order | Unconfirmed | Starter template documentation; Triple Whale documentation says Shopify orders reach it by webhook | -| Northbeam through its Shopify connector | Yes, it ingests the synced Shopify order as the order of record | Unconfirmed | Starter template source | -| Shopify apps that send server events from Shopify order webhooks | Yes, they report synced orders as purchases | Unconfirmed | Internal NEXT notes only; not checked in source | -| Shopify's native Meta sales channel | No, it does not report orders created through the API | Unconfirmed | Internal NEXT notes only; not checked in source | -| Pixels that run in the Shopify storefront or checkout | No, the shopper never visits those pages | Unconfirmed | Follows from how Shop Sync creates the order; not tested | -| Any Shopify-side tool that reads attribution from the Shopify order itself | Sees no UTM, referrer or landing page, only the metafields you map | Unconfirmed | Shop Sync source | +| Tracking apps that send purchases from Shopify order webhooks | Yes, as their own purchase with their own ID | +| Triple Whale and Northbeam, connected to Shopify | Yes, they read the Shopify order | +| Shopify admin and reports | Yes | +| Shopify's own Facebook & Instagram channel | No. It follows the Shopify checkout, which the shopper never used | +| Pixels on your Shopify storefront or checkout | No. The shopper never visits those pages | -If a tool is not in this table, check whether it reads Shopify orders through webhooks or the Admin API (it will see synced orders) or only through a browser pixel on Shopify pages (it will not). +For a tool not listed here, ask one question: does it listen for Shopify orders, or does it only run on Shopify pages? If it listens for orders, it reports funnel sales too. -## Pick one purchase sender per platform +## Count each sale once -For each ad platform, decide which one place sends the purchase. A campaign order can reach a platform from the funnel's browser pixel, from a NEXT store app on the server, and from a Shopify-side app that reads the synced order. The funnel side is turned off with a blocked-events key in `_data/campaigns.json`, or with `blockedEvents` in `assets/config.js` for the SDK's Meta provider. The Shopify side is turned off in the Shopify app, by excluding orders tagged `NEXT` if the app offers a tag filter, or by turning off its purchase events. No Shopify app's settings were checked for this page. +For each platform, choose one thing to report the purchase. -| Platform | Senders that can reach it | Recommended single sender | How to stop the others | Status | -| --- | --- | --- | --- | --- | -| Meta | Funnel browser `Purchase` (SDK Meta provider); NEXT Meta Pixel app server `Purchase`; a Shopify-side server sender | The funnel browser `Purchase` and the NEXT Meta Pixel app, as one pair. They use the same event ID, `{store}-{order number}`, so Meta can deduplicate them | Exclude orders tagged `NEXT` in the Shopify-side sender, or turn its purchase events off for that pixel. If you keep the Shopify-side sender instead, turn off the NEXT Meta Pixel app and add `"dl_purchase"` to `analytics.providers.facebook.blockedEvents` | Partial: the funnel event ID was observed; the server side was not | -| Triple Whale | Funnel adapter `Purchase` and `UpsellPurchase`; the synced Shopify order Triple Whale ingests | No default yet. Two configurations exist: the Shopify order as the only purchase, with the funnel sending `Contact` to tie the session to it; or the funnel `Purchase` left on, which Triple Whale's documentation says attribution needs | For the first, `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"` with `triplewhale_contact_enabled` on. Express wallet buyers may never type an email, so `Contact` may not fire for them. Test both in your own account as the [Triple Whale](/docs/campaigns/tracking/triple-whale#worked-example) guide describes | Unconfirmed, and see the note below | -| Northbeam | Funnel adapter `purchase`; the synced Shopify order Northbeam ingests | The Shopify order from Northbeam's Shopify connector, with identity sent from the funnel | `"northbeam_blocked_events": "dl_purchase, dl_upsell_purchase"`, with `northbeam_identity_enabled` on. See [Northbeam](/docs/campaigns/tracking/more-integrations#northbeam) | Unconfirmed | -| GA4 and Google Ads | Funnel GA4 adapter; any Shopify-side Google app that reports synced orders (not confirmed that one does) | The funnel GA4 adapter, with Google Ads importing GA4 key events | Exclude orders tagged `NEXT` in the Shopify-side Google app, or, to keep that app instead, `"ga4_blocked_events": "dl_purchase, dl_upsell_purchase"` | Unconfirmed | -| TikTok | Funnel TikTok adapter `Purchase`; any Shopify-side TikTok app that reports synced orders (not confirmed that one does) | The funnel TikTok adapter. NEXT sends no TikTok server event for campaign orders | Exclude orders tagged `NEXT` in the Shopify-side TikTok app, or, to keep that app instead, `"tiktok_blocked_events": "dl_purchase, dl_upsell_purchase"` | Unconfirmed | +| Platform | Report the purchase from | Turn off | +| --- | --- | --- | +| Meta | Your funnel and the NEXT Meta Pixel app | Any Shopify app that also sends purchases to the same Meta pixel. Exclude orders tagged `NEXT` in that app | +| Triple Whale | Shopify | The funnel's purchase. See [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| Northbeam | Shopify | The funnel's purchase. See [Northbeam](/docs/campaigns/tracking/more-integrations#northbeam-on-a-shop-sync-store) | +| Google Analytics 4 and Google Ads | Your funnel | Any Shopify Google app that also reports these orders. Exclude orders tagged `NEXT` | +| TikTok | Your funnel | Any Shopify TikTok app that also reports these orders. Exclude orders tagged `NEXT` | -Things to know about each row: - -- Meta deduplicates a browser event and a server event when the event name and event ID match and both arrive within 48 hours. Meta's documentation does not describe deduplicating two server events, so never run the NEXT Meta Pixel app and a Shopify-side server sender for the same pixel. See [Meta's deduplication guide](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events) and the [Meta](/docs/campaigns/tracking/meta) guide. -- The SDK's `blockedEvents` matches the SDK event name exactly. Use `"dl_purchase"`. A Meta event name such as `"Purchase"` blocks nothing. -- The NEXT Meta Pixel app skips subscription renewals by default (**Ignore Subscription Renewal Orders**). A Shopify-side sender sees synced renewals tagged `Recurring` and may report them as purchases. -- TikTok deduplicates a pixel event and an Events API event only when both carry the same event ID ([TikTok's deduplication guide](https://ads.tiktok.com/resources/help/article/event-deduplication?lang=en)). NEXT has not confirmed that any Shopify-side TikTok app uses the funnel's event ID, so treat two TikTok senders as a double count. -- Google Ads setup is in [Google Ads and YouTube](/docs/campaigns/tracking/google-ads). - - -The starter template documentation says to block the funnel purchase on Shop Sync stores when Triple Whale is connected to Shopify, or orders are counted twice. Triple Whale's own documentation says attribution needs both a pixel purchase and a matching order record ([custom sales platform guide](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform)). Neither setup has been tested on a Shop Sync store. Check attribution in Triple Whale after your first orders, and see [Triple Whale](/docs/campaigns/tracking/triple-whale). + +If a Shopify app sends purchases to Meta and cannot exclude orders tagged `NEXT`, let that app be the only one. Turn off the NEXT Meta Pixel app, and stop the funnel's purchase with `blockedEvents: ['dl_purchase']` as shown in the [Meta](/docs/campaigns/tracking/meta#count-each-purchase-once) guide. -## Mapping a click ID to Shopify - -This example puts the Google click ID and the Meta click ID on the Shopify order as metafields, so Shopify-side tools and your own reports can read them. None of it has been tested on a Shop Sync store. - -### gclid - -The SDK stores `gclid` as a top-level attribution field, so Shop Sync cannot see it. Copy it into attribution metadata on your funnel pages before the order is placed: - -```html title="Funnel page, for example checkout" - -``` +To stop the funnel reporting purchases to a platform, add its line to your campaign in `_data/campaigns.json`: -`next.addMetadata(key, value)` merges one key into `attribution.metadata`. The script copies the value again on `cart:updated` as a precaution. SDK 0.4.38 to 0.4.43 can put a stale `fb_fbp` or `fb_fbc` value back on a cart update, and the starter templates' Meta adapter re-copies those two keys on `cart:updated` for that reason. The `window.nextReady.push` hook and `sdk.on('cart:updated', ...)` are the same calls that adapter uses. - -Then map it: - -1. In NEXT, add a metadata definition with object **Attribution**, key `gclid`, type **Text**. -2. In Shopify, add an **Orders** metafield definition of type single line text. -3. In Shop Sync, click **Add Metadata Sync** and map the NEXT `gclid` field to that Shopify metafield. - -### fbclid +| Platform | Line | +| --- | --- | +| Triple Whale | `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"` | +| Northbeam | `"northbeam_blocked_events": "dl_purchase, dl_upsell_purchase"` | +| Google Analytics 4 | `"ga4_blocked_events": "dl_purchase, dl_upsell_purchase"` | +| TikTok | `"tiktok_blocked_events": "dl_purchase, dl_upsell_purchase"` | -The SDK already stores `fbclid` in attribution metadata, so no script is needed. Add an **Attribution** metadata definition with key `fbclid` and type **Text**, a matching single line text **Orders** metafield in Shopify, and a metadata sync between them. The Shop Sync metadata guide lists `fb_fbc`, `fb_fbp`, `clickid` and `everflow_transaction_id` as other attribution keys you can map the same way. +Before you launch, place one order, send it for fulfillment, and check each platform shows it once. Repeat this check whenever you install a new Shopify app that tracks orders, because it may start reporting funnel sales too. -### Check it +## Put a click ID on the Shopify order -Place an order with a [test card](/docs/testing), then request fulfillment for it. Test orders are not sent to fulfillment automatically, so they reach Shopify only after a manual fulfillment request ([Test orders](https://docs.nextcommerce.com/docs/manage/orders/test-orders)). In Shopify, open the order, which is flagged as a test and tagged `NEXT`, and confirm the metafields hold the values from your landing URL. +Shop Sync does not copy ad details to Shopify by itself. You can map individual values, such as a Meta or Google click ID, onto the Shopify order as metafields. -## Limits +This is covered step by step in the Shop Sync guide, [Send NEXT order data to Shopify](https://guides.nextcommerce.com/guides/shop-sync-metadata): -- Metafields are written once, when Shop Sync creates the Shopify order. A value added to the NEXT order later does not reach Shopify. -- Only `order` and `attribution` metadata can be mapped. Top-level attribution fields such as `utm_source` and `gclid` must be copied into metadata first, as in the `gclid` example. -- If you map `landing_page`, Shopify receives the checkout URL. The SDK replaces the landing page with the checkout URL when it creates the prospect cart. -- `fb_fbp` and `fb_fbc` can be empty on a first visit, because the SDK reads the Meta cookies once when a page loads. Empty values are not written. -- SDK 0.4.43 does not store `ttclid`, `msclkid`, `gbraid` or `wbraid`, so they cannot be mapped. SDK 0.5.0 stores them in attribution metadata, which should make them mappable; this has not been checked. -- Coupon codes are not synced to the Shopify order, according to internal NEXT notes. Unconfirmed: not checked in Shop Sync source. -- Triple Whale's documentation expects Shopify product and variant IDs in pixel events. The funnel sends NEXT SKUs. The effect on matching is not known. -- Revenue differs by sender for the same order. The funnel's GA4 purchase `value` is item revenue without shipping (and without tax on tax-exclusive stores), while the NEXT Meta Pixel app sends the order total including tax. -- More on what the SDK captures is in [Events and attribution](/docs/campaigns/tracking/events-and-attribution). Testing steps are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). +| What you want | Where | +| --- | --- | +| Map any value to a Shopify metafield | [Map a metadata field](https://guides.nextcommerce.com/guides/shop-sync-metadata#mapping) | +| Send the Meta click ID, Meta browser IDs, or the Everflow ID | [Send click IDs to Shopify](https://guides.nextcommerce.com/guides/shop-sync-metadata#click-id) | +| Send the Google click ID | [Google click ID](https://guides.nextcommerce.com/guides/shop-sync-metadata#gclid) | +| Carry a value onto subscription renewals | [Subscriptions](https://guides.nextcommerce.com/guides/shop-sync-metadata#subscriptions) | diff --git a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx index 1d34ffc..b69bae5 100644 --- a/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx +++ b/content/docs/campaigns/tracking/testing-and-troubleshooting.mdx @@ -1,6 +1,6 @@ --- title: Test and troubleshoot tracking -description: Place a safe test order on a NEXT Campaigns funnel, check what the SDK, template adapters and store apps sent at each step, and fix the tracking problems that come up most often. +description: Place a test order on a NEXT Campaigns funnel, 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 @@ -9,164 +9,88 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -Use this page to test a funnel's tracking without polluting your reports, see what each part sent, and fix common problems. It describes a starter template funnel on SDK 0.4.43. The browser behaviour was checked with a test order on 2026-11-16. Vendor dashboards, the Meta Pixel app's server Purchase and Shop Sync were not checked, and the page says so where they come up. +Use this page to check your tracking before you launch, and to fix it when something is missing. -## Test safely +## Before you test -### Build for production +- **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. -Build with `npm run build`. A `npm run dev` build leaves out all of the template's analytics markup: no vendor base pixels, no template analytics adapters and no noscript fallbacks. Testing tracking on a dev build shows nothing. - -### Choose the domain - -Every domain that serves the funnel must be added in the Campaigns app: open **Settings**, then **Global Settings**, then **Allowed Domains**, then **Add Domain**, and pick an **Environment**. Requests from a domain that is not on the list are not allowed. Both environments accept live orders. - -| Environment | NEXT campaign analytics | Vendor pixels and SDK providers | Use it for | -| --- | --- | --- | --- | -| **Production** | Recorded | Fire | The final check before launch, and any test that needs NEXT campaign analytics | -| **Development** | Ignored ("Analytics and event tracking are ignored for development domains") | Still fire. The SDK has no development-domain check, so Meta, GA4, TikTok, Triple Whale and the rest receive your test events | Building and checking pages without adding sessions to NEXT campaign analytics | - -A development domain does not protect your ad accounts. Treat every test on either domain as traffic the vendors will see. - -### Pay with a test card + +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. + -Pay with a [test card](/docs/testing). Test cards create **Test Orders** with no transactions, so no money moves. Store apps decide for themselves whether to send a test order: +Store apps handle test orders in their own way: -| Store app | Sends test orders? | Setting | -| --- | --- | --- | -| Meta Pixel (server Purchase) | Only when the setting is on | **Enable Sending Test Data** (the [merchant docs](https://docs.nextcommerce.com/docs/apps/meta-pixel) call it Enable Test Data) | -| Everflow | Only when both settings are on | **Enable Everflow S2S Postback** and **Enable S2S Postback for test orders**. See the [Everflow docs](https://docs.nextcommerce.com/docs/apps/everflow) | -| Klaviyo | Only when the setting is on | **Enable Sending Test Data**. See the [Klaviyo docs](https://docs.nextcommerce.com/docs/apps/klaviyo) | -| AppLovin AXON | No. **Skip Test Orders** is on by default | This app runs on the NEXT storefront only and does not load on funnels | -| Shop Sync | Creates the Shopify order flagged as a test, with the `NEXT` tag | Not checked in the 2026-11-16 test | +| Store app | Test orders | +| --- | --- | +| Meta Pixel | Skipped unless **Enable Sending Test Data** is on | +| Everflow | Skipped unless **Enable S2S Postback for test orders** is on | +| Klaviyo | Skipped unless **Enable Sending Test Data to Klaviyo** is on | +| Shop Sync | Sent to Shopify only when you request fulfillment on the order | -The browser side does not look at test status. The SDK fires `dl_purchase` for any paid order, test or not, and the template analytics adapters forward it. A test order therefore sends a real-looking purchase, with its value, to every pixel on the funnel. Use each vendor's test tools where it has them (see [Debug tools](#debug-tools)), or exclude your own test traffic in the vendor's reports. +## Run a test order -### Turning tracking off with `?ignore=true` +1. Open your funnel in a new private window, with test details on the link: -Adding `?ignore=true` to a funnel URL turns off all SDK analytics for that browser tab: no `dl_*` events, no SDK providers, no template analytics adapter traffic and no NEXT campaign analytics script. It is stored for the tab session and the SDK carries the parameter onto the next pages, so it stays on as you move through the funnel. Attribution is still captured and still sent on the order. +```text +https://funnel.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=tracking-test&gclid=TEST&fbclid=TEST +``` -To turn it back on, remove `ignore=true` from the URL and run `window.NextAnalyticsClearIgnore()` in the console, or open a new tab. `?reset=true` does not clear it. +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. +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. - -With the flag on, the purchase event is never sent, so the test proves nothing. Use it only to browse your own funnel without creating events. - +Each platform guide has a **Verify it works** section that says where to look in that platform. Developers can also inspect the funnel's events in the browser with the SDK's [debugger](https://cart-sdk.nextcommerce.com/v0.4.43/reference/debugger). -### Use a fresh browser profile or private window for each test +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). -The SDK remembers in the browser what it has already done, so a second test in the same browser behaves differently from a shopper's first visit: +## Check your numbers after launch -- It keeps the last 20 reported order numbers in `localStorage` (`nextDataLayer_reportedPurchases`) and never sends a purchase for those orders again. In the 2026-11-16 test, revisiting the upsell page sent no second `dl_purchase`. -- It keeps the shopper's email, phone and name in a cookie for 365 days, so later tests start with the checkout already filled in. -- It keeps the `evclid` value and the funnel name in `localStorage`, so they carry into later tabs. -- `?reset=true` clears less than its name suggests: stored `utm_*`, `gclid` and `evclid` values survive it, and so does the `?ignore=true` flag. +Once you have a few days of live orders, compare the number of orders in NEXT with the purchases each ad platform reports. Use the same days and the same timezone for both. -Open a new private window or a clean browser profile for every test order, and close it when you are done. +The two numbers should be close. If a platform shows noticeably more or fewer purchases than NEXT, see [Common problems](#common-problems). -## Debug tools +## Common problems -These tools apply to SDK 0.4.43 and the starter template analytics adapters. +### Nothing is tracked - -SDK 0.5.0 has no `window.NextAnalytics.getStatus()`. Open its debug panel with `?debug=1` instead: the Analytics tab lists each event sent and the destinations it reached, and the Providers tab shows whether `?ignore=true` is on. On 0.5.0, `?ignore=false` turns tracking back on for the tab. This was not tested by NEXT. - +| Problem | Cause | Fix | +| --- | --- | --- | +| No platform receives anything | The funnel was built with `npm run dev` | Build with `npm run build` and deploy that | +| 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'` | +| A store app does nothing on the funnel | Tracking apps for your storefront do not cover funnels | Set the platform up with its guide in this section | +| The checkout itself fails to load the cart | The funnel's domain is not in **Allowed Domains** | Add it in the Campaigns app under **Settings**, then **Allowed Domains** | -### In the browser console +### Purchases are missing -| Tool | How to use | What it shows | +| Problem | Cause | Fix | | --- | --- | --- | -| `window.NextDataLayer` | Type it in the console on any funnel page | Every `dl_*` event the SDK pushed on this page, with its `ecommerce`, `attribution`, `user_properties` and `campaign_*` fields. It fills up even when no provider is turned on | -| `window.NextAnalytics.getStatus()` | Run it in the console | `initialized`, `debugMode`, `providers` (the SDK providers that started: `nextCampaign`, `gtm`, `facebook`, `rudderstack`, `custom`), `eventsTracked` (the length of `window.NextDataLayer`) and `ignored` (`true` when `?ignore=true` is in force) | -| `next.getAttribution()` | Run it in the console on any funnel page | The attribution that will be sent with the order: the non-empty `utm_*` fields, `gclid`, `affiliate`, `subaffiliate1` to `subaffiliate5`, `funnel`, and `metadata` with `fbclid`, `fb_fbp`, `fb_fbc`, `fb_pixel_id`, `landing_page`, `sdk_version`, `user_ip` and the other captured keys | -| `next.debugAttribution()` | Run it in the console | The same attribution, printed as a grouped console summary | -| `?debugger=true` | Add it to the funnel URL | Opens the SDK debug overlay, whose Analytics panel shows delivery for each SDK provider. It also turns on verbose logging and the SDK's test mode (test card fill helpers). It is kept across the checkout redirect | -| `?debug=true` | Add it to the funnel URL | Prints the SDK's info, warning and debug log lines in the console. It does not open the overlay | -| `analytics.debug: true` | Set it in `window.nextConfig.analytics` in `assets/config.js` | Logs event validation in the console. Delivery does not change. The setting is saved in that browser's `localStorage`, so debug mode stays on after you remove it; clear the site data to turn it off | -| `?nfdebug=true`, then `NextForwarder.getStatus()` | Add the parameter to the URL, then run the call in the console | `[NextForwarder]` log lines, and one entry per template analytics adapter with `name`, `active`, `sent`, `contacts`, `allowed`, `blocked` and `contact`. Logging is on automatically on `localhost` and `127.0.0.1`. The `meta` entry appears only when `meta_advanced_matching_enabled` is on | -| `TriplePixel('State')` | Run it in the console | `Ready` when the Triple Whale pixel is installed. `TriplePixelData` shows `TripleName`, `plat` and `isHeadless`. See Triple Whale's [custom sales platform guide](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform) | +| No purchase after a test order | The shopper never reached the page after payment | 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** | -### In the network panel +### Things are counted twice -Open your browser's developer tools, choose the network panel, and filter on the host for the platform you are checking. - -| Platform | Filter on | What you see | -| --- | --- | --- | -| NEXT Campaigns API | `campaigns.apps.29next.com` | Cart, prospect cart and order requests, and the NEXT campaign analytics script when the `nextCampaign` provider is on | -| Meta | `facebook.com/tr` | One request per event. On the purchase, `eid` is the event ID and `cd[order_id]` and `cd[value]` carry the order number and value | -| TikTok | `analytics.tiktok.com` | Pixel requests on each page | -| GA4 | `google-analytics.com/g/collect` | GA4 event requests | -| Triple Whale | `api.config-security.com` | Event requests sent to `/event` | -| Google Tag Manager | `googletagmanager.com/gtm.js` | The container load only. Events reach GTM as `window.dataLayer` pushes, not network requests | -| AppLovin Axon | `s.axon.ai` | The pixel script load | -| Taboola | `cdn.taboola.com` | The pixel script load | -| Northbeam | `j.northbeam.io` | The script load | -| RudderStack | `cdn.rudderlabs.com` | The SDK loader | - -### In the vendor's tools - -NEXT did not check any vendor dashboard in the 2026-11-16 test. These are the vendor tools to use. - -| Tool | How to use | What it shows | +| Problem | Cause | Fix | | --- | --- | --- | -| Meta Pixel Helper | Meta's browser extension, open on a funnel page | The browser events the Meta pixel sent from that page. It does not show the server Purchase | -| Meta Events Manager Test Events | Open **Test Events** for your pixel in Events Manager | The events Meta receives while you test. The Meta Pixel app's server Purchase reaches Test Events only when **Enable Sending Test Data** is on and the order's attribution metadata carries `fb_test_code`, which the app passes as the test event code. You can add it before paying with, for example, `next.addMetadata('fb_test_code', 'TEST12345')`. This path was not tested | -| GA4 DebugView | In GA4, open **Admin**, then **DebugView**, or use Google Tag Assistant | The events GA4 received from your test session | -| GTM Preview | Start Preview mode in your GTM container and open the funnel URL | Each `dl_*` push to `window.dataLayer` and the tags that fired on it | -| Triple Whale Pixel Helper | Triple Whale's Chrome extension (beta). Use a real browser: the pixel does not send events from headless browsers | Whether the pixel is detected, the events it fires and their payloads | -| TikTok Events Manager | Open your pixel in TikTok Events Manager | The events TikTok received for the pixel | - -## Step-by-step check - -Run this on a production build in a fresh private window. On each page, check `window.NextDataLayer` and `NextForwarder.getStatus()` in the console and keep the network panel open. The expected results below are what the 2026-11-16 test order showed with Meta, GA4, TikTok and Triple Whale turned on. - -1. Open your first funnel page with UTM parameters and click IDs on the URL, for example `?utm_source=test&utm_medium=cpc&utm_campaign=tracking-test&utm_content=a&utm_term=b&gclid=TEST&fbclid=TEST&aff=AFF1&sub1=S1&nfdebug=true`. Expected: `next.getAttribution()` shows all five `utm_*` fields, `gclid`, `affiliate` set to `AFF1`, `subaffiliate1` set to `S1`, `funnel` (the campaign name when the URL has no `funnel` parameter), and `metadata.fbclid`. `fb_pixel_id` is filled when the Meta pixel is on the page. `ttclid` is not captured on SDK 0.4.43. -2. Go to checkout. Expected: the query string is still on the URL. `window.NextDataLayer` holds `dl_user_data`, `dl_cart_updated` and `dl_begin_checkout`, and the GA4, Meta and TikTok requests appear. A checkout that opens with a package already selected sends `dl_cart_updated` and no `dl_add_to_cart`. -3. Type an email, then a phone number. Expected: with `triplewhale_contact_enabled` on, Triple Whale receives a `Contact` event for each, before any purchase, and the `contacts` count for `triplewhale` in `NextForwarder.getStatus()` goes up. -4. Enter the shipping address and choose a shipping method. Expected: `dl_add_shipping_info`, a GA4 `add_shipping_info` request with `item_id` set to the product SKU, and a Meta `AddShippingInfo` custom event. -5. Pay with a test card. Expected: the checkout page itself sends no purchase. The browser moves to the next page with `ref_id` on the URL. -6. On the first page after payment (an upsell page, or the receipt if there is no upsell). Expected: `dl_purchase` with `transaction_id` and `event_id` set to the order number, for example `100041`, and `value` set to the item revenue without shipping (and without tax on stores that show prices without tax). The Meta purchase request carries `eid=your-store-100041` when `storeName` is set to your store subdomain, plus `cd[order_id]` and `cd[value]`. TikTok and Triple Whale send their purchase on this page too. Reload the page: no second `dl_purchase`, and `localStorage` key `nextDataLayer_reportedPurchases` lists the order number. -7. Accept the upsell. Expected: on the next page, `dl_upsell_purchase` with `transaction_id` set to the order reference plus `-US1` and `value` set to the upsell line only. Triple Whale sends `UpsellPurchase` and TikTok sends another `Purchase`. Meta receives no event for the accepted upsell. -8. Open the order in the store dashboard, or fetch it from the Admin API. Expected: the order is marked as a Test Order and its attribution has the `utm_*` fields, `gclid`, `affiliate`, `subaffiliate1`, `funnel`, and `metadata.fbclid`. `metadata.landing_page` is the checkout URL, not your first funnel page, because checkout overwrites it. `fb_fbp` and `fb_fbc` are filled only when a real Meta pixel has set its cookies. -9. If the Meta Pixel app is installed and **Enable Sending Test Data** is on, wait about 10 minutes (**Enable Delay Order Confirmation**, on by default, holds the event to wait for order updates such as upsells) and look for the server Purchase in Meta. This step was not tested by NEXT. +| Every event counted twice on one platform | The platform is set up in the template and also in Google Tag Manager or a page script | Keep one | +| Meta counts each purchase twice | `storeName` in `assets/config.js` is missing or wrong, or a second server sender reports to the same pixel | Set `storeName` to your store name. See [Meta](/docs/campaigns/tracking/meta#count-each-purchase-once) | +| Meta shows two page views per page | A second Meta pixel or your own page view call | Remove the extra one | +| Sales counted twice on a Shop Sync store | The funnel and a Shopify app both report the order | See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) | -## Common problems +### Numbers look wrong -| Symptom | Cause | Fix | +| Problem | Cause | Fix | | --- | --- | --- | -| No vendor requests on any page | The funnel was built with `npm run dev`, which leaves out the analytics markup | Build with `npm run build` and deploy that build | -| No events at all, and `NextAnalytics.getStatus()` shows `ignored: true` | `?ignore=true` was used earlier in this tab | Remove it from the URL and run `window.NextAnalyticsClearIgnore()`, or open a new private window | -| `NextAnalytics.getStatus()` shows `initialized: false` and no `dl_user_data` | `window.nextConfig.analytics.enabled` is not `true`, or the `analytics` block is missing | Set `enabled: true` in `assets/config.js` | -| Checkout events appear but no `dl_user_data` or `dl_purchase` | `analytics.mode` is not `'auto'`. Any other value, including `'disabled'` or no value, starts no automatic tracking; `'disabled'` does not turn analytics off | Set `mode: 'auto'`. To turn analytics off, set `enabled: false` | -| GTM container loads but receives no `dl_*` events, or the Meta pixel loads but sends no events | The SDK provider is off. `analytics.providers.gtm.enabled` and `analytics.providers.facebook.enabled` are `false` in the template's `config.js`. The Meta provider is also skipped when `settings.pixelId` is empty | Set the provider's `enabled: true`. For Meta, also set `settings.pixelId` to the same ID as `fb_pixel_id`. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) and [Meta](/docs/campaigns/tracking/meta#set-up) | -| One vendor sends nothing | Its ID key in `_data/campaigns.json` is missing or empty | Add the ID to the campaign entry and rebuild | -| Requests go to a vendor you have not set up | A placeholder value was left in a vendor key. Any non-empty value turns the vendor on | Set the key to `""` or remove it | -| Cart and order requests to `campaigns.apps.29next.com` are rejected | The funnel domain is not in **Allowed Domains** | Add it in the Campaigns app under **Settings**, **Global Settings**, **Allowed Domains** | -| NEXT campaign analytics show no sessions or sales from the funnel | The domain is set to **Development**, where NEXT campaign analytics are ignored | Set the domain to **Production** before launch | -| Meta shows two PageView events per page | The pixel is also loaded through GTM with its own PageView tag, or a manual `fbq('track', 'PageView')` was added, while the SDK's Meta provider sends PageView from `dl_user_data` | Remove the extra PageView tag, or add `blockedEvents: ["dl_user_data"]` to `analytics.providers.facebook`. `blockedEvents` matches `dl_*` names exactly, so `"PageView"` blocks nothing. SDK 0.5.0 does not read `blockedEvents` | -| Meta counts each purchase twice | `storeName` is not set, so the browser Purchase has no event ID; or it is still the template's `'store-name'` or another value, so the ID does not match the Meta Pixel app's `your-store-100041` format; or a second server sender, such as a Shopify-side app, sends the same order to the same pixel | Set `window.nextConfig.storeName` to your store subdomain. Keep one server sender per pixel: Meta never deduplicates two server events. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place) | -| Meta never receives the server Purchase | The Meta Pixel app is not installed or has no pixel added; the order is a test order and **Enable Sending Test Data** is off; the order's `fb_pixel_id` does not match any pixel added in the app, in which case nothing is sent and there is no fallback; or the 10-minute delay has not passed | Install the app and add the pixel. Turn on **Enable Sending Test Data** for tests. Add every pixel your funnels load to the app. An empty `fb_pixel_id`, for example when the pixel is loaded through GTM, routes to the app's default pixel. Not tested by NEXT | -| Purchase value is lower than the order total | `dl_purchase` `value` is item revenue. Tax and shipping are sent separately and upsells arrive as separate events. The Meta Pixel app's server Purchase uses the order total including tax, so platforms report different revenue for the same order | Report on item revenue, or add `tax` and `shipping` from the event. See [Events and attribution](/docs/campaigns/tracking/events-and-attribution) | -| Upsell revenue is missing | Each platform receives `dl_upsell_purchase` differently: GA4 as a custom `upsell_purchase` event, Triple Whale as a custom `UpsellPurchase` event, TikTok as another `Purchase`. The SDK's Meta provider sends nothing for it | Follow the upsell section of each platform guide, for example [GA4](/docs/campaigns/tracking/google-analytics-4#purchases-revenue-and-upsells) and [Meta](/docs/campaigns/tracking/meta#purchases-revenue-and-upsells) | -| No purchase event after a test order | The shopper never loaded a page after payment, so `dl_purchase` was never built; or the order was already reported in this browser; or the page loaded with `payment_failed=true` | Load the upsell or receipt page. Use a fresh private window for every test | -| `fb_fbp` or `fb_fbc` is empty on orders | The SDK reads the `_fbp` and `_fbc` cookies once when a page loads and again when the checkout form starts. On a first visit the Meta pixel may not have set them yet, and on SDK 0.4.38 to 0.4.43 a cart update can put the empty value back. The SDK does not build `_fbc` from `fbclid`. A placeholder pixel ID never sets the cookies | Set `fb_pixel_id` in `_data/campaigns.json`: the template's Meta adapter then copies the cookies onto the attribution after they appear and on cart updates. Hand-built funnels have no workaround. Test with your real pixel ID. SDK 0.5.0 has the same limit | -| `ttclid`, `msclkid`, `gbraid` or `wbraid` is missing on orders | SDK 0.4.x does not store them. It only carries them on the URL to later pages | SDK 0.5.0 stores them in the order's attribution metadata. TikTok's own pixel also sets a first-party `ttclid` cookie, so TikTok can read the click ID in the browser | -| Triple Whale shows no attributed sales | Triple Whale attributes an order only when it gets both a pixel purchase and a matching order record. A store without Shopify sends it no order record. On Shop Sync stores the result depends on how the Shopify connection and the funnel purchase are set up | See [Triple Whale](/docs/campaigns/tracking/triple-whale#attribution-requirements) | -| A store app you installed does nothing on the funnel | The TikTok Pixel Events, Google Analytics 4, Google Tag Manager, AppLovin AXON and Taboola apps load on the NEXT storefront only | Use the template analytics adapter keys or the SDK providers. See [Supported integrations](/docs/campaigns/tracking#supported-integrations) | -| Attribution is lost when the shopper moves between domains or tabs | The SDK keeps attribution in the tab's session storage, which pages on another domain cannot read, and a new tab starts over. Only `evclid` and the funnel name are kept across tabs | Keep every funnel page on one domain. If you must link to another domain, turn on `window.nextConfig.utmTransfer` with `enabled: true` and `applyToExternalLinks: true`, which copies the URL parameters onto links when they are clicked | -| GTM tags built for a Shopify or Elevar data layer read empty values | The SDK pushes its own `dl_*` events unchanged to `window.dataLayer` and `window.ElevarDataLayer`. The event names look familiar but the payload is the SDK's: attribution sits under `attribution` (for example `attribution.utm_source`), not at the root | Rebuild the tags on the SDK's payload. Listen to one array only: a tag on both sees every event twice. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) | -| Every GA4 event is counted twice | GA4 is loaded by the template adapter and also by GTM or a page script | Send GA4 from one place. See [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4#browser-and-server-events) | -| The order's attribution shows `utm_source` `konami_code` | The order was placed with the SDK's debug test-order tool, which replaces the real attribution with test values | Place test orders through the normal checkout form with a test card | - -## Get help - -Before you ask for help, collect: - -- The order number of the test order. -- The full funnel URL you opened first, including its query string. -- The SDK version: `sdk_version` in `_data/campaigns.json`, or `metadata.sdk_version` from `next.getAttribution()`. -- Whether the domain is set to **Development** or **Production** in **Allowed Domains**. -- The output of `NextForwarder.getStatus()` and `window.NextAnalytics.getStatus()` on the page where the problem shows. -- A network capture from the browser's network panel, covering the page where the event should have fired. -- For server events, which store apps are installed and how their test-order settings are set. - -`window.NextDataLayer` events and network captures include the shopper's email, phone, name and address. Use test details when you reproduce a problem, and remove real customer data before you share a capture. +| Purchase amount is lower than the order total | The purchase amount is the item prices only, without shipping | Expected. GA4 and Google Tag Manager also receive shipping and tax as separate fields. Other platforms receive the amount alone | +| Upsell revenue is missing, or there are more purchases than orders | Each platform counts upsells in its own way | See **Purchases and upsells** in the platform's guide | +| Ad details are missing on the order | The link lost its parameters, or the shopper moved to another domain or a new tab | Keep the funnel on one domain and keep parameters on your ad links | diff --git a/content/docs/campaigns/tracking/tiktok.mdx b/content/docs/campaigns/tracking/tiktok.mdx deleted file mode 100644 index 893e606..0000000 --- a/content/docs/campaigns/tracking/tiktok.mdx +++ /dev/null @@ -1,209 +0,0 @@ ---- -title: TikTok -description: Send NEXT Campaigns funnel product views, checkout steps, purchases and upsells to a TikTok pixel with the starter template TikTok adapter, keep the TikTok click ID on the order, and check the events arrive. -sidebar_label: TikTok -audience: [merchant, developer] -last_verified: 2026-11-16 -tags: - - Guide ---- -import { Callout } from 'fumadocs-ui/components/callout'; -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - -## Verification status - -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| Setting `tiktok_pixel_id` loads the TikTok pixel and the TikTok adapter on every funnel page | Verified | Starter template source, and a production build of the Olympus template | 2026-11-16 | 0.4.43 | -| The adapter sends funnel events to TikTok on the checkout, upsell and receipt pages | Verified | Test order, `analytics.tiktok.com` requests and the adapter's sent counts observed in the browser | 2026-11-16 | 0.4.43 | -| An accepted upsell is sent as a second `Purchase` with its own event ID | Verified | Test order with an accepted upsell | 2026-11-16 | 0.4.43 | -| The SDK does not store `ttclid` on the NEXT order | Verified | SDK source, and the test order's attribution read back | 2026-11-16 | 0.4.43 | -| TikTok's own pixel sets a first-party `ttclid` cookie | Verified | Observed in the browser during the test order | 2026-11-16 | 0.4.43 | -| Advanced matching sends email and phone with `ttq.identify` on the prospect cart | Unconfirmed | Starter template source only | | 0.4.43 | -| Capturing `ttclid` on the order with `next.addMetadata` | Unconfirmed | SDK source only; the snippet was not run in the test | | 0.4.43 | -| SDK 0.5.0 stores `ttclid` on the order by itself | Unconfirmed | SDK source only | | 0.5.0 | -| Events appear in TikTok Events Manager and attribute to ads | Unconfirmed | Not checked: the test used a placeholder pixel ID | | | -| How TikTok's Shopify integration treats orders pushed by Shop Sync | Unconfirmed | Not documented and not tested | | | -| Server-side TikTok events for campaign orders | Not supported | No NEXT app sends TikTok events from the server | 2026-11-16 | | - -The browser side was checked with a placeholder pixel ID, so what TikTok does with the events after it receives them, including attribution and deduplication, was not checked. - -## What it does - -The TikTok adapter loads TikTok's pixel with your pixel ID on every funnel page and sends the SDK's funnel events to it as TikTok standard events. It covers presell, landing, checkout, upsell and receipt pages. It runs in the browser only. - -NEXT does not send TikTok events from the server. The **TikTok Pixel Events** store app does not help here either: it loads on your NEXT storefront only, runs in the browser only, and does not reach campaign funnels. - -## Before you start - -- A TikTok pixel. Copy its pixel ID from TikTok Events Manager, under **Data sources**. -- A funnel built from a starter template. The adapter ships with every template family except `landing`. -- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. -- If you plan to turn on advanced matching, check that your privacy policy and consent handling cover sending the shopper's email and phone to TikTok. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). - -## Set up - - - - -1. Open `_data/campaigns.json` and find the entry for your campaign. -2. Add your pixel ID: - -```json title="_data/campaigns.json" -{ - "my-campaign": { - "name": "My Campaign", - "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX" - } -} -``` - -3. Optional: add `"tiktok_advanced_matching_enabled": "true"` to send the shopper's email and phone to TikTok. The adapter also accepts `"1"` and `"yes"`. -4. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds, so tracking does not load in the development server. -5. Deploy, then follow [Verify it works](#verify-it-works). - -The key is off when it is absent or empty. Any other value, including a placeholder, loads the pixel. Do not also add a TikTok pixel in Google Tag Manager or in the page for the same pixel ID. Two paths send every event twice. - - - - -The TikTok adapter is documented for starter templates only. It was not tested on a hand-built page, and it is not published as a standalone package. On a hand-built funnel, send the SDK's `dl_*` events to TikTok from your own Google Tag Manager container instead. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). - - - - -## Events sent - -The pixel sends a page view with `ttq.page()` on every page load. On top of that, the adapter forwards these SDK events by default: - -| SDK event | TikTok event | When it fires | -| --- | --- | --- | -| `dl_view_item` | `ViewContent` | A page shows a package | -| `dl_add_to_cart` | `AddToCart` | An item is added to the cart | -| `dl_begin_checkout` | `InitiateCheckout` | The checkout form loads | -| `dl_add_payment_info` | `AddPaymentInfo` | Payment details are complete | -| `dl_purchase` | `Purchase` | The first page after payment | -| `dl_upsell_purchase` | `Purchase` | The page after an upsell is accepted | - -Each event is sent with `ttq.track(name, properties, { event_id })`. A checkout that opens with a package already selected sends no `AddToCart`, because the SDK emits no `dl_add_to_cart` for it. - -To send fewer events, add `tiktok_blocked_events` with a comma-separated list, for example `"tiktok_blocked_events": "dl_add_payment_info"`. You can use `dl_*` names or TikTok names. A TikTok name matches every SDK event mapped to it, so blocking `Purchase` blocks both the order and the upsell purchase. To send more, list them in `tiktok_allowed_events`, or use `"all"` to send every event the adapter can map, which adds `Search` (`dl_view_search_results`), `CompleteRegistration` (`dl_sign_up`) and `Subscribe` (`dl_subscribe`). A list in `tiktok_allowed_events` replaces the default set rather than adding to it. - -### Advanced matching - -With `tiktok_advanced_matching_enabled` on, the adapter calls `ttq.identify` with the shopper's email and `phone_number`. It does this only when the SDK creates the prospect cart, which happens once per session when the checkout has a valid email or phone, a first and last name, and items in the cart. It does not fire as the shopper types. - -| Detail | Behaviour | -| --- | --- | -| Values sent | The raw email, and the phone in E.164 format (`+` and country code). A phone without a country code is not sent | -| Marketing checkbox | If the checkout has an accepts-marketing checkbox and it is unchecked, nothing is sent. If the page has no such checkbox, the call is not blocked | - -## Attribution requirements - -TikTok's click ID is the `ttclid` parameter on your ad's landing URL. Keep it there, and do not strip query strings on your landing pages. In the test order, TikTok's own pixel read `ttclid` from the landing URL and stored it in a first-party cookie, so TikTok can still read the click ID on later pages. Keep every funnel page on the same domain, or on subdomains of one domain, so that cookie is available on the checkout, upsell and receipt pages. - -The NEXT order is a separate matter. SDK 0.4.43 does not store `ttclid` in the order's attribution: it carries the parameter from page to page in the URL, but it never saves it. That does not stop the pixel from attributing, but it means you cannot see the TikTok click ID on the order, export it, or send it from a server of your own. SDK 0.5.0 stores `ttclid` in the order's attribution metadata by itself (from the 0.5.0 source; not tested). - -### Keep ttclid on the order with SDK 0.4.x - -On SDK 0.4.x you can copy the click ID into the order's attribution metadata yourself with `next.addMetadata`. Add this script to every funnel page, for example in each page layout under `_layouts/`, after the SDK loader: - -```html title="_layouts/base.html" - -``` - -Run it on the checkout page as well as the landing page. The checkout re-reads attribution when it loads, and the order is created from that page. This snippet was not run in NEXT's test order, so check it before you rely on it: on the checkout page, `next.getAttribution().metadata.ttclid` should show the value, and the order's attribution metadata should carry it. On a Shop Sync store you can then copy it to a Shopify order metafield the same way as the other click IDs in the [Shop Sync metadata guide](https://guides.nextcommerce.com/guides/shop-sync-metadata). - -## Purchases, revenue and upsells - -| Field | Order purchase | Upsell | -| --- | --- | --- | -| TikTok event | `Purchase` | `Purchase` | -| `event_id` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | -| `value` | Item revenue, excluding shipping and, on tax-exclusive stores, tax | The upsell line only | -| `currency` | The order currency | The order currency | - -The order purchase also carries `content_type: 'product'`, a `contents` list (`content_id`, `content_name`, `content_category`, `brand`, `price`, `quantity`) and `query` set to the coupon code when one was used. - -TikTok has no separate upsell event in this adapter. Each accepted upsell arrives as another `Purchase` with its own event ID, so TikTok's purchase count includes upsells: an order with two accepted upsells counts as three purchases. If you want TikTok to count one purchase per order, add `"tiktok_blocked_events": "dl_upsell_purchase"`. Upsell revenue then does not reach TikTok. - -## Browser and server events - -TikTok receives browser events only. No NEXT app sends TikTok events from the server for campaign orders: the **TikTok Pixel Events** store app is storefront-only and browser-only, and NEXT has no TikTok Events API sender. There is nothing to deduplicate, so the only duplicate risk is a second TikTok pixel on the same pages. - -TikTok should receive each purchase once, from one sender, and for a NEXT funnel that sender is the funnel pixel unless you deliberately add another. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). - -### If you add your own Events API sender - -TikTok deduplicates a pixel event and an Events API event only when both carry the same event name and the same `event_id`, within 48 hours of the first. It keeps the first one it receives. Deduplication is not needed when the pixel and the Events API send different events. See [TikTok event deduplication](https://ads.tiktok.com/resources/help/article/event-deduplication?lang=en). - -So a server `Purchase` you send yourself must use the same `event_id` as the pixel: - -- Order purchase: the NEXT order number, for example `100041`. -- Upsell purchase: the order reference plus `-US1`, `-US2` and so on. - -The adapter passes the SDK's `event_id` for every event. A code comment in the adapter says purchases use `transaction_id`; in practice they are the same value, because the SDK sets a purchase's `event_id` to its `transaction_id`, and the test order showed both as the order number. Non-purchase events get a random `event_id` generated in the browser, so a server cannot reproduce it. Send only `Purchase` from the server, or block the matching browser events. - -The TikTok Pixel Events store app uses a different purchase ID format on the storefront: your store subdomain, a hyphen and the order number, for example `your-store-100041`. That format does not apply to funnels, and the funnel adapter does not use it. - -### Shop Sync stores - -NEXT has not confirmed whether TikTok's Shopify integration reports orders that Shop Sync pushes into Shopify. Those orders are tagged `NEXT` and carry no UTM parameters or click IDs unless you map them. If your Shopify-side TikTok setup does report them, TikTok can get each purchase twice: once from the funnel pixel and once from Shopify. Pick one sender. See [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). - -## Worked example - -A campaign that sends TikTok with advanced matching on, counts one purchase per order, and keeps the TikTok click ID on the order with the snippet from [Attribution requirements](#attribution-requirements): - -```json title="_data/campaigns.json" -{ - "summer-offer": { - "name": "Summer Offer", - "sdk_version": "0.4.43", - "tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX", - "tiktok_advanced_matching_enabled": "true", - "tiktok_blocked_events": "dl_upsell_purchase" - } -} -``` - -With this setup, a shopper who clicks a TikTok ad, buys one package and accepts one upsell sends: page views on every page, `ViewContent` where a package is shown, `InitiateCheckout` when the checkout loads, one `identify` call when the prospect cart is created (if the marketing checkbox allows it), `AddPaymentInfo`, and one `Purchase` with the order number as `event_id` on the first page after payment. No `Purchase` is sent for the upsell. - -## Verify it works - -1. Open a funnel page on your production domain with `?ttclid=test&nfdebug=true` added to the URL. Do not add `?ignore=true`, which turns all tracking off for the browser tab. -2. In the browser console, run `NextForwarder.getStatus()`. The `tiktok` entry should show `active: true`, and `sent` should increase as you move through the funnel. -3. In the browser's network panel, filter for `analytics.tiktok.com`. You should see pixel requests on every page. -4. Place a test order with a [test card](/docs/testing). On the upsell or receipt page the TikTok entry's `sent` count should include the `Purchase`. Accept an upsell and you should see another `Purchase` on the next page, unless you blocked `dl_upsell_purchase`. -5. If you added the `ttclid` snippet, run `next.getAttribution().metadata.ttclid` on the checkout page before you pay. It should return `test`. -6. In TikTok Events Manager, check that the events arrive for your pixel. NEXT has not checked this step. - - -The adapter does not skip test orders. A test-card order that reaches the upsell or receipt page sends a real `Purchase` to the pixel ID in your campaign. Place test orders before you switch to your live pixel ID, or expect them in your TikTok reports. - - -More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). - -## Troubleshooting and limits - -| Symptom | Likely cause | Fix | -| --- | --- | --- | -| No TikTok requests at all | Built with `npm run dev`, `tiktok_pixel_id` empty, or `?ignore=true` set earlier in the tab | Build with `npm run build`; check the key; open a new tab without `?ignore=true` | -| Every event counted twice | TikTok also loaded by GTM or a page script | Remove the other TikTok pixel | -| More purchases in TikTok than orders | Accepted upsells are sent as extra `Purchase` events | Expected; block `dl_upsell_purchase` if you want one purchase per order | -| No `AddToCart` | The checkout opened with a package already selected | Expected; the SDK sends no add-to-cart event for a preselected package | -| No `identify` call | Advanced matching is off, the marketing checkbox is unchecked, or the prospect cart was never created (missing name, email or phone, or empty cart) | Check the key and the checkout fields | -| No `Purchase` after a test order | The shopper never reached a page after payment, or the order was already reported in that browser | Load the upsell or receipt page; use a fresh browser profile for each test | -| `ttclid` missing on the NEXT order | SDK 0.4.x does not store it | Add the `ttclid` snippet, or move to SDK 0.5.0 | - -- TikTok receives no event for subscription renewals or other orders created without a funnel visit. -- Accepting an upsell bundle of several items through the accept-upsell button sends one upsell event per item, each valued at the whole bundle total (SDK 0.4.43 source). On TikTok that becomes several `Purchase` events with inflated revenue. Block `dl_upsell_purchase` if your funnel offers bundles as upsells. -- The **TikTok Pixel Events** store app does not load on campaign funnels and has no setting to skip test orders. Do not rely on it for funnel tracking. -- On SDK 0.5.0, `ttclid` reaches the order and the `dl_*` events, but not the SDK's own tracking-event attribution (from the 0.5.0 source; not tested). diff --git a/content/docs/campaigns/tracking/triple-whale.mdx b/content/docs/campaigns/tracking/triple-whale.mdx index 22271dc..12b6ed4 100644 --- a/content/docs/campaigns/tracking/triple-whale.mdx +++ b/content/docs/campaigns/tracking/triple-whale.mdx @@ -1,6 +1,6 @@ --- title: Triple Whale -description: Load the Triple Whale pixel on NEXT Campaigns funnel pages with the starter template adapter, see exactly which events it sends, and learn why Triple Whale can show no sales for funnel orders on stores with Shop Sync and on stores without Shopify. +description: Track a NEXT Campaigns funnel in Triple Whale. Turn on the Triple Whale pixel in a starter template, on a store that syncs orders to Shopify or one that does not. sidebar_label: Triple Whale audience: [merchant, developer] last_verified: 2026-11-16 @@ -8,54 +8,31 @@ tags: - Guide --- import { Callout } from 'fumadocs-ui/components/callout'; -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; -## Verification status +The starter templates include the Triple Whale pixel. Add your Triple Whale details and the pixel loads on every funnel page, so Triple Whale can see the visit. -| Claim | Status | How it was checked | Date | SDK | -| --- | --- | --- | --- | --- | -| Setting `triplewhale_name` loads the headless Triple Pixel on every funnel page; `TriplePixel('State')` returns `Ready` | Verified | Starter template source, and a production build of the Olympus template with a placeholder TripleName | 2026-11-16 | 0.4.43 | -| With `triplewhale_contact_enabled` on, `Contact` fires when an email is entered and again when a phone number is entered | Verified | Test order, adapter counts and console checks in the browser | 2026-11-16 | 0.4.43 | -| `Purchase` is sent on the first page after payment, and `UpsellPurchase` on the page after an accepted upsell | Verified | Test order with an accepted upsell; adapter `sent` counts and requests to `api.config-security.com` observed | 2026-11-16 | 0.4.43 | -| The `Purchase` and `UpsellPurchase` fields listed in [Events sent](#events-sent) | Partial | The SDK purchase values (order number, value) were observed in the test order. The field names come from source; the Triple Whale request bodies were not inspected | 2026-11-16 | 0.4.43 | -| `AddToCart` is sent once per cart item | Unconfirmed | Source only. The test checkout opened with a preselected bundle, which sends no add-to-cart event | 2026-11-16 | 0.4.43 | -| `triplewhale_blocked_events` stops the funnel purchase events | Unconfirmed | Source only, not tested | 2026-11-16 | 0.4.43 | -| Triple Whale attributes funnel orders on a Shop Sync store with funnel purchases blocked and Contact on | Unconfirmed | Not checked: no Shop Sync store or Triple Whale account was used | | | -| Triple Whale attributes funnel orders on a Shop Sync store with the pixel `Purchase` left on | Unconfirmed | Not checked: no Shop Sync store or Triple Whale account was used | | | -| Triple Whale attributes funnel orders on a store without Shopify | Not supported | Triple Whale requires an order record, and NEXT sends none to Triple Whale | | | -| Triple Whale Sonar and the Meta Pixel app both send the order to Meta | Unconfirmed | Triple Whale documentation and NEXT app source only | | | +Most of this guide is for stores that sync their orders to Shopify with Shop Sync, where Triple Whale gets the sale from Shopify. If your store does not use Shopify, see [Stores without Shopify](#stores-without-shopify). -The test used a placeholder TripleName and no Triple Whale account, so nothing inside Triple Whale was checked: not whether it accepted the events, not attribution, and not Sonar. +## How it works on a Shop Sync store -## What it does +1. The pixel on your funnel records the shopper's visit and where they came from. +2. When the shopper enters their email or phone at checkout, the funnel sends it to Triple Whale. +3. Shop Sync creates the order in Shopify, and Triple Whale picks it up from there. +4. Triple Whale uses the email or phone to connect the Shopify order to the funnel visit. -The Triple Whale adapter in the starter templates loads Triple Whale's headless Triple Pixel on every funnel page (presell, landing, checkout, upsell and receipt) and sends add-to-cart, purchase and upsell events from the shopper's browser. With one setting turned on it also sends the shopper's email and phone as a `Contact` event. NEXT sends nothing to Triple Whale from its servers. - - -Triple Whale attributes an order only when it receives both a pixel purchase and a matching order record, according to its [guide for custom sales platforms](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform). The funnel supplies the pixel events. The order record has to come from somewhere else. - -- On a store with Shop Sync, where Triple Whale is connected to that Shopify store, the synced Shopify order is the order record. NEXT has not confirmed which funnel configuration makes Triple Whale match it. See [Attribution requirements](#attribution-requirements). -- On a store without Shopify, Triple Whale receives the pixel events but no order record, because NEXT does not send orders to Triple Whale's Orders API. Triple Whale attribution for funnel orders is not supported on these stores today. - +The funnel does not send the purchase itself. If it did, Triple Whale would see the same sale twice: once from the funnel and once from Shopify. ## Before you start -- A Triple Whale account. Know whether it is connected to a Shopify store that receives your orders through Shop Sync, because the setup and the outcome differ. -- A funnel built from a starter template. The adapter ships with every template family except `landing`. -- Your funnel domain added in the Campaigns app under **Settings**, then **Allowed Domains**, as a **Production** domain. -- On a Shop Sync store, Shop Sync set up so that campaign orders reach Shopify with the `NEXT` tag. See the [Shop Sync onboarding guide](https://guides.nextcommerce.com/guides/shop-sync-onboarding) and [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync). -- If your funnel sends a Content Security Policy, allow `api.config-security.com` and `conf.config-security.com` and allow `eval()`. The Triple Pixel needs both. +- A Triple Whale account connected to the Shopify store your orders sync to. +- Shop Sync set up, so funnel orders reach Shopify with the `NEXT` tag. See the [Shop Sync onboarding guide](https://guides.nextcommerce.com/guides/shop-sync-onboarding). +- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up - - - -1. In Triple Whale, open **Settings**, then **Business Configurations**, then **Pixel Settings**, and select the **Pixel Installation** tab. -2. Save a **Shopify Headless** Account Setup. Triple Whale's [headless installation guide](https://kb.triplewhale.com/en/articles/6266255-how-to-add-the-triple-pixel-to-a-headless-business-or-custom-website) requires this before it shows the **Headless Installation** snippet under **Recommended installation for your business**. NEXT has not checked which Account Setup to choose for a Triple Whale account without Shopify. -3. In the **Headless Installation** snippet, find `TriplePixelData` and copy the `TripleName` value. For an account connected to Shopify it is your myshopify.com domain, for example `your-store.myshopify.com`. Note the `plat` value in the same object. -4. Do not paste the snippet into your pages. The template already contains the headless snippet and fills in your values. Pixel Settings also offers a Third-Party Landing Page script and a Third-Party/Custom Checkout script for thank-you pages. Do not add either one to the funnel. -5. Open `_data/campaigns.json` and add the keys to your campaign's entry: +1. In Triple Whale, open **Settings**, then **Business Configurations**, then **Pixel Settings**, and select the **Pixel Installation** tab. Save a **Shopify Headless** Account Setup to see the **Headless Installation** snippet. +2. In the snippet, find `TripleName`. It is your `myshopify.com` domain, for example `your-store.myshopify.com`. Copy it. Do not paste the snippet into your pages; the template already includes it. +3. In `_data/campaigns.json`, add these four lines to your campaign: ```json title="_data/campaigns.json" { @@ -63,181 +40,73 @@ Triple Whale attributes an order only when it receives both a pixel purchase and "name": "My Campaign", "triplewhale_name": "your-store.myshopify.com", "triplewhale_platform": "SHOPIFY", - "triplewhale_contact_enabled": "true" + "triplewhale_contact_enabled": "true", + "triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase" } } ``` -6. On a Shop Sync store, decide whether to block the funnel purchases. See [Stores with Shop Sync](#attribution-requirements) and test both options with the [Worked example](#worked-example). -7. Build for production with `npm run build`. The analytics markup is left out of `npm run dev` builds. -8. Deploy, then follow [Verify it works](#verify-it-works). - -| Key | Value | What it does | -| --- | --- | --- | -| `triplewhale_name` | Your TripleName | Turns the adapter on. Empty or missing turns it off. Any non-empty value goes live, including a placeholder | -| `triplewhale_platform` | `SHOPIFY` for a Triple Whale account connected to Shopify. Leave it out on other stores to use the template default, `custom-msp` | Sets `plat` in `TriplePixelData`. Triple Whale says `plat` defaults to Shopify when it is missing and that a wrong value may send data to the wrong shop. Match the `plat` in your Triple Whale snippet | -| `triplewhale_contact_enabled` | `"true"` (`1` and `yes` are also accepted) | Sends `Contact` with the shopper's email or phone. Off unless set | -| `triplewhale_allowed_events` | Comma-separated event names | Sends only these events. Empty means the default set | -| `triplewhale_blocked_events` | Comma-separated event names, for example `"dl_purchase, dl_upsell_purchase"` | Stops these events. Applied after the allowed list | - - -With `triplewhale_contact_enabled` on, the adapter sends the shopper's email and phone to Triple Whale unhashed, as soon as each is entered. It is not tied to the newsletter checkbox on the checkout. Turn it on only when your privacy policy and consent handling cover it. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). With it off, the adapter reads no personal data. - - - - - -The Triple Whale adapter is documented for starter templates only. It was not tested on a hand-built page and is not published as a standalone package. NEXT has no tested Triple Whale path for hand-built funnels; the tested path is a [starter template](/docs/campaigns/templates). - - - +4. Build with `npm run build` and deploy. -## Events sent - -| Triple Whale event | When it is sent | Sent by | Fields | -| --- | --- | --- | --- | -| Page load | Every page load | The headless snippet itself. Triple Whale has no page view call, so the adapter does not send one | Captured by Triple Whale | -| `AddToCart` | An item is added to the cart (`dl_add_to_cart`) | Adapter, one call per cart item | `item` = product SKU, `q` = quantity, `v` = NEXT variant ID (the SKU when there is none) | -| `Contact` | A valid email or phone is entered at checkout, and when the prospect cart is created. Only with `triplewhale_contact_enabled` on | Adapter | `email` or `phone`, or both | -| `Purchase` | The first page after payment (`dl_purchase`) | Adapter | `orderId`, `value`, `currency`, `lineItems` | -| `UpsellPurchase` (custom event) | The page after an upsell is accepted (`dl_upsell_purchase`) | Adapter | `orderId`, `value`, `currency` | - -- `Contact` is sent once per email address and once per phone number on each page load. The phone is sent in international format starting with `+` when the checkout knows the country code. The adapter never guesses a dial code; without one, no phone is sent. -- A checkout that opens with a package already in the cart sends no `dl_add_to_cart`, so no `AddToCart` is sent for that package. -- The adapter maps only these three events from the SDK (`AddToCart`, `Purchase`, `UpsellPurchase`), and all three are in the default set. Setting `triplewhale_allowed_events` to `"all"` adds nothing; the allowed and blocked lists are only useful for sending fewer. Use the `dl_` names in both lists. -- Triple Whale also documents checkout events (`checkoutStarted`, `contactSubmitted`, `addressSubmitted`, `shippingSubmitted`, `paymentSubmitted`) and a `NewSubscription` event. The template sends none of them. - -## Attribution requirements - -Triple Whale's documentation treats `Purchase` as the event that drives attribution, and says a purchase event alone is not enough: Triple Whale must also receive a matching order record. Stores on Shopify get that record through Shopify; custom sales platforms send it through Triple Whale's Orders API. See the [guide for custom sales platforms](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform) and the [headless installation guide](https://kb.triplewhale.com/en/articles/6266255-how-to-add-the-triple-pixel-to-a-headless-business-or-custom-website). - -The template's `Purchase` does not carry everything Triple Whale lists: - -| Triple Whale documents for `Purchase` | The template sends | +| Line | What it does | | --- | --- | -| `orderId`, required | The NEXT order number | -| Email or phone, required | Neither. Identity comes only from the separate `Contact` event, when it is turned on | -| `lineItems`, required, with product and variant IDs (Triple Whale's examples use Shopify IDs) | `lineItems` with the NEXT SKU as `i` and the NEXT variant ID as `v` | -| `address`, required in the help center guide and optional in the developer guide | Not sent | -| `eventId` and `cotkn`, optional | Not sent | -| A matching order record | Nothing from NEXT. On a Shop Sync store, the synced Shopify order | - -NEXT has not tested what Triple Whale does with a purchase that lacks these fields. Triple Whale's own troubleshooting advice for missing attribution is to make sure the purchase event includes every required field. - -### Stores with Shop Sync - -Shop Sync creates a Shopify order for each campaign order when the order is sent to fulfillment. The Shopify order carries the `NEXT` tag, the buyer's email and phone, and the NEXT order number as its PO number. It carries no UTM parameters or click IDs. If your Triple Whale account is connected to that Shopify store, Triple Whale receives this order as its order record. - -Two funnel configurations exist. NEXT has not confirmed which one gives correct attribution, so neither is a default. - -| | Funnel purchases blocked, Contact on | Pixel `Purchase` left on | -| --- | --- | --- | -| Keys | `"triplewhale_platform": "SHOPIFY"`, `"triplewhale_contact_enabled": "true"`, `"triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase"` | `"triplewhale_platform": "SHOPIFY"`, `"triplewhale_contact_enabled": "true"`, no blocked events | -| How the order is meant to reach the ad | Triple Whale ingests the Shopify order, and the `Contact` event ties the shopper's session to it by email or phone | The pixel `Purchase` plus the Shopify order, as Triple Whale's guides describe | -| Why you might choose it | The starter template notes recommend it, to avoid counting each order twice | It follows Triple Whale's statement that `Purchase` is required for attribution | -| Risk | Triple Whale's documentation does not describe this pattern. Buyers who never type an email or phone into the form send no `Contact` | The pixel `orderId` is the NEXT order number and its line items carry NEXT IDs, so it may not match the Shopify order. Triple Whale may record a second, unmatched order | -| Status | Unconfirmed | Unconfirmed | +| `triplewhale_name` | Turns the pixel on for your Triple Whale shop | +| `triplewhale_platform` | Ties the funnel to your Shopify store in Triple Whale | +| `triplewhale_contact_enabled` | Sends the shopper's email and phone, so the Shopify order can be connected to the visit | +| `triplewhale_blocked_events` | Stops the funnel sending the purchase, so the sale is counted once | -Test both in your own Triple Whale account before you rely on either. The [Worked example](#worked-example) shows how. - - -`Contact` fires when the shopper types an email or phone into the checkout form, or when a prospect cart is created from those fields. A buyer who pays with Apple Pay, Google Pay or PayPal may never type either one, so no `Contact` is sent for them. The template does not handle express wallets for Triple Whale. With funnel purchases blocked, Triple Whale then has nothing from the funnel that ties that order to the session. + +`triplewhale_contact_enabled` sends the shopper's email and phone to Triple Whale as soon as they are entered. It is not tied to the marketing opt-in checkbox. Turn it on only when your privacy policy covers it. See [Privacy and consent](/docs/campaigns/tracking#privacy-and-consent). -### Stores without Shopify - -On a NEXT store without Shopify, Triple Whale attribution for funnel orders is not supported. Triple Whale receives the page loads, `AddToCart`, `Contact`, `Purchase` and `UpsellPurchase` from the funnel, but no order record, because NEXT does not send orders to Triple Whale's Orders API. Expect Triple Whale to show no attributed sales for these orders. NEXT has not documented or tested a way to send NEXT orders to that API. - -## Purchases, revenue and upsells - -| Field | Order purchase | Upsell | -| --- | --- | --- | -| Event | `Purchase` | `UpsellPurchase`, sent as `TriplePixel('custom', 'UpsellPurchase', ...)` | -| `orderId` | The NEXT order number, for example `100041` | The order reference plus `-US1`, `-US2` and so on | -| `value` | Item revenue without shipping (tax excluded on stores that show prices without tax, included on tax-inclusive stores) | The upsell line only | -| `currency` | The order currency | The order currency | -| `lineItems` | One entry per item: `i` (SKU), `q` (quantity), `v` (variant ID) | None. Custom events are kept to flat values | - -The upsell is a custom event so that Triple Whale's purchase count stays at one per order. Triple Whale lets you mark custom events as conversion events in its settings. NEXT has not confirmed how Triple Whale reports `UpsellPurchase` revenue. +## What gets tracked -On a Shop Sync store, an accepted upsell is added to the same NEXT order, so it is part of the Shopify order Shop Sync creates. Triple Whale's order record for that sale therefore includes the upsell. On a store without Shopify there is no order record, for the first sale or the upsell. - -## Browser and server events +| When | What Triple Whale receives | +| --- | --- | +| Any page loads | The visit | +| An item is added to the cart | `AddToCart` | +| The shopper enters an email or phone at checkout | `Contact` | +| The order syncs to Shopify | The order, through Triple Whale's Shopify connection | -The funnel sends Triple Whale browser events only. No NEXT app sends Triple Whale events from the server. On a Shop Sync store, Triple Whale also receives the synced Shopify order through its Shopify connection, which is a second source for the same sale. +The sale appears in Triple Whale after the order syncs to Shopify, not at the moment of payment. An accepted upsell is added to the same NEXT order, so it is included when that order syncs. -Every platform should receive each purchase from one place. Decide which sender reports the purchase for each platform before you launch; see [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). + +A shopper who pays with Apple Pay, Google Pay or PayPal may never type an email or phone into the checkout. No `Contact` is sent for them, so Triple Whale may not be able to connect their order to an ad. + -### Sonar and the Meta Pixel app +## Verify it works -If you use Triple Whale Sonar to send purchase events to Meta, and the NEXT Meta Pixel app also sends its server `Purchase` for the same order, Meta receives the order twice from two servers. Meta does not deduplicate two server events ([Meta deduplication guide](https://developers.facebook.com/documentation/ads-commerce/conversions-api/deduplicate-pixel-and-server-events)). The Meta Pixel app sends its server `Purchase` for campaign orders. Exclude orders tagged `NEXT` from Sonar if your Sonar setup allows it, or send the Meta purchase from only one of the two. NEXT has not tested Sonar with funnel orders, so treat this as Unconfirmed. See [Meta](/docs/campaigns/tracking/meta) for the Meta side. +1. Open your funnel in a new private window, with test details on the link, for example `?utm_source=tw-test&utm_campaign=tw-test`. +2. In the browser console, run `TriplePixel('State')`. It should return `"Ready"`. +3. Type an email at checkout and place an order. +4. Check the order reached Shopify with the `NEXT` tag. A [test order](https://docs.nextcommerce.com/docs/manage/orders/test-orders) is not sent to Shopify automatically, so request fulfillment on it in NEXT. It arrives in Shopify marked as a test order. +5. In Triple Whale, find the order by the buyer's email and check the source it is attributed to. -Triple Whale's [Sonar guide for headless Shopify stores](https://kb.triplewhale.com/en/articles/9548187-sonar-setup-for-headless-shopify-stores) also asks for `checkoutStarted` and `paymentSubmitted` on the checkout. The template does not send them, so Sonar's checkout and payment signals get nothing from the funnel. +| What you see in Triple Whale | What it means | +| --- | --- | +| One order, attributed to your test source | Everything is working | +| One order, not attributed | The order arrived from Shopify, but Triple Whale did not connect it to the visit. Check `triplewhale_contact_enabled` is on and the email matches | +| Two orders for one sale | The funnel is still sending the purchase. Check `triplewhale_blocked_events`. If that is set, the order may have shipped in two parts, which [shows as two Shopify orders](https://guides.nextcommerce.com/guides/shop-sync-daily-operations#shopify-analytics) | +| No order | The order has not reached Shopify yet, or Triple Whale is not connected to that Shopify store | -## Worked example +Triple Whale's Pixel Helper extension only works in a normal Chrome window. In Triple Whale's Pixel Settings, "Online Store: Not Installed" is expected for a funnel. -A Shop Sync store with Triple Whale connected to its Shopify store, testing both configurations. +## Stores without Shopify -Start with funnel purchases blocked: +Add one line to your campaign, with your funnel's domain as the value: -```json title="_data/campaigns.json" -{ - "summer-offer": { - "name": "Summer Offer", - "sdk_version": "0.4.43", - "triplewhale_name": "your-store.myshopify.com", - "triplewhale_platform": "SHOPIFY", - "triplewhale_contact_enabled": "true", - "triplewhale_blocked_events": "dl_purchase, dl_upsell_purchase" - } -} +```json +"triplewhale_name": "funnel.example.com" ``` -1. Build with `npm run build` and deploy. -2. In a fresh browser profile, open your landing page with UTM parameters you will recognize, for example `?utm_source=tw-test&utm_medium=test&utm_campaign=tw-test-a`. -3. Type an email address in the checkout form and place an order. -4. Check that the order reached Shopify with the `NEXT` tag. A [test order](https://docs.nextcommerce.com/docs/manage/orders/test-orders) is created in Shopify marked as a test, and test orders are not sent to fulfillment automatically. If it does not appear, request fulfillment on it in NEXT. NEXT has not confirmed whether Triple Whale counts Shopify test orders; if it does not, repeat the test with a real order. -5. In Triple Whale, find the order, using the buyer's email or the Shopify order. Note whether it is attributed to your test source or shows as unattributed, and whether it appears once or twice. -6. Remove `triplewhale_blocked_events`, rebuild and redeploy. Repeat steps 2 to 5 with a new browser profile, a different email address and `utm_campaign=tw-test-b`. -7. Keep the configuration that gives one attributed order per sale. - -| What you see in Triple Whale | What it suggests | -| --- | --- | -| One order, attributed to your test source | That configuration attributes on your account | -| One order, unattributed | The Shopify order arrived, but Triple Whale did not tie it to the funnel session | -| Two orders for one sale | The pixel `Purchase` was recorded as a separate order from the Shopify order | -| No order | The Shopify order was not created yet, or Triple Whale is not connected to that Shopify store | - -## Verify it works - -1. Open a funnel page on your production domain with `?nfdebug=true` added to the URL. Do not add `?ignore=true`, which turns all tracking off for the browser tab, and never use it when you are proving a purchase. -2. In the browser console, run `TriplePixelData`. It should return an object with your `TripleName`, your `plat` value and `isHeadless: true`. `undefined` means the pixel is not installed or the page is a cached copy. -3. Run `TriplePixel('State')`. It should return `"Ready"`. -4. Run `NextForwarder.getStatus()`. The `triplewhale` entry should show `active: true`. With Contact on, `contact` is not `null`. `blocked` shows any events you blocked. -5. Type an email on the checkout. With Contact on, `contacts` in the `triplewhale` entry should go up. -6. Place a test order with a [test card](/docs/testing). On the first page after payment, `sent` should go up for `Purchase` (unless you blocked it), and you should see a request to `api.config-security.com`. Accept an upsell and `UpsellPurchase` is sent on the next page. -7. For a visual check, use Triple Whale's Pixel Helper Chrome extension in a normal Chrome window. It does not report from headless or automated browsers. -8. In Triple Whale's Pixel Settings, "Online Store: Not Installed" is expected for a headless install. That check looks only at the Shopify theme app embed. +The funnel then sends Triple Whale the visit, add to cart, and each purchase and upsell from the browser. Upsells arrive as an `UpsellPurchase` event; mark it as a conversion event in Triple Whale's settings to see its value. -These steps prove the events leave the page. They do not prove attribution; for that, run the [Worked example](#worked-example). More checks are in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). +Triple Whale's own guidance is that a custom platform should also send each order to its Orders API for full attribution. NEXT does not send orders there, so check your attribution in Triple Whale after your first orders. -## Troubleshooting and limits +## Troubleshooting -| Symptom | Likely cause | Fix | +| Problem | Likely cause | Fix | | --- | --- | --- | -| Triple Whale shows no sales for funnel orders, store without Shopify | Triple Whale has no order record for them | Not supported today. See [Stores without Shopify](#attribution-requirements) | -| Triple Whale shows no sales for funnel orders, Shop Sync store | The Shopify order was not created yet, Triple Whale is not connected to that Shopify store, `triplewhale_name` or `triplewhale_platform` points at another shop, or the configuration does not attribute on your account | Check the order in Shopify with the `NEXT` tag; check the two keys against your Triple Whale snippet; run the [Worked example](#worked-example) | -| Orders counted twice in Triple Whale | Pixel `Purchase` on alongside the synced Shopify order | Test the configuration with funnel purchases blocked | -| `TriplePixelData` is `undefined` | Built with `npm run dev`, `triplewhale_name` empty, or a cached page | Build with `npm run build`; check the key; reload the page without the cache | -| No Triple Whale requests at all | Pixel blocked by a Content Security Policy, or `?ignore=true` set earlier in the tab | Allow `eval()` and the `config-security.com` hosts; open a new tab without `?ignore=true` | -| No `Purchase` after a test order | Blocked by `triplewhale_blocked_events`, the shopper never reached a page after payment, or the order was already reported in that browser | Check `getStatus()`; load the upsell or receipt page; use a fresh browser profile for each test | -| No `Contact` | `triplewhale_contact_enabled` not set, the email is not valid yet, or the buyer used an express wallet | Set the key to `"true"`; finish typing the email; see the express wallet note above | -| Pixel Helper shows nothing | Headless or automated browser | Use a normal Chrome window | -| Data lands in the wrong Triple Whale shop | Wrong `triplewhale_platform` or `triplewhale_name` | Copy both values from your Triple Whale snippet | -| Meta counts the order twice | Triple Whale Sonar and the Meta Pixel app both send it | Send the Meta purchase from one of them | - -- Leave Triple Whale's Eval Restriction setting off unless Triple Whale support asks you to turn it on. -- The template pins Triple Pixel snippet version `2.17`. It does not use the `ver` value from your copied snippet. -- No NEXT app sends orders or events to Triple Whale from the server. -- Triple Whale says subscription renewals are sent through its Orders API. NEXT does not send them, and the funnel sends nothing for a renewal. -- This guide covers SDK 0.4.43, which the starter templates pin. Triple Whale behaviour on SDK 0.5.0 was not tested. +| The pixel is not on the page | `triplewhale_name` is missing or empty | Add it and rebuild | +| Data lands in the wrong Triple Whale shop | `triplewhale_name` does not match your Triple Whale snippet | Copy `TripleName` from the snippet again | +| Meta counts each order twice | Triple Whale Sonar and the NEXT Meta Pixel app both send it to Meta | Exclude orders tagged `NEXT` in Sonar, or use only one of the two | diff --git a/content/docs/storefront/checkout-links.mdx b/content/docs/storefront/checkout-links.mdx index a326abd..4766ad0 100644 --- a/content/docs/storefront/checkout-links.mdx +++ b/content/docs/storefront/checkout-links.mdx @@ -38,7 +38,7 @@ Checkout link parameters can be broadly split into two groups, [Cart Parameters] ### Attribution Parameters -In addition to populating the cart, you can pass attribution parameters to attribute the order to your marketing channel. Campaign funnels capture a similar set from the landing URL; see the [Events and attribution reference](/docs/campaigns/tracking/events-and-attribution). +In addition to populating the cart, you can pass attribution parameters to attribute the order to your marketing channel. Campaign funnels capture a similar set from the landing URL; see [Tracking](/docs/campaigns/tracking#for-developers). | Parameter | Description | | -----------| -------- | From bd2b75992c01fc699c87cdb61d05ddee05666e22 Mon Sep 17 00:00:00 2001 From: masmalsah Date: Mon, 16 Nov 2026 16:31:48 -0600 Subject: [PATCH 04/10] Tracking guides: address review notes on Everflow, Triple Whale and opt-in wording - Everflow bridge: create the SDK ready queue if it does not exist yet, so the deferred write is not dropped. - Triple Whale, stores without Shopify: say to add only the one line. - TikTok, Snapchat, Pinterest: shopper details are held back only when a marketing opt-in checkbox exists and is unticked. Co-Authored-By: Claude Fable 5.2 --- content/docs/campaigns/tracking/everflow.mdx | 2 +- content/docs/campaigns/tracking/more-integrations.mdx | 6 +++--- content/docs/campaigns/tracking/triple-whale.mdx | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/content/docs/campaigns/tracking/everflow.mdx b/content/docs/campaigns/tracking/everflow.mdx index 862b1f2..7f3bda3 100644 --- a/content/docs/campaigns/tracking/everflow.mdx +++ b/content/docs/campaigns/tracking/everflow.mdx @@ -93,7 +93,7 @@ EF.click({ next.setMetadata({ everflow_transaction_id: id }); }; if (window.next && typeof window.next.setMetadata === 'function') apply(window.next); - else if (Array.isArray(window.nextReady)) window.nextReady.push(apply); + else (window.nextReady = window.nextReady || []).push(apply); }); ``` diff --git a/content/docs/campaigns/tracking/more-integrations.mdx b/content/docs/campaigns/tracking/more-integrations.mdx index f2d512f..92d8a1c 100644 --- a/content/docs/campaigns/tracking/more-integrations.mdx +++ b/content/docs/campaigns/tracking/more-integrations.mdx @@ -30,7 +30,7 @@ Most platforms here are turned on with one line in `_data/campaigns.json`. Add t - **What it tracks:** page views, product views, add to cart, checkout started, payment details and purchases. - **Upsells:** each accepted upsell counts as another purchase, so an order with two upsells shows as three purchases. To count one purchase per order, add `"tiktok_blocked_events": "dl_upsell_purchase"`. Upsell revenue then does not reach TikTok. -- **Shopper details:** add `"tiktok_advanced_matching_enabled": "true"` to send email and phone. Nothing is sent unless the marketing opt-in checkbox on your checkout is ticked. +- **Shopper details:** add `"tiktok_advanced_matching_enabled": "true"` to send email and phone. If your checkout has a marketing opt-in checkbox, nothing is sent when it is unticked. The TikTok store app covers your NEXT storefront, not funnels. @@ -42,7 +42,7 @@ The TikTok store app covers your NEXT storefront, not funnels. - **What it tracks:** page views, product views, add to cart, checkout started, payment details and purchases. - **Upsells:** each accepted upsell counts as another purchase. -- **Shopper details:** add `"snap_advanced_matching_enabled": "true"` to send email and phone. Nothing is sent unless the marketing opt-in checkbox on your checkout is ticked. +- **Shopper details:** add `"snap_advanced_matching_enabled": "true"` to send email and phone. If your checkout has a marketing opt-in checkbox, nothing is sent when it is unticked. ## Pinterest @@ -52,7 +52,7 @@ The TikTok store app covers your NEXT storefront, not funnels. - **What it tracks:** page views, add to cart, and a `checkout` event for each order. - **Upsells:** each accepted upsell counts as another `checkout`. -- **Shopper details:** add `"pinterest_enhanced_match_enabled": "true"` to send email. Nothing is sent unless the marketing opt-in checkbox on your checkout is ticked. +- **Shopper details:** add `"pinterest_enhanced_match_enabled": "true"` to send email. If your checkout has a marketing opt-in checkbox, nothing is sent when it is unticked. ## Taboola diff --git a/content/docs/campaigns/tracking/triple-whale.mdx b/content/docs/campaigns/tracking/triple-whale.mdx index 12b6ed4..9a08413 100644 --- a/content/docs/campaigns/tracking/triple-whale.mdx +++ b/content/docs/campaigns/tracking/triple-whale.mdx @@ -93,7 +93,7 @@ Triple Whale's Pixel Helper extension only works in a normal Chrome window. In T ## Stores without Shopify -Add one line to your campaign, with your funnel's domain as the value: +Add only this line to your campaign, with your funnel's domain as the value. Leave out the other three lines from the Shop Sync setup: ```json "triplewhale_name": "funnel.example.com" From 0cabdb850c9e5e64fe1d0b3621c2ec8722d586e5 Mon Sep 17 00:00:00 2001 From: masmalsah Date: Mon, 16 Nov 2026 16:43:33 -0600 Subject: [PATCH 05/10] Tracking overview: remove the diagram The three numbered steps above it already say the same thing. Co-Authored-By: Claude Fable 5.2 --- content/docs/campaigns/tracking/index.mdx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/content/docs/campaigns/tracking/index.mdx b/content/docs/campaigns/tracking/index.mdx index e882e53..52b3a1a 100644 --- a/content/docs/campaigns/tracking/index.mdx +++ b/content/docs/campaigns/tracking/index.mdx @@ -19,13 +19,6 @@ Start with [Set up tracking](/docs/campaigns/tracking/getting-started), then ope 2. **Your funnel remembers where they came from.** It keeps those details as the shopper moves from page to page, and saves them on the order. 3. **Your funnel tells each platform what happened.** Page views, checkout steps and purchases are sent to the platforms you have turned on. -```mermaid -flowchart LR - A[Ad click] --> B[Your funnel pages] - B -->|page views, checkout, purchase| C[Ad and analytics platforms] - B -->|order with ad details| D[NEXT order] -``` - You turn a platform on by adding its ID to your funnel. For a few platforms a NEXT store app also sends the purchase from NEXT's servers. Each guide tells you exactly what to add and where. From da834d867c54703ef345c4b496b60e889aa2ac00 Mon Sep 17 00:00:00 2001 From: Brett Bond Date: Tue, 17 Nov 2026 11:13:10 +1100 Subject: [PATCH 06/10] Triple Whale guide: state that attribution needs Shopify for now Triple Whale attributes a sale only when it gets both the pixel purchase and a matching order record. NEXT sends no orders to Triple Whale's Orders API, so stores without Shopify get pixel events but no attributed sales. Mark that as not supported yet, point those stores to Shop Sync, and scope the overview and getting-started entries to Shopify stores. Co-Authored-By: Claude Opus 5.5 --- .../docs/campaigns/tracking/getting-started.mdx | 2 +- content/docs/campaigns/tracking/index.mdx | 2 +- content/docs/campaigns/tracking/triple-whale.mdx | 15 ++++++++++----- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/content/docs/campaigns/tracking/getting-started.mdx b/content/docs/campaigns/tracking/getting-started.mdx index 9a00eee..280c394 100644 --- a/content/docs/campaigns/tracking/getting-started.mdx +++ b/content/docs/campaigns/tracking/getting-started.mdx @@ -42,7 +42,7 @@ Open `_data/campaigns.json`, find your campaign, and add a line for each platfor | Google Analytics 4 | `ga4_id` | [Google Analytics 4](/docs/campaigns/tracking/google-analytics-4) | | Google Ads and YouTube | No line of its own. Uses GA4 | [Use GA4 purchases in Google Ads](/docs/campaigns/tracking/google-analytics-4#use-ga4-purchases-in-google-ads) | | Meta | `fb_pixel_id` | [Meta](/docs/campaigns/tracking/meta) | -| Triple Whale | `triplewhale_name` | [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| Triple Whale (Shop Sync stores) | `triplewhale_name` | [Triple Whale](/docs/campaigns/tracking/triple-whale) | | AppLovin Axon | `axon_event_key` | [AppLovin Axon](/docs/campaigns/tracking/applovin-axon) | | TikTok, Snapchat, Pinterest, Taboola, Northbeam | One line each | [More integrations](/docs/campaigns/tracking/more-integrations) | | RudderStack | Two lines | [More integrations](/docs/campaigns/tracking/more-integrations#rudderstack) | diff --git a/content/docs/campaigns/tracking/index.mdx b/content/docs/campaigns/tracking/index.mdx index 52b3a1a..a18558b 100644 --- a/content/docs/campaigns/tracking/index.mdx +++ b/content/docs/campaigns/tracking/index.mdx @@ -34,7 +34,7 @@ Tracking apps you installed for your NEXT storefront, such as TikTok Pixel Event | Google Ads and YouTube | [Use GA4 purchases in Google Ads](/docs/campaigns/tracking/google-analytics-4#use-ga4-purchases-in-google-ads) | | Meta (Facebook and Instagram) | [Meta Pixel and Conversions API](/docs/campaigns/tracking/meta) | | Everflow | [Everflow](/docs/campaigns/tracking/everflow) | -| Triple Whale | [Triple Whale](/docs/campaigns/tracking/triple-whale) | +| Triple Whale (stores that sync orders to Shopify) | [Triple Whale](/docs/campaigns/tracking/triple-whale) | | AppLovin Axon | [AppLovin Axon](/docs/campaigns/tracking/applovin-axon) | | TikTok, Snapchat, Pinterest, Taboola, Northbeam, RudderStack, Klaviyo | [More integrations](/docs/campaigns/tracking/more-integrations) | diff --git a/content/docs/campaigns/tracking/triple-whale.mdx b/content/docs/campaigns/tracking/triple-whale.mdx index 9a08413..69d3a71 100644 --- a/content/docs/campaigns/tracking/triple-whale.mdx +++ b/content/docs/campaigns/tracking/triple-whale.mdx @@ -1,6 +1,6 @@ --- title: Triple Whale -description: Track a NEXT Campaigns funnel in Triple Whale. Turn on the Triple Whale pixel in a starter template, on a store that syncs orders to Shopify or one that does not. +description: Track a NEXT Campaigns funnel in Triple Whale on a store that syncs orders to Shopify. Stores without Shopify can load the pixel but do not get attributed sales yet. sidebar_label: Triple Whale audience: [merchant, developer] last_verified: 2026-11-16 @@ -11,7 +11,7 @@ import { Callout } from 'fumadocs-ui/components/callout'; The starter templates include the Triple Whale pixel. Add your Triple Whale details and the pixel loads on every funnel page, so Triple Whale can see the visit. -Most of this guide is for stores that sync their orders to Shopify with Shop Sync, where Triple Whale gets the sale from Shopify. If your store does not use Shopify, see [Stores without Shopify](#stores-without-shopify). +This guide is for stores that sync their orders to Shopify with Shop Sync, where Triple Whale gets the sale from Shopify. On a store without Shopify, Triple Whale cannot attribute funnel sales yet. See [Stores without Shopify](#stores-without-shopify). ## How it works on a Shop Sync store @@ -93,15 +93,19 @@ Triple Whale's Pixel Helper extension only works in a normal Chrome window. In T ## Stores without Shopify -Add only this line to your campaign, with your funnel's domain as the value. Leave out the other three lines from the Shop Sync setup: + +Triple Whale only attributes a sale when it receives two things: the purchase from the pixel, and a matching order record. On a Shopify store the order record comes from Shopify. On any other store it has to be sent to [Triple Whale's Orders API](https://triplewhale.readme.io/reference/pixel-setup-guide-for-custom-sales-platform), and NEXT does not send orders there. Without Shopify, Triple Whale gets the pixel events but no orders, so funnel sales will not be attributed to your ads. + + +You can still load the pixel to see funnel visits in Triple Whale. Add only this line to your campaign, with your funnel's domain as the value, and leave out the other three lines from the Shop Sync setup: ```json "triplewhale_name": "funnel.example.com" ``` -The funnel then sends Triple Whale the visit, add to cart, and each purchase and upsell from the browser. Upsells arrive as an `UpsellPurchase` event; mark it as a conversion event in Triple Whale's settings to see its value. +The funnel then sends Triple Whale the visit, add to cart, and each purchase and upsell from the browser. Upsells arrive as an `UpsellPurchase` event. None of these turn into attributed revenue until Triple Whale also receives the order. -Triple Whale's own guidance is that a custom platform should also send each order to its Orders API for full attribution. NEXT does not send orders there, so check your attribution in Triple Whale after your first orders. +If Triple Whale attribution matters for a store without Shopify, use Shop Sync to send the orders to a Shopify store connected to Triple Whale, and follow the setup above. ## Troubleshooting @@ -109,4 +113,5 @@ Triple Whale's own guidance is that a custom platform should also send each orde | --- | --- | --- | | The pixel is not on the page | `triplewhale_name` is missing or empty | Add it and rebuild | | Data lands in the wrong Triple Whale shop | `triplewhale_name` does not match your Triple Whale snippet | Copy `TripleName` from the snippet again | +| Visits show in Triple Whale but no sales are attributed, on a store without Shopify | Triple Whale gets no order record for the funnel's sales | Not supported yet. See [Stores without Shopify](#stores-without-shopify) | | Meta counts each order twice | Triple Whale Sonar and the NEXT Meta Pixel app both send it to Meta | Exclude orders tagged `NEXT` in Sonar, or use only one of the two | From ce03576d57cecf714cf04730f872026a7f4ac244 Mon Sep 17 00:00:00 2001 From: Brett Bond Date: Tue, 17 Nov 2026 11:21:19 +1100 Subject: [PATCH 07/10] Tracking guides: say campaign, not funnel; clarify dashboard apps are Storefront only Refer to the thing being tracked as a campaign, and to the product as Campaigns, keeping funnel only where it means a shopper's path. Replace the storefront-apps callout: apps set up under Apps in the dashboard add scripts to the Storefront only and are not added to Campaigns; the server-side Meta, Everflow and Klaviyo apps are the exceptions. Same note on the GA4, GTM, Axon, TikTok and Taboola sections. GA4 verify steps now connect Tag Assistant so DebugView shows events. Co-Authored-By: Claude Opus 5.5 --- .../apps/guides/marketing-attribution.mdx | 4 +- .../docs/campaigns/tracking/applovin-axon.mdx | 16 ++++---- content/docs/campaigns/tracking/everflow.mdx | 22 +++++------ .../campaigns/tracking/getting-started.mdx | 18 ++++----- .../campaigns/tracking/google-analytics-4.mdx | 23 +++++------ .../campaigns/tracking/google-tag-manager.mdx | 20 +++++----- content/docs/campaigns/tracking/index.mdx | 24 ++++++------ content/docs/campaigns/tracking/meta.mdx | 20 +++++----- .../campaigns/tracking/more-integrations.mdx | 10 ++--- content/docs/campaigns/tracking/shop-sync.mdx | 26 ++++++------- .../tracking/testing-and-troubleshooting.mdx | 18 ++++----- .../docs/campaigns/tracking/triple-whale.mdx | 38 +++++++++---------- content/docs/storefront/checkout-links.mdx | 2 +- content/docs/storefront/event-tracking.mdx | 4 +- 14 files changed, 124 insertions(+), 121 deletions(-) diff --git a/content/docs/apps/guides/marketing-attribution.mdx b/content/docs/apps/guides/marketing-attribution.mdx index eb1d874..d755735 100644 --- a/content/docs/apps/guides/marketing-attribution.mdx +++ b/content/docs/apps/guides/marketing-attribution.mdx @@ -215,8 +215,8 @@ Attribution metadata stored on the cart is automatically carried over to the ord ## Campaigns & API Order Attribution - -This guide is for building an attribution app. To set up Triple Whale, Meta, TikTok, Google Ads or another platform on a NEXT Campaigns funnel, see [Tracking](/docs/campaigns/tracking). + +This guide is for building an attribution app. To set up Triple Whale, Meta, TikTok, Google Ads or another platform on a NEXT campaign, see [Tracking](/docs/campaigns/tracking). 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. diff --git a/content/docs/campaigns/tracking/applovin-axon.mdx b/content/docs/campaigns/tracking/applovin-axon.mdx index 664a85d..0ad52e6 100644 --- a/content/docs/campaigns/tracking/applovin-axon.mdx +++ b/content/docs/campaigns/tracking/applovin-axon.mdx @@ -1,6 +1,6 @@ --- title: AppLovin Axon -description: Track a NEXT Campaigns funnel in AppLovin Axon. Turn on the Axon pixel in a starter template, and keep Axon's cookie for a year with a small server function. +description: Track your NEXT campaign in AppLovin Axon. Turn on the Axon pixel in a starter template, and keep Axon's cookie for a year with a small server function. sidebar_label: AppLovin Axon audience: [merchant, developer] last_verified: 2026-11-16 @@ -8,14 +8,14 @@ tags: - Guide --- -The starter templates include the AppLovin Axon pixel. Add your event key and the funnel reports page views, checkout steps and purchases to Axon from the shopper's browser. +The starter templates include the AppLovin Axon pixel. Add your event key and the campaign reports page views, checkout steps and purchases to Axon from the shopper's browser. -The **AppLovin AXON** store app covers your NEXT storefront, not funnels. +The **AppLovin AXON** 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 Axon to your campaign. ## Before you start - Your Axon event key, from your AppLovin account. -- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). +- A campaign that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up @@ -53,7 +53,7 @@ Turn it on only when your privacy policy covers it. See [Privacy and consent](/d Axon's pixel recognises a returning shopper with a cookie named `_axwrt`. Some browsers, including Safari, shorten the life of cookies that a script sets. AppLovin [strongly recommends](https://support.applovin.com/en/growth/promoting-your-websites/track-and-optimize/google-tag-manager) that your site's server sets the same value again as a one-year cookie named `axwrt`. -A starter template funnel is a static site, so this needs a small server function. On Netlify, add this one file. It runs on every page request, and when the shopper already has `_axwrt`, it adds `axwrt` to the response: +A starter template campaign is a static site, so this needs a small server function. On Netlify, add this one file. It runs on every page request, and when the shopper already has `_axwrt`, it adds `axwrt` to the response: ```js title="netlify/edge-functions/axwrt.js" const ROOT_DOMAIN = 'example.com'; @@ -84,15 +84,15 @@ export const config = { }; ``` -Set `ROOT_DOMAIN` to your funnel's root domain, without `www`. There is nothing to add to your pages or to `netlify.toml`. The cookie is in place from the shopper's second page view. +Set `ROOT_DOMAIN` to your campaign's root domain, without `www`. There is nothing to add to your pages or to `netlify.toml`. The cookie is in place from the shopper's second page view. Any server or edge platform can do the same thing; Netlify is the example. ## Verify it works -1. Open your funnel in a new private window and go through it. +1. Open your campaign in a new private window and go through it. 2. Place an order with a [test card](/docs/testing) and continue to the next page. 3. In your AppLovin account, check that the events arrive, including the purchase. -4. Open a second funnel page, then check in your browser's developer tools that a cookie named `axwrt` is set. +4. Open a second campaign page, then check in your browser's developer tools that a cookie named `axwrt` is set. More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). diff --git a/content/docs/campaigns/tracking/everflow.mdx b/content/docs/campaigns/tracking/everflow.mdx index 7f3bda3..4ab3dd1 100644 --- a/content/docs/campaigns/tracking/everflow.mdx +++ b/content/docs/campaigns/tracking/everflow.mdx @@ -1,6 +1,6 @@ --- title: Everflow -description: Report NEXT Campaigns funnel sales to Everflow with the Everflow app, for both redirect links and direct links, and avoid duplicate or missing conversions. +description: Report NEXT Campaigns sales to Everflow with the Everflow app, for both redirect links and direct links, and avoid duplicate or missing conversions. sidebar_label: Everflow audience: [merchant, developer] last_verified: 2026-11-16 @@ -16,7 +16,7 @@ Everflow pays affiliates for sales, so a missing or duplicated conversion costs Everflow gives every ad click an ID, called the transaction ID. To report a sale, Everflow needs that same ID back. 1. The shopper clicks an affiliate link, and Everflow creates a transaction ID. -2. Your funnel saves the transaction ID on the order. +2. Your campaign saves the transaction ID on the order. 3. The NEXT Everflow app sends the sale to Everflow from NEXT's servers, with that ID. The rule that keeps this working: **one order, one transaction ID, one thing reporting the sale.** @@ -31,7 +31,7 @@ The rule that keeps this working: **one order, one transaction ID, one thing rep ## Before you start - Your Everflow network ID and postback URL, from your Everflow account or your affiliate network. -- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). +- A campaign that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up the Everflow app @@ -54,26 +54,26 @@ Which setup you need depends on how your affiliate links work. | | Redirect links | Direct links | | --- | --- | --- | -| How the shopper arrives | Through Everflow first, then to your funnel | Straight to your funnel | +| How the shopper arrives | Through Everflow first, then to your campaign | Straight to your campaign | | Where the transaction ID comes from | It is on the link, as `evclid` | Everflow's click script creates it in the browser | -| What you add to the funnel | Nothing | The bridge snippet | +| What you add to the campaign | Nothing | The bridge snippet | | Use it when | The ad platform allows a redirecting link | The ad platform does not. Google Ads requires the final URL to stay on one domain | ### Redirect links -Set up your Everflow offer so the link to your funnel carries Everflow's transaction ID in a parameter named `evclid`: +Set up your Everflow offer so the link to your campaign carries Everflow's transaction ID in a parameter named `evclid`: ```text -https://funnel.example.com/?evclid=EVERFLOW_TRANSACTION_ID +https://campaign.example.com/?evclid=EVERFLOW_TRANSACTION_ID ``` Use Everflow's transaction ID macro for the value. See Everflow's [guide to parameters and macros](https://helpdesk.everflow.io/en/articles/6173403-a-guide-to-parameters-and-macros). -The funnel saves it on the order by itself. Nothing else is needed. +The campaign saves it on the order by itself. Nothing else is needed. ### Direct links -With a direct link there is no `evclid`. Everflow's click script, which your affiliate partner usually runs in their own Google Tag Manager container, creates the transaction ID when the page loads. That ID then has to be handed to the funnel, or the order has no ID and nothing is reported. +With a direct link there is no `evclid`. Everflow's click script, which your affiliate partner usually runs in their own Google Tag Manager container, creates the transaction ID when the page loads. That ID then has to be handed to the campaign, or the order has no ID and nothing is reported. Keep the partner's own `EF.click` call as it is, and add this to what happens after it. It saves the ID and puts it on the order: @@ -110,7 +110,7 @@ Direct links are less reliable than redirect links. If the click script does not ## Affiliate details on the link -The funnel 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 [attribution parameters](https://cart-sdk.nextcommerce.com/v0.4.43/reference/url-parameters#attribution). ## What the app sends @@ -172,7 +172,7 @@ If the second network's ID ends up in `evclid`, its sales are sent to the first ## Verify it works 1. Turn on **Enable S2S Postback for test orders** in the app. -2. Open your funnel through an Everflow test link, in a new private window. +2. Open your campaign through an Everflow test link, in a new private window. 3. Place an order with a [test card](/docs/testing). 4. Open the order in your store dashboard. Its attribution should show an Everflow transaction ID. 5. In Everflow, search for that transaction ID. You should see one conversion with your order number as the Order ID. diff --git a/content/docs/campaigns/tracking/getting-started.mdx b/content/docs/campaigns/tracking/getting-started.mdx index 280c394..08b818b 100644 --- a/content/docs/campaigns/tracking/getting-started.mdx +++ b/content/docs/campaigns/tracking/getting-started.mdx @@ -1,6 +1,6 @@ --- title: Set up tracking -description: Turn on tracking for a NEXT Campaigns funnel. Add your platform IDs to a starter template, publish, and run a first test order. +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 @@ -9,17 +9,17 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -This page turns tracking on for a funnel and walks you through a first test. Do it once per funnel. For how tracking works, see the [Tracking overview](/docs/campaigns/tracking). +This page turns tracking on for a campaign and walks you through a first test. Do it once per campaign. For how tracking works, see the [Tracking overview](/docs/campaigns/tracking). ## Before you start You need: -- A funnel built from a [starter template](/docs/campaigns/templates). The `landing` template family has no tracking, so use one of the others. -- Your funnel's domain added in the Campaigns app. Open **Settings**, then **Allowed Domains**, click **Add Domain**, and set **Environment** to **Production**. +- A campaign built from a [starter template](/docs/campaigns/templates). The `landing` template family has no tracking, so use one of the others. +- Your campaign's domain added in the Campaigns app. Open **Settings**, then **Allowed Domains**, click **Add Domain**, and set **Environment** to **Production**. - The ID for each platform you advertise on, such as your Meta pixel ID or GA4 measurement ID. Each platform guide says where to find it. -Built your funnel by hand instead of from a starter template? See [Hand-built funnels](#hand-built-funnels). +Built your campaign by hand instead of from a starter template? See [Hand-built campaigns](#hand-built-campaigns). ## Step 1: Add your platform IDs @@ -69,10 +69,10 @@ Build with `npm run build` and deploy to the domain you added as **Production**. ## Step 4: Run a test order 1. Open a new private browser window. -2. Open your funnel with test details on the link: +2. Open your campaign with test details on the link: ```text -https://funnel.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch-test +https://campaign.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch-test ``` 3. Go through checkout and pay with a [test card](/docs/testing). @@ -94,6 +94,6 @@ Make sure each platform hears about a sale once. If more than one thing reports If your orders sync to Shopify through Shop Sync, read [Tracking on Shop Sync stores](/docs/campaigns/tracking/shop-sync) before you launch. -## Hand-built funnels +## Hand-built campaigns -The steps above are for starter templates, which include the tracking code for every supported platform. A funnel you built by hand does not include it. For a hand-built funnel, load your own Google Tag Manager container on every page and send events to your platforms from there. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). +The steps above are for starter templates, which include the tracking code for every supported platform. A campaign you built by hand does not include it. For a hand-built campaign, load your own Google Tag Manager container on every page and send events to your platforms from there. See [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager). diff --git a/content/docs/campaigns/tracking/google-analytics-4.mdx b/content/docs/campaigns/tracking/google-analytics-4.mdx index 0fb87ac..49ed286 100644 --- a/content/docs/campaigns/tracking/google-analytics-4.mdx +++ b/content/docs/campaigns/tracking/google-analytics-4.mdx @@ -1,6 +1,6 @@ --- title: Google Analytics 4 -description: Track a NEXT Campaigns funnel in Google Analytics 4, and use those purchases as conversions in Google Ads, including for YouTube ads. +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 @@ -8,14 +8,14 @@ tags: - Guide --- -The starter templates include Google Analytics 4. Add your measurement ID and the funnel reports page views, checkout steps and purchases to your GA4 property. +The starter templates include Google Analytics 4. Add your measurement ID and the campaign reports page views, checkout steps and purchases to your GA4 property. -GA4 events are sent from the shopper's browser only. The **Google Analytics 4** store app covers your NEXT storefront, not funnels. +GA4 events are sent from the shopper's browser only. The **Google Analytics 4** 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 GA4 to your campaign. ## Before you start - Your GA4 measurement ID. It starts with `G-`. -- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). +- A campaign that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up @@ -65,7 +65,7 @@ The purchase amount is lower than the order total because it is the item prices ## Use GA4 purchases in Google Ads -Google Ads, including YouTube ads, has no ID of its own to add to your funnel. Instead, Google Ads imports the purchases your funnel reports to GA4. +Google Ads, including YouTube ads, has no ID of its own to add to your campaign. Instead, Google Ads imports the purchases your campaign reports to GA4. 1. In Google Ads, turn on **auto-tagging**. It adds the Google click ID (`gclid`) to your ad links. 2. In GA4, mark `purchase` as a key event. Mark `upsell_purchase` too if you want upsell revenue counted in Google Ads. @@ -84,17 +84,18 @@ If you manage your tags in Google Tag Manager, you can fire a Google Ads convers ## Keeping the source of the visit -GA4 reads where a visitor came from off the page link, so keep your UTM parameters on your ad links. Keep every funnel page on one domain, or on subdomains of one domain, so GA4 follows the visitor through the whole funnel. +GA4 reads where a visitor came from off the page link, so keep your UTM parameters on your ad links. Keep every campaign page on one domain, or on subdomains of one domain, so GA4 follows the visitor through the whole funnel. ## Verify it works -1. In GA4, open **Admin**, then **DebugView**. You can also use Google Tag Assistant. -2. Open your funnel in a new private window and go through checkout. You should see `page_view`, `begin_checkout` and the other events. -3. 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. Accept an upsell. You should see `upsell_purchase` on the page after it. +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. +5. Accept an upsell. You should see `upsell_purchase` on the page after it. ## Troubleshooting If nothing reaches GA4, check that `ga4_id` is set, then rebuild. More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). -On a funnel that is not built from a starter template, send events to GA4 from your own [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) container. +On a campaign that is not built from a starter template, send events to GA4 from your own [Google Tag Manager](/docs/campaigns/tracking/google-tag-manager) container. diff --git a/content/docs/campaigns/tracking/google-tag-manager.mdx b/content/docs/campaigns/tracking/google-tag-manager.mdx index ff40e92..559e9b1 100644 --- a/content/docs/campaigns/tracking/google-tag-manager.mdx +++ b/content/docs/campaigns/tracking/google-tag-manager.mdx @@ -1,6 +1,6 @@ --- title: Google Tag Manager -description: Send NEXT Campaigns funnel events to your own Google Tag Manager container, and build tags on them. +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 @@ -9,16 +9,16 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -Google Tag Manager (GTM) does not report anything by itself. It is a container for your own tags. Your funnel sends its events to GTM, and the tags you build decide which platforms hear about them. +Google Tag Manager (GTM) does not report anything by itself. It is a container for your own tags. Your campaign sends its events to GTM, and the tags you build decide which platforms hear about them. Use GTM when you want to manage tags yourself, or for a platform that has no guide in this section. ## Before you start - A GTM web container and its ID, which looks like `GTM-XXXXXXX`. -- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). +- A campaign that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). -The **Google Tag Manager** store app covers your NEXT storefront, not funnels. +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. ## Set up @@ -35,7 +35,7 @@ Setup has two parts, and you need both. } ``` -2. In `assets/config.js`, switch `gtm` on. This makes the funnel send its events to the container: +2. In `assets/config.js`, switch `gtm` on. This makes the campaign send its events to the container: ```js title="assets/config.js" // Inside analytics.providers: @@ -47,7 +47,7 @@ gtm: { 3. Build with `npm run build` and deploy. -With only `gtm_id`, the container loads but receives no funnel events. With only the `config.js` setting, the events are sent but there is no container to receive them. +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. ## Events you can build tags on @@ -98,7 +98,7 @@ The events also carry the shopper's email, phone, name and address under `user_p - 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. -If a platform is already turned on in your funnel, for example GA4 or TikTok, do not also send it purchases from GTM. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). +If a platform is already turned on in your campaign, for example GA4 or TikTok, do not also send it purchases from GTM. See [Send each purchase from one place](/docs/campaigns/tracking#send-each-purchase-from-one-place). ### Google Ads conversions @@ -109,7 +109,7 @@ Do this only if you are not already importing purchases into Google Ads from GA4 ## Verify it works -1. Start **Preview** mode in your GTM container and open your funnel. +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. 4. Accept an upsell. `dl_upsell_purchase` appears on the page after it. @@ -125,6 +125,6 @@ Do this only if you are not already importing purchases into Google Ads from GA4 More help is in [Test and troubleshoot tracking](/docs/campaigns/tracking/testing-and-troubleshooting). -## Hand-built funnels +## Hand-built campaigns -On a funnel 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, 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). diff --git a/content/docs/campaigns/tracking/index.mdx b/content/docs/campaigns/tracking/index.mdx index a18558b..c63f9db 100644 --- a/content/docs/campaigns/tracking/index.mdx +++ b/content/docs/campaigns/tracking/index.mdx @@ -1,6 +1,6 @@ --- title: Tracking overview -description: How ad and analytics tracking works on NEXT Campaigns funnels, which platforms are supported, and which guide to follow for Google, Meta, Everflow, Triple Whale, TikTok and more. +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 @@ -9,20 +9,22 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -Tracking tells your ad platforms which clicks turned into sales. A NEXT Campaigns funnel is made of your own pages, so tracking is something you turn on for each platform you advertise on. This section shows you how. +Tracking tells your ad platforms which clicks turned into sales. A campaign in NEXT Campaigns is made of your own pages, so tracking is something you turn on for each platform you advertise on. This section shows you how. Start with [Set up tracking](/docs/campaigns/tracking/getting-started), then open the guide for your platform. ## How tracking works 1. **A shopper clicks your ad.** The link carries details about the ad, such as UTM parameters and a click ID. -2. **Your funnel remembers where they came from.** It keeps those details as the shopper moves from page to page, and saves them on the order. -3. **Your funnel tells each platform what happened.** Page views, checkout steps and purchases are sent to the platforms you have turned on. +2. **Your campaign remembers where they came from.** It keeps those details as the shopper moves from page to page, and saves them on the order. +3. **Your campaign tells each platform what happened.** Page views, checkout steps and purchases are sent to the platforms you have turned on. -You turn a platform on by adding its ID to your funnel. For a few platforms a NEXT store app also sends the purchase from NEXT's servers. Each guide tells you exactly what to add and where. +You turn a platform on by adding its ID to your campaign. For a few platforms a NEXT store app also sends the purchase from NEXT's servers. Each guide tells you exactly what to add and where. - -Tracking apps you installed for your NEXT storefront, such as TikTok Pixel Events, Google Analytics 4 or Google Tag Manager, only run on the storefront. Set tracking up for your funnel with the guides below. + +Tracking apps you install and set up under **Apps** in your NEXT dashboard, such as TikTok Pixel Events, Google Analytics 4, Google Tag Manager, AppLovin AXON and Taboola Pixel Events, only add their scripts to your Storefront. Their settings do not say this, but nothing from them is added to your Campaigns. To track a campaign, add each platform's tracking to the campaign itself, using the guides below. + +The exceptions are apps that send an order event from NEXT's servers after the order is placed: the Meta Pixel app's Conversions API purchase, Everflow and Klaviyo. Those cover campaign orders as well as Storefront orders. ## Supported integrations @@ -44,13 +46,13 @@ If your orders sync to Shopify through Shop Sync, also read [Tracking on Shop Sy Each platform should hear about a sale once. If two things report the same sale to the same platform, it is counted twice. -A sale can be reported by your funnel pages, by a NEXT store app, and, on Shop Sync stores, by a Shopify app that sees the synced order. For each platform, pick one of them to report the purchase and turn the others off. The platform guides show how. +A sale can be reported by your campaign pages, by a NEXT store app, and, on Shop Sync stores, by a Shopify app that sees the synced order. For each platform, pick one of them to report the purchase and turn the others off. The platform guides show how. -Meta is the one exception: the funnel and the Meta Pixel app can both report the purchase, because they label it with the same ID and Meta merges the two. See the [Meta](/docs/campaigns/tracking/meta#count-each-purchase-once) guide. +Meta is the one exception: the campaign and the Meta Pixel app can both report the purchase, because they label it with the same ID and Meta merges the two. See the [Meta](/docs/campaigns/tracking/meta#count-each-purchase-once) guide. ## Privacy and consent -NEXT Campaigns does not include a cookie banner or consent tool. If your funnel needs one, add it to your pages and make sure it also stops the tracking scripts. +NEXT Campaigns does not include a cookie banner or consent tool. If your campaign needs one, add it to your pages and make sure it also stops the tracking scripts. Some platforms can receive the shopper's email and phone to improve matching. Those settings are off unless you turn them on. Turn them on only when your privacy policy covers it. @@ -61,7 +63,7 @@ Some platforms can receive the shopper's email and phone to improve matching. Th ## For developers -The funnel'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: +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 | | --- | --- | diff --git a/content/docs/campaigns/tracking/meta.mdx b/content/docs/campaigns/tracking/meta.mdx index bd9b32b..73e86aa 100644 --- a/content/docs/campaigns/tracking/meta.mdx +++ b/content/docs/campaigns/tracking/meta.mdx @@ -1,6 +1,6 @@ --- title: Meta Pixel and Conversions API -description: Track a NEXT Campaigns funnel in Meta. Turn on the Meta pixel on your funnel pages, send purchases from NEXT's servers with the Meta Pixel app, and make sure Meta counts each purchase once. +description: Track your NEXT campaign in Meta. Turn on the Meta pixel on your campaign pages, send purchases from NEXT's servers with the Meta Pixel app, and make sure Meta counts each purchase once. sidebar_label: Meta audience: [merchant, developer] last_verified: 2026-11-16 @@ -9,9 +9,9 @@ tags: --- import { Callout } from 'fumadocs-ui/components/callout'; -Meta tracking on a funnel has two parts: +Meta tracking on a campaign has two parts: -- **The Meta pixel** reports page views, checkout steps and purchases from the shopper's browser. You set it up in your funnel files. +- **The Meta pixel** reports page views, checkout steps and purchases from the shopper's browser. You set it up in your campaign files. - **The Meta Pixel app** reports each purchase again from NEXT's servers. You set it up in your store dashboard. You can use the pixel on its own, but both together give Meta the most complete picture. When both report a purchase, they label it with the same ID, so Meta counts it once. @@ -20,7 +20,7 @@ You can use the pixel on its own, but both together give Meta the most complete - Your Meta pixel ID. For the Meta Pixel app you also need an access token for that pixel. - Your store name: the part before `.29next.store` in your store address. For `your-store.29next.store` it is `your-store`. -- A funnel that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). +- A campaign that is ready for tracking. See [Set up tracking](/docs/campaigns/tracking/getting-started). ## Set up @@ -65,7 +65,7 @@ window.nextConfig = { With only `fb_pixel_id`, the pixel loads but sends nothing. With only the `config.js` setting, there is no pixel to send through. Templates ship with `storeName: 'store-name'` and `facebook` switched off, so change both. -Do not add your own `fbq('track', 'PageView')` to the pages. The funnel already sends page views, and a second call counts each one twice. +Do not add your own `fbq('track', 'PageView')` to the pages. The campaign already sends page views, and a second call counts each one twice. ### Part 2: Meta Pixel app @@ -169,13 +169,13 @@ Set the same ID as `pixelId` in each campaign's `assets/config.js`. Then add eve ## Verify it works 1. In Meta Events Manager, open **Test Events** for your pixel. -2. Start the test from that page and go through your funnel in the same browser. You should see `PageView` on each page. +2. Start the test from that page and go through your campaign in the same browser. You should see `PageView` on each page. 3. Place an order with a [test card](/docs/testing). On the next page you should see `Purchase` with the event ID `your-store-` followed by the order number. To test the Meta Pixel app as well: 1. Turn on **Enable Sending Test Data** in the app. -2. Copy the test code shown in **Test Events** and add this to a funnel page, with your code in place of `TEST12345`: +2. Copy the test code shown in **Test Events** and add this to a campaign page, with your code in place of `TEST12345`: ```html