> ## Documentation Index
> Fetch the complete documentation index at: https://clickflare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Kwai as a Traffic Source

> Track Kwai for Business campaigns in ClickFlare: capture the __CALLBACK__ click ID and post conversions to your Kwai pixel.

![Kwai traffic source template](https://mintcdn.com/clickflare/Z7FseNUODe2P_cAH/images/integrations/covers/templates/kwai.png?fit=max\&auto=format\&n=Z7FseNUODe2P_cAH\&q=85\&s=41578308d2ad8c46e40098a1c40f20e5)

Kwai is a short-video social app with a large audience in Brazil and Latin America. Its ad platform, Kwai for Business, runs video ads in the Kwai feed. This guide sets up Kwai as a traffic source in ClickFlare. It covers passing Kwai's click data into your reports and sending conversions back to your Kwai pixel, so Kwai's optimization and your stats agree.

You do everything from the **campaign editor**. The Kwai traffic source is created inline, without leaving the campaign.

The Kwai template sends the click ID for you. Its postback still has two `REPLACE` placeholders and depends on a pixel ID the template doesn't fill. This guide goes through each one.

## At a glance

| | |
| - | - |
| **Ad formats** | Video ads in the Kwai feed |
| **Click ID macro** | `__CALLBACK__`, already in the template |
| **Conversion tracking** | S2S postback to Kwai's pixel event endpoint on `adsnebula.com`, with a pixel access token |
| **Payout passed back** | No. The template's postback sends no value. |
| **Multiple events** | Yes, one postback per Kwai event name |
| **Cost** | Not passed. The template's Cost row is empty. Cost Model: **CPC**. |
| **Conversion API** | No ClickFlare integration. The postback itself is Kwai's server-side pixel API. |

## How it works

**1. Kwai sends the click**

A visitor clicks your ad. Kwai opens your ClickFlare campaign URL and fills in its macros: the click ID in `click_id`, plus the campaign, ad set and creative names.

**2. ClickFlare stores the Kwai click ID**

ClickFlare saves the value of `click_id` as the visit's **External ID** and redirects the visitor to your lander or offer.

**3. The conversion reaches ClickFlare**

Your affiliate network or store posts the conversion back to ClickFlare, matched on the ClickFlare click ID.

**4. ClickFlare posts it back to Kwai**

ClickFlare fires the Kwai postback, replacing `{external_id}` with the stored Kwai click ID. Kwai records the event on your pixel and matches it to the original click.

> [!NOTE]
>
> The mirror to keep straight: in the **campaign URL** you write *ClickFlare's* parameter (`click_id`) and *Kwai's* macro (`__CALLBACK__`). In the **postback URL** you write *Kwai's* parameter (`clickid`, no underscore) and *ClickFlare's* token (`{external_id}`).

## Before you start

* **Set up your own tracking domain.** Run the campaign and the postback on your own custom domain. Shared domains get flagged by networks and blocked by browsers. See [Custom Domains](/docs/en/settings/custom-domains.md).
* **Have an offer ready in ClickFlare**, and its affiliate network set up to post conversions back to ClickFlare. See [Creating an Offer](/docs/en/tracking/creating-an-offer-1.md) and [Adding an Affiliate Network](/docs/en/tracking/adding-an-affiliate-network.md).
* **Create a Kwai pixel in Developer Mode.** In Kwai for Business, click **Assets**, then **Web Events**, then **Set up Web Events**. Name the pixel, choose the **Kwai Pixel** card and **Manually Install Pixel Code**, click **Next**, choose **Developer Mode** and click **Create**. Note the **pixel ID**.
* **Get the pixel's access token.** The postback authenticates with it. You find it in the pixel's settings in Kwai for Business.
* **Decide which conversions Kwai should receive.** Kwai optimizes on the event you choose for the ad set. If your funnel has several steps (lead, then sale), decide now whether to send one event or several. See [Tracking several events](#tracking-several-events).

***

## Step 1 – Create the campaign and the Kwai traffic source

1. Go to **Campaigns** and click **New**.
2. In **Traffic Source**, open the dropdown and click **+ New Traffic Source**.
3. Type `kwai` in the search box and select the **Kwai** template.
4. Enter a **Name**, for example `Kwai`.
5. Set **Cost currency** to the currency your Kwai for Business account is billed in, for example BRL or USD. See [Multicurrency in ClickFlare](/docs/en/tracking/multicurrency-support-in-click-flare-how-it-works.md).

The template fills in the **Parameters** table for you:

| Name | TS Parameter | TS Token (Kwai macro) | ClickFlare Token | What it carries |
| - | - | - | - | - |
| Cost | *(empty)* | *(empty)* | `{cost}` | Nothing. Kwai passes no cost here. See [Cost](#cost). |
| External ID | `click_id` | `__CALLBACK__` | `{external_id}` | Kwai's click ID. Required for the postback. |
| Campaign ID | `CampaignID` | *(empty)* | `{trackingField1}` | Nothing until you add Kwai's campaign ID macro |
| Ad Set ID | `adSETID` | *(empty)* | `{trackingField2}` | Nothing until you add Kwai's ad set ID macro |
| Creative ID | `CreativeID` | *(empty)* | `{trackingField3}` | Nothing until you add Kwai's creative ID macro |
| Campaign Name | `CampaignName` | `__CMPN__` | `{trackingField4}` | The Kwai campaign name |
| Ad Set Name | `adSETName` | `__ADSET__` | `{trackingField5}` | The ad set name |
| Creative Name | `CreativeName` | `__AD__` | `{trackingField6}` | The creative (ad) name |
| Pixel ID | `pixel_id` | *(empty)* | `{trackingField7}` | Your Kwai pixel ID, if you type it in. The postback reads it from here. |

![The Kwai template's Parameters table in ClickFlare, with Kwai's macros pre-filled](https://mintcdn.com/clickflare/uY1opxjcQ55aLJdd/images/integrations/templates/kwai/parameters.png?fit=max\&auto=format\&n=uY1opxjcQ55aLJdd\&q=85\&s=81ccd352b4a3b611c3e7872b3bbcefd0)

Each tracking field becomes a column you can group reports by. The three name rows work as they are, so you can compare campaigns, ad sets and creatives straight away. The three ID rows have no macro and stay empty until you add one.

### The click ID row

The **External ID** row is already filled in: TS Parameter `click_id`, TS Token `__CALLBACK__`. Leave it as it is.

Kwai replaces `__CALLBACK__` with a coded string that identifies the click and carries the information Kwai needs to match the conversion. It can be long. Pass it through unchanged.

### The ID rows

The **Campaign ID**, **Ad Set ID** and **Creative ID** rows have parameters but no Kwai macro. If Kwai offers ID macros in your account's URL parameter settings, enter them as the **TS Token** of each row. If not, remove the three rows, or leave them: they stay empty and do no harm. The name rows already identify each campaign, ad set and creative.

### The Pixel ID row

The template's postback reads the pixel ID from tracking field 7, the `pixel_id` row. That row has no macro, because the pixel ID is not something Kwai fills in per click. You have two ways to deal with it. Option 1 is simpler.

1. **Hard-code it in the postback (recommended).** In Step 2, replace `{trackingField7}` in the postback with your pixel ID. You can then leave the Pixel ID row as it is.
2. **Pass it in the campaign URL.** Enter your pixel ID as the **TS Token** of the Pixel ID row. Kwai doesn't recognize it as a macro and leaves it as it is, so every click arrives with `pixel_id=` your pixel ID, and the postback picks it up. Use this if campaigns on the same traffic source report to different pixels.

## Step 2 – Set up the postback

The postback is what sends conversions to Kwai. It lives on the traffic source, so every campaign that uses this Kwai traffic source sends conversions the same way.

1. In the **New Traffic Source** form, scroll to **Passing conversion info to traffic source**.
2. Turn on **Traffic source postback URL**. The template's postback appears:

```text theme={null}
https://www.adsnebula.com/log/common/gapi?access_token=REPLACE&pixelId={trackingField7}&clickid={external_id}&event_name=REPLACE&mmpcode=PL&pixelSdkVersion=9.9.9&is_attributed=1&testFlag=false&trackFlag=false
```

![The Traffic source postback URL switched on, showing the Kwai template's postback](https://mintcdn.com/clickflare/Z7FseNUODe2P_cAH/images/integrations/templates/kwai/postback.png?fit=max\&auto=format\&n=Z7FseNUODe2P_cAH\&q=85\&s=80b9d308167805e430fc0291a1800bfa)

It already sends the click ID (`{external_id}`) as a ClickFlare token. Replace the rest:

| Placeholder | Replace it with | Where to find it |
| - | - | - |
| `access_token=REPLACE` | Your pixel's access token | The pixel's settings in Kwai for Business |
| `pixelId={trackingField7}` | Your pixel ID, or leave it if you use the Pixel ID row | **Assets → Web Events** in Kwai for Business |
| `event_name=REPLACE` | The Kwai event this postback reports, for example `EVENT_PURCHASE` | Kwai's standard events. Use the exact name, in capitals. |

Leave `mmpcode`, `pixelSdkVersion`, `is_attributed`, `testFlag` and `trackFlag` as they are. The result, for a purchase:

```text theme={null}
https://www.adsnebula.com/log/common/gapi?access_token=YOUR_ACCESS_TOKEN&pixelId=YOUR_PIXEL_ID&clickid={external_id}&event_name=EVENT_PURCHASE&mmpcode=PL&pixelSdkVersion=9.9.9&is_attributed=1&testFlag=false&trackFlag=false
```

3. In the dropdown on the left, choose the ClickFlare event that should fire the postback. Keep **Conversions** to send every conversion. If your final action is a custom conversion (for example `purchase`), choose that instead.
4. Click **Save**. You are back in the campaign editor with the Kwai traffic source selected.

> [!WARNING]
>
> Replace both `REPLACE` placeholders. With `access_token=REPLACE`, Kwai rejects the request. With `event_name=REPLACE`, Kwai doesn't know which event happened. Check **Logs → Postback Status** after your first conversion to confirm what ClickFlare sent.

Common Kwai standard event names:

| Event name | Use it for |
| - | - |
| `EVENT_PURCHASE` | Completed purchase |
| `EVENT_COMPLETE_REGISTRATION` | Sign-up or registration |
| `EVENT_ADD_TO_CART` | Item added to cart |
| `EVENT_INITIATED_CHECKOUT` | Checkout started |
| `EVENT_ADD_PAYMENT_INFO` | Payment details added |
| `EVENT_CONTENT_VIEW` | Product or key page viewed |

Use the event your Kwai ad set optimizes for. The name in the postback must match it exactly.

The template's postback sends no payout, so Kwai sees conversion counts but no revenue. Kwai's value parameter for this endpoint isn't part of the template. Ask your Kwai account manager for it before adding one.

To learn what each postback token does, see [How to Configure a Traffic Source S2S Postback URL](/docs/en/tracking/how-to-configure-a-traffic-source-s2s-postback-url.md).

## Step 3 – Finish the campaign and copy its URL

1. Name the campaign.
2. Set the **Cost Model** to **CPC** and enter your expected cost per click. See [Cost](#cost).
3. Choose **Redirect** or **Direct** tracking. Redirect is the usual choice.
4. Click **Next** and, on **Destination**, add your lander (optional) and your offer.
5. Save, open **Tracking**, select your own tracking domain and copy the **campaign URL**.

The campaign URL now contains the Kwai macros, for example `click_id=__CALLBACK__` and `CampaignName=__CMPN__`.

If you use a lander, its call-to-action must link to the ClickFlare **click URL**, not to the offer directly. Otherwise the visit reaches the offer without a ClickFlare click ID, and the conversion cannot be traced back to Kwai.

See [Creating a Campaign in ClickFlare](/docs/en/campaigns/creating-a-campaign-in-click-flare.md).

## Step 4 – Create the campaign in Kwai for Business

1. In Kwai for Business, create a campaign and an ad set as usual.
2. Choose a conversion objective and select the pixel you created, with the event you send in the postback.
3. Paste the ClickFlare campaign URL into the ad's destination URL field.
4. Submit the ad for review.

Paste the URL exactly as ClickFlare gives it. Kwai replaces each `__...__` macro when the ad is clicked.

## Step 5 – Test the integration

1. Open your campaign URL in a browser and replace `__CALLBACK__` with a test value, for example `click_id=test123`. In ClickFlare, check that the visit's External ID is `test123`.
2. Complete the offer the way a real visitor would. The conversion should appear in ClickFlare against that visit.
3. Go to **Logs → Postback Status** and filter by the campaign. Check the postback to `adsnebula.com`: it should contain your access token, your pixel ID and `clickid=test123`, with no `REPLACE` left.
4. After launch, check your pixel's events in Kwai for Business. Real events only show for real Kwai click IDs. A test value like `test123` reaches Kwai but won't match a click.

***

## Tracking several events

Kwai records each `event_name` as a separate event. Each event needs its own postback:

```text theme={null}
https://www.adsnebula.com/log/common/gapi?access_token=YOUR_ACCESS_TOKEN&pixelId=YOUR_PIXEL_ID&clickid={external_id}&event_name=EVENT_COMPLETE_REGISTRATION&mmpcode=PL&pixelSdkVersion=9.9.9&is_attributed=1&testFlag=false&trackFlag=false
https://www.adsnebula.com/log/common/gapi?access_token=YOUR_ACCESS_TOKEN&pixelId=YOUR_PIXEL_ID&clickid={external_id}&event_name=EVENT_PURCHASE&mmpcode=PL&pixelSdkVersion=9.9.9&is_attributed=1&testFlag=false&trackFlag=false
```

1. In ClickFlare, create a [custom conversion](/docs/en/settings/custom-conversions.md) for each step, for example `lead` and `purchase`.
2. On the Kwai traffic source, click **+ Another postback URL** once per extra event.
3. Map each postback to its ClickFlare event: the `lead` custom conversion to the `EVENT_COMPLETE_REGISTRATION` URL, `purchase` to the `EVENT_PURCHASE` URL.
4. In Kwai for Business, choose which event each ad set optimizes for.

> **Rules for multi-event postbacks**
>
> * One postback per event. Don't combine events in one URL.
> * Use Kwai's standard event names exactly, in capitals.
> * Every postback needs the same access token and pixel ID.
> * The event dropdown offers **Conversions**, **Clicks** and **Visits**, plus your custom conversions. Map each postback to one.

> **Sending only one event**
>
> If Kwai should only learn from your final sale, keep a single postback and map it to that event. Earlier steps (leads, add to carts) still show in ClickFlare. They just don't reach Kwai.
>
> To send a postback only for some conversions, for example only those above a certain payout, use **Event filter** under the postback to add conditions.

## Cost

The template has a **Cost** row, but its parameter and macro are empty, so Kwai passes no cost in the URL. ClickFlare can't read cost from the click.

Set the campaign's **Cost Model** to **CPC** and enter your expected cost per click. If you buy on CPM, a video impression is not a visit, so work out the cost per click: CPM ÷ (1,000 × click-through rate). Check it against your Kwai spend after a few days and adjust.

For exact spend, export the daily cost per campaign from Kwai for Business and import it with a [manual cost upload](/docs/en/settings/manual-cost-upload.md). The Campaign Name column helps you match the rows. See [Cost Models](/docs/en/core-platform-concepts/cost-models.md).

## Delayed revenue

If you run search arbitrage (RSOC or AFD) behind Kwai, the feed reports revenue hours or days after the click. To fire the Kwai postback once that revenue arrives, see [Sending Delayed Revenue to Traffic Sources](/docs/en/advanced-tracking-configuration/how-to-send-delayed-revenue-to-traffic-sources.md). Since the template sends no value, Kwai receives the event, not the amount.

***

## Troubleshooting

> **The postback has clickid= empty**
>
> * The campaign URL was edited, so `click_id=__CALLBACK__` is missing or changed. Copy the campaign URL again from ClickFlare.
> * The ad in Kwai uses an older or hand-typed URL without `click_id=__CALLBACK__`.
> * The External ID row was changed. Its TS Token should be `__CALLBACK__`.
> * The postback uses a Kwai-side placeholder instead of ClickFlare's `{external_id}`.

> **Conversions show in ClickFlare but not in Kwai**
>
> * **Traffic source postback URL** is off on the Kwai traffic source.
> * **Disable sending postbacks to traffic source** is on in the campaign.
> * `access_token` or `event_name` still says `REPLACE`.
> * `pixelId` is empty: the postback still uses `{trackingField7}` and the Pixel ID row has no value.
> * The event name doesn't match the event the Kwai ad set optimizes for.
> * Check **Logs → Postback Status**: a failed request shows the status code Kwai returned.

> **Kwai shows conversions with no value**
>
> Expected. The template's postback sends no payout. ClickFlare still records the revenue in your reports.

> **Campaign ID, Ad Set ID or Creative ID columns are empty**
>
> Expected. Those rows have no Kwai macro in the template. Use the name columns, or add the ID macros if your Kwai account offers them. If the name columns are empty too, the URL was edited or pasted somewhere Kwai doesn't process macros. See [Traffic Source Tokens Arriving Empty](/docs/en/troubleshooting/tokens-arriving-empty.md).

For the general checklist, see [Conversions not showing](/docs/en/troubleshooting/conversions-not-showing.md).

***

**FREQUENTLY ASKED QUESTIONS**

> **Q1:** Can I use the same Kwai traffic source for all my Kwai campaigns?

**A1:** Yes, as long as they report to the same pixel. The postback is set once on the traffic source. If campaigns use different pixels, either create one traffic source per pixel, or use the Pixel ID row to pass each campaign's pixel ID in its URL.

> **Q2:** Why is it `click_id` in the campaign URL and `clickid` in the postback?

**A2:** They are two halves of the same value. ClickFlare reads Kwai's click ID from its own `click_id` parameter. Kwai expects it back in its own `clickid` parameter. Change neither.

> **Q3:** Do I still need the Kwai pixel code on my site?

**A3:** Not for the postback. It sends each event to your pixel server to server, so it works on offers whose pages you don't control. You need the Developer Mode pixel for its ID and access token.

> **Q4:** Should I use Redirect or Direct tracking with Kwai?

**A4:** Redirect is the usual choice. Use Direct only if Kwai must see your lander's domain as the destination. See [Direct Campaign Tracking](/docs/en/campaigns/direct-campaign-tracking.md).

> **Q5:** Is my access token safe in the postback?

**A5:** The postback is stored on your traffic source and sent from ClickFlare's servers to Kwai. It never appears in your ad or campaign URL. Treat it like a password anyway: don't share screenshots of the postback.

## Related

> **[Traffic source postbacks](/docs/en/tracking/how-to-configure-a-traffic-source-s2s-postback-url.md)**
>
> Every token you can use in a postback.

> **[Custom conversions](/docs/en/settings/custom-conversions.md)**
>
> Split leads and sales into separate events.

> **[Cost models](/docs/en/core-platform-concepts/cost-models.md)**
>
> How CPC, CPA and RevShare costs are calculated.

> **[Conversions not showing](/docs/en/troubleshooting/conversions-not-showing.md)**
>
> The general checklist when postbacks don't arrive.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.