# Add a TikTok pixel to a form

> Track visits and purchases from your TikTok ads by adding your TikTok Pixel ID and Events API token to a form.
>
> Source: https://docs.bcl.my/tiktok-pixel/

A TikTok pixel tells TikTok which people from your ads opened your form and paid. You add it to each form in BCL. You can also add an Events API token so purchases still reach TikTok when the browser blocks the pixel.

These are the events BCL sends to TikTok:

| Event | When |
| --- | --- |
| **Pageview** and **ViewContent** | The customer opens the form. |
| **InitiateCheckout** | The customer clicks the pay button. On a lead form this is **SubmitForm**. |
| **CompletePayment** | The payment succeeds and the receipt page opens, or BCL's server sends it (Events API). |

## Copy your Pixel ID

Get the ID from TikTok first:

1. Open [TikTok Ads Manager](https://ads.tiktok.com/) and go to **Tools** → **Events Manager**.
2. Choose your web pixel and copy its ID. It is a string of about 20 letters and numbers, for example C4XXXXXXXXXXXXXXXXXX.

## Add the pixel to your form

The same **TikTok Pixel** tab is on payment, event and booking forms (open the form, then **Advanced**).

1. Go to **Payments** → **Forms** and click **Edit** on the form.

   *(Screenshot: The Payment Forms list with the Edit button on a form highlighted)*

2. Click **Advanced**.

   *(Screenshot: The Edit Payment Form page with Advanced highlighted)*

3. Open the **TikTok Pixel** tab and turn on **Enable TikTok Pixel**.
4. Paste your ID into **TikTok Pixel ID**.

   *(Screenshot: The TikTok Pixel tab with Enable TikTok Pixel and the TikTok Pixel ID field highlighted)*

5. Click **Save Advanced Settings**.

   *(Screenshot: The Save Advanced Settings button highlighted)*

## Add the Events API token

The Events API sends the CompletePayment event from BCL's server. So TikTok counts the event even when the customer's browser blocks the pixel. BCL sends the event once per order: from the customer's browser or from the server, whichever comes first.

1. In TikTok Events Manager, open your pixel's **Settings** and click **Generate Access Token**. Copy the token.
2. Back in BCL, on the form's **TikTok Pixel** tab, turn on **Enable TikTok Events API**.
3. Paste the token into **TikTok Events API Token**.

   *(Screenshot: Enable TikTok Events API turned on, with the TikTok Events API Token field highlighted)*

4. Click **Save Advanced Settings**.

> **Tip**
> To check your setup, copy the test event code from TikTok's **Test Events** tab into **TikTok TEST_CODE**. Clear it (the **x** button next to the field) after your test.

## Count COD and bank transfer orders

COD and manual bank transfer orders stay pending until you confirm payment. So by default, TikTok gets them only when you mark them paid. To count them when the order is placed, turn on **Trigger Purchase Event on Pending** on the same tab. Then click **Save Advanced Settings**. Other payment methods always send the purchase when the payment succeeds.

*(Screenshot: The Trigger Purchase Event on Pending switch highlighted)*

BCL sends one CompletePayment per order. So when you approve a COD order after delivery, TikTok never counts the order twice. With the switch off, TikTok gets the order only when you approve it, and only through the Events API. See [COD orders in your dashboard and ad tracking](/cod-manual-transfer/#cod-orders-in-your-dashboard-and-ad-tracking).

> **Tip**
> **Events Manager is not real time: check Marketing Logs first.** A row on the **TikTok** tab of **Tools** → **Marketing Logs** means that BCL sent the purchase. The row is there even if TikTok has not shown the purchase yet.

## Tips

A few things help your TikTok numbers match BCL:

- **Check each purchase in Marketing Pixel Logs.** Go to **Tools** → **Marketing Logs** and open the **TikTok** tab. The tab shows every CompletePayment that BCL sent. See [Marketing Pixel Logs](/marketing-pixel-logs/).
- **Lead forms have their own tab.** On a lead form, the pixel is under **Additional** → **Tracking Pixels**. A lead form has no Events API token.
- **Add the pixel to every form you advertise.** You set the pixel on each form. So a form without the pixel sends nothing to TikTok, even if another form has it.

## Common issues

### Where do I put my TikTok pixel in BCL?

On each form, not on your account. Open the form, click Advanced, then open the TikTok Pixel tab.

### Why does TikTok show fewer purchases than BCL?

Ad blockers and some in-app browsers stop the pixel. Turn on Enable TikTok Events API and add your token so BCL can also send the purchase from its server.

### My COD orders never show as purchases in TikTok. Why?

COD and manual bank transfer orders stay pending until you mark them paid. Turn on Trigger Purchase Event on Pending to send the purchase when the order is placed.
