Skip to content
TikTokFanvue API

Fanvue TikTok Pixel and Events API tracking

Connect Fanvue to TikTok Events API so every subscription, renewal, PPV purchase and tip fires back to your ad account server-side, matched with the ttclid captured on your tracking link.

Start for freeLast updated March 2024

What you get

Fanvue TikTok Events API tracking through Fanvue API sends the events that matter for a Fanvue business - subscriptions, renewals, PPV purchases and tips - straight to TikTok's servers, so your campaigns optimise on real revenue instead of clicks alone.

  • Server-side CompletePayment, Subscribe and SubmitForm events sent directly to the Events API on your behalf
  • Automatic deduplication against the browser pixel using a shared event_id
  • ttclid passthrough and hashed email or phone for accurate attribution and matching
  • Custom events for tips, PPV and renewals so TikTok can tell revenue types apart

How does Fanvue TikTok Events API tracking work?

The pipeline is the same one used across every ad platform Fanvue API supports, specialised for TikTok's identifiers and event names.

  1. 01

    Ad click

    ttclid captured

    TikTok appends ttclid to the destination URL when a fan clicks your ad.

  2. 02

    Tracking link

    _ttp / ttclid saved

    Your Fanvue tracking link stores ttclid alongside TikTok's _ttp cookie.

  3. 03

    Fanvue conversion

    subscribe, tip, PPV

    The fan subscribes, tips or buys a PPV message on Fanvue.

  4. 04

    Fanvue API

    hash, dedupe, sign

    Fanvue API hashes the fan's email, attaches event_id and calls the Events API.

  5. 05

    TikTok Ads Manager

    CompletePayment, Subscribe

    The event appears in Events Manager and feeds TikTok's optimisation within minutes.

Before you start

Gather these five things before you open the Fanvue API dashboard:

  • A TikTok Ads account with access to Events Manager
  • A pixel code from TikTok Events Manager
  • An Events API access token generated for that pixel
  • A Fanvue tracking link for the creator you are advertising
  • A Fanvue API key from your dashboard's API Keys page

Step-by-step setup

01Create a pixel in TikTok Events Manager

In Events Manager, choose Web Events and create a pixel. Name it after the creator or agency so it is easy to find later.

ads.tiktok.com · Events Manager

Web events

Fanvue Creator Pixel · C4XXXXXXXXXXXXX

02Generate an Events API access token

Open the Generate Access Token page for your pixel and create a token. Never share this token outside Fanvue API's dashboard.

ads.tiktok.com · Events API settings
tta_xxxxxxxxxxxxxEvents API

03Connect the pixel and token in Fanvue API

Open Ads Tracking in the Fanvue API dashboard, choose TikTok, and paste in the pixel code and access token. Fanvue API validates the token immediately.

dashboard.apifanvue.com · Ads Tracking
TikTok connection

Pixel code

C4XXXXXXXXXXXXX

Status

Connected

04Add your Fanvue tracking link to every ad

Use your Fanvue tracking link as the destination URL on every ad group. It captures ttclid on click and forwards the fan to Fanvue.

TikTok Ads Manager · Destination URL

https://track.apifanvue.com/l/xyz?ttclid={{ttclid}}

05Map Fanvue events to TikTok events

Review the default event mapping in the dashboard and adjust it if your funnel treats free follows or tips differently.

dashboard.apifanvue.com · Event mapping
  • subscription.created → Subscribe
  • transaction.ppv → CompletePayment

06Send a test event

Copy the test_event_code from the Test Events tool, paste it into the Fanvue API dashboard, and trigger a test event to confirm the connection end to end.

ads.tiktok.com · Test Events
CompletePayment · TEST12345Received

Capture the click ID

TikTok appends ttclid to your ad's destination URL. Fanvue API's tracking-link script reads it on landing and stores it in a first-party cookie for 90 days, alongside TikTok's own _ttp cookie, so the identifier survives even if the fan does not convert on the first visit.

capture-ttclid.jsjs
// capture-ttclid.js - run once on the tracking-link landing page
(function () {
  var params = new URLSearchParams(window.location.search);
  var ttclid = params.get("ttclid");
  if (!ttclid) return;

  var expires = new Date(Date.now() + 90 * 24 * 60 * 60 * 1000).toUTCString();
  document.cookie = "fanvue_ttclid=" + ttclid + "; expires=" + expires + "; path=/; SameSite=Lax";
})();

Event mapping

Required and recommended parameters per event, for the TikTok column of Fanvue API's event mapping.

Fanvue eventTikTok eventParametersNotes
Tracking link clickClickButtoncontext.page.url, ttclidOptional, adds browser-side signal
Free follow / signupSubmitFormemail (hashed), ttclidSend as soon as the fan follows for free
New subscriptionSubscribevalue, currency, email (hashed), ttclidRequired for TikTok's Subscribe optimisation
RenewalCompletePaymentvalue, currency, email (hashed)Same event_id family as the original subscription
PPV message purchaseCompletePaymentvalue, currency, content_idTag content_type as ppv in properties
TipCompletePaymentvalue, currency, content_idTag content_type as tip in properties

Full payload example

The Fanvue API endpoint below wraps the TikTok Events API call POST https://business-api.tiktok.com/open_api/v1.3/event/track/ so you send one request to Fanvue API and it handles hashing, retries and the Events API call for you.

tiktok-events.shbash
curl -X POST https://api.apifanvue.com/v1/ads/tiktok/events \
  -H "Authorization: Bearer sk_live_..." \
  -H "Content-Type: application/json" \
  -d '{
    "pixel_code": "C4XXXXXXXXXXXXX",
    "event": "CompletePayment",
    "event_id": "fanvue_sub_abc123",
    "event_source": "web",
    "event_source_id": "C4XXXXXXXXXXXXX",
    "context": {
      "user": { "email": "<sha256(email)>" },
      "ad": { "callback": "<ttclid>" }
    },
    "properties": { "currency": "USD", "value": 9.99, "content_id": "fanvue:creator_xyz" }
  }'

Deduplication

If you also run the browser TikTok Pixel on your Fanvue landing page, TikTok will see two events for the same conversion: one from the pixel, one from the Events API. Fanvue API prevents double counting by generating one event_id per conversion (for example fanvue_sub_abc123) and attaching the same event_id to both calls. TikTok then treats them as a single event for reporting and optimisation, keeping the browser event only for the extra signal it adds.

Matching and privacy

Fanvue API never sends raw personal data to TikTok. Email addresses and phone numbers are trimmed, lowercased and hashed with SHA-256 before they leave Fanvue API's infrastructure. Only the hashed value plus ttclid is included in the context and user objects.

Consent is respected end to end. If a fan has not granted ad-personalisation consent under IAB TCF v2.2 or Google Consent Mode v2, Fanvue API withholds the event or strips identifying fields depending on the flag, so you stay compliant without extra integration work.

Test and verify

Open the Test Events tool in TikTok Events Manager, copy the test_event_code shown there, and paste it into the Fanvue API dashboard's TikTok connection settings. Trigger a test subscription or fire a manual test event from the dashboard. A good result shows the event listed in Test Events within a few seconds, with CompletePayment or Subscribe, value, currency and a hashed email field all populated, and no warnings about missing parameters.

Troubleshooting

SymptomCauseFix
Events rejected with an invalid pixel_code errorWrong pixel code or pixel not yet approvedCopy pixel_code exactly from TikTok Events Manager and confirm the pixel is active
Events show as duplicated in Events ManagerBrowser pixel and Events API call use different event_id valuesGenerate one event_id per conversion and pass it to both the browser pixel and the Events API call
Test events do not appear in Test Events tooltest_event_code missing or expiredCopy a fresh test_event_code from the Test Events tab and include it on the event payload
Low match rate reported in Events ManagerMissing hashed email or ttclid on the eventSend hashed email or phone plus ttclid on every event where they are available
ttclid present but conversions are not attributedTracking link is not storing ttclid before the fan lands on FanvueConfirm the Fanvue API tracking-link script runs before any redirect and writes the ttclid cookie
CompletePayment value looks wrong in reportingCurrency or value left out of propertiesAlways send both value and currency for every CompletePayment event, including renewals
Events accepted but never influence deliveryevent_source_id does not match the connected pixel codeMake sure event_source_id in the Fanvue API dashboard matches the pixel_code used in the Events API call

TikTok tracking FAQ

Ready to build on Fanvue?

Get API keys, docs and MCP access in one click. Free trial, no credit card.