# Add your Meta, Google and TikTok tracking codes

> Tracking setup is where you paste the tracking codes from Meta, Google and TikTok so each one can see which ads lead to sales. Paste a code into its card, click Save, check the status light, and send a test event. This guide also shows where to find each code.

- Admin location: `/admin/ads/tracking`
- Needs the Ads feature turned on for the site
- Topic: Marketing
- Last updated: 2026-11-26
- Web page: https://www.closeraccess.com/docs/ads-tracking-codes

## How Tracking setup works

Go to **Marketing → Ads → Tracking setup**. The page has one card each for **Meta (Facebook and Instagram)**, **Google (Analytics and Ads)** and **TikTok**. Each card works the same way:

1. Paste the tracking code that platform gave you into the box.
2. Click **Save**.
3. Look at the status light on the card.
4. Click **Send test event** to check the connection without waiting for a real sale.

You don't need an ad account connected to save a tracking code. The ad account link is only needed for spend reports. Set up only the platforms you advertise on.

> **Tip:** Under each box, click **Where do I find this?** for click-by-click steps. Menu names on Meta, Google and TikTok can change slightly.

## Read the status light

| Light | What it means |
| --- | --- |
| Not set up | No code is saved on this card yet. |
| Waiting for first visit | The code is saved. This is normal until someone visits your site and accepts the cookie banner. |
| Working — last event … | Events are reaching the platform. The light says how long ago the last one was. |
| Couldn't check right now | The status couldn't be read. Click **Check again** in a moment. |

If a card says the last event was not accepted, click **Send test event** to see why.

## Add your Meta tracking code

The **Meta tracking code** is your Pixel ID. A Pixel is a small tracking code on your website that tells Meta when someone visits, signs up or buys.

1. Go to business.facebook.com/events_manager and log in with the account that owns your ads.
2. In the left menu click "Data sources", then click your Pixel. Meta may call it a dataset. If you have none, click "Connect data", choose "Web" and follow Meta's prompts.
3. Click the "Settings" tab.
4. Copy the number called "Pixel ID" or "Dataset ID". It is numbers only, about 15 or 16 digits.
5. Paste it into **Meta tracking code** and click **Save**.

The **Meta access token** is optional but recommended. It lets your site's server tell Meta about purchases directly, which catches sales that ad blockers and iPhone privacy settings would hide. To get one, open your Pixel's "Settings" tab in Meta Events Manager, scroll to "Conversions API" and click "Generate access token". Copy it straight away, because Meta may only show it once.

**Meta test code** is only needed if Meta asked you for one. It is on the "Test events" tab of your Pixel and starts with TEST. Leave it blank otherwise.

## Add your Google codes

The Google card has two groups: **Google Analytics 4** and **Google Ads (optional)**.

| Box | What to paste | Where it is |
| --- | --- | --- |
| **Analytics tracking code** | Your GA4 Measurement ID. It starts with G-. | analytics.google.com → "Admin" → "Data streams" → your website's stream → "Measurement ID". |
| **Analytics server secret** | Optional. Lets your site's server also send purchases to Google Analytics. | In the same data stream, under "Measurement Protocol API secrets". Click "Create" and copy the "Secret value". |
| **Google Ads account code** | Your conversion ID. It starts with AW-. | ads.google.com → "Goals" → "Conversions" → your Purchase conversion → "Tag setup" → "Install the tag yourself". It is the part before the slash in the send_to line. |
| **Purchase code** | The conversion label for a paid purchase. | The part after the slash in the same send_to line. |
| **Booking request code** | The conversion label for a booking request, when someone asks to book before any payment. | Make a second conversion action in the "Submit lead form" category and copy the part after the slash. |

> **Heads up:** After pasting your Analytics tracking code, switch off "Page changes based on browser history events" in Google Analytics, or every page gets counted twice. It is in your data stream under "Enhanced measurement", inside "Page views". Your site already reports its own page views.

> **Tip:** Short on time? Google Ads can import the purchases and booking requests that Google Analytics records. If you link Google Analytics to Google Ads, you can leave the Google Ads boxes empty.

**Send test event** on this card goes to Google Analytics 4. Look for it under Reports, then Realtime. It can take a minute. Google Ads purchases and booking requests are counted in your visitor's browser, so they can't be tested from this page.

## Add your TikTok tracking code

1. Go to ads.tiktok.com and log in to TikTok Ads Manager.
2. Click "Tools" at the top, then "Events".
3. Under "Web events", click "Manage" next to your Pixel. If you have none, click "Set up web events" and choose "TikTok Pixel".
4. Copy the Pixel ID. It is about 20 letters and numbers.
5. Paste it into **TikTok tracking code** and click **Save**.

The **TikTok access token** is optional but recommended. It lets your site's server tell TikTok about purchases directly. In TikTok Events Manager, open your Pixel's "Settings", find "Events API" and click "Generate Access Token".

## Replace or remove a saved token

Access tokens and the Analytics server secret are stored encrypted and are never shown again after you save them. The box shows **Saved** instead.

- Click **Replace** to paste a new one. Click **Keep the saved one** if you change your mind.
- Click **Remove** to delete it. It is removed when you click **Save**. Click **Undo** before saving to keep it.

If you change a box and don't save, **Send test event** warns that you have changes that aren't saved yet. Save first so the test uses them.

## Prove it works before you spend

A green light and a test event show the connection works. To prove a real sale reaches your ad accounts, make a test purchase on your own site. The checklist on **Marketing → Ads → Overview** walks you through it under **Make a test purchase**. See [Set up ads and tracking](https://www.closeraccess.com/docs/ads-setup-tracking.md).

> **Heads up:** A test purchase is a real purchase. You pay for it like any customer would.

## Common questions

### Where do I find my Meta Pixel ID?

In Meta Events Manager (business.facebook.com/events_manager), click "Data sources", open your Pixel, and click the "Settings" tab. The Pixel ID is a number about 15 or 16 digits long. Meta may call it a Dataset ID.

### Where do I find my Google Analytics Measurement ID?

In analytics.google.com, click "Admin", then "Data streams", then your website's stream. The Measurement ID is at the top right and starts with G-.

### Why does my tracking light say Waiting for first visit?

The code is saved and nothing is wrong. The light turns to Working once someone visits your site and accepts the cookie banner.

### Do I need an access token as well as a Pixel ID?

No, it is optional. It is recommended because it lets your site report purchases from its server too, which catches sales that ad blockers hide from the Pixel.

### Why are my page views doubled in Google Analytics?

The "Page changes based on browser history events" setting is still on in your data stream's Enhanced measurement. Switch it off. Your site already reports its own page views.

### Can I see my access token again after saving?

No. For your safety it is never shown again. Use **Replace** to paste a new one.

## Related guides

- [Set up ads, tracking and ad links](https://www.closeraccess.com/docs/ads-setup-tracking.md): Connect your Meta account, add Meta, Google and TikTok tracking codes, and make a tagged link for each ad so you can see which ads sell.
- [Make a tagged ad link and QR code](https://www.closeraccess.com/docs/ad-links.md): Make a tagged link for each ad so your sales report shows which ad brought each buyer. Pick the page and the platform, copy the link and download a QR code.
- [See where your sales came from](https://www.closeraccess.com/docs/where-your-sales-came-from.md): Read the sales report by campaign, promo code and promoter, compare revenue with ad spend, choose how credit is given, and download a CSV.
- [Create a Facebook and Instagram ad](https://www.closeraccess.com/docs/create-an-ad.md): Use the four-step ad builder to make a Facebook and Instagram ad with AI-written text, then review it and switch it on in Meta Ads Manager.
- [Ads tutorials, tour and glossary](https://www.closeraccess.com/docs/ads-tutorials-and-help.md): New to ads? Use the Ads Tutorials cards for owners and marketers, the guided tour of the real screens, the glossary of ad words and the ? next to each number.

---

Part of the [CloserAccess admin guide](https://www.closeraccess.com/docs.md). Web version: https://www.closeraccess.com/docs/ads-tracking-codes
