Set up tracking
Turn on tracking for your NEXT campaign. Add your platform IDs to a starter template, publish, and run a first test order.
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.
Before you start
You need:
- A campaign built from a starter template. The
landingtemplate 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 campaign by hand instead of from a starter template? See Hand-built campaigns.
Step 1: Add your platform IDs
Open _data/campaigns.json, find your campaign, and add a line for each platform you use.
{
"my-campaign": {
"name": "My Campaign",
"fb_pixel_id": "123456789012345",
"ga4_id": "G-XXXXXXXXXX",
"tiktok_pixel_id": "CXXXXXXXXXXXXXXXXXXX"
}
}| Platform | Line to add | Guide |
|---|---|---|
| Google Tag Manager | gtm_id | Google Tag Manager |
| Google Analytics 4 | ga4_id | Google Analytics 4 |
| Google Ads and YouTube | No line of its own. Uses GA4 | Use GA4 purchases in Google Ads |
| Meta | fb_pixel_id | Meta |
| Triple Whale (Shop Sync stores) | triplewhale_name | Triple Whale |
| TikTok, Snapchat, Pinterest, Taboola, AppLovin Axon, Northbeam | One line each | More integrations |
| RudderStack | Two lines | More integrations |
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
Build with npm run build and deploy to the domain you added as Production.
Tracking does not load in the development server
npm run dev leaves tracking out, so you will not see any events there. Test on a deployed production build.
Step 4: Run a test order
- Open a new private browser window.
- Open your campaign with test details on the link:
https://campaign.example.com/?utm_source=test&utm_medium=cpc&utm_campaign=launch-test- Go through checkout and pay with a test card.
- Continue to the next page after payment. This is where the purchase is reported.
- Check each platform received it. Every platform guide has a Verify it works section, for example Meta.
- Open the order in your store dashboard and check that its attribution shows
utm_sourceastestandutm_campaignaslaunch-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=trueto the link. It turns tracking off for that browser tab.
Something not showing up? See Test and troubleshoot tracking.
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.
If your orders sync to Shopify through Shop Sync, read Tracking on Shop Sync stores before you launch.
Hand-built campaigns
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.