Conversions overview

The concept page Server-side conversions explains what 3x does. This section explains how to set it up and operate it.

Setup in four steps

  1. Destinations – one per platform, with credentials, mode and transport: Meta, LinkedIn, Google Ads, TikTok.
  2. Definitions – what counts as a conversion and how it maps to each platform (Definitions).
  3. Recording – automatically from events, goals or leads, or explicitly from your server, the MCP server or the dashboard.
  4. Test – dry_run → test → live (Test modes).

Destinations

GET /v1/projects/{project}/destinations lists the four providers; PUT …/destinations/{provider} updates one (scope project:admin):

{
  "enabled": true,
  "mode": "test",
  "transport": "direct",
  "settings": { "pixelId": "1234567890123456", "apiVersion": "v26.0", "testEventCode": "TEST12345" },
  "secrets": { "accessToken": "EAAB…" }
}
FieldValues
modelive (send for real), test (platform test endpoints/validate-only), dry_run (build payloads, log a PII-free summary, send nothing)
transportdirect (3x calls the platform API, default), composio (through the project's Composio ad connection), feed (Google Ads CSV feed only)
secretsstored encrypted (AES-256-GCM); responses only contain secretsSet and masked secretsHint. Send null to remove a secret

POST …/destinations/{provider}/test sends a synthetic test event in test mode and reports the platform's answer.

Choosing what a moment is reported as

You never have to look up rule numbers. GET …/destinations/{provider}/targets (scope project:admin, MCP conversions_targets_list) reads, through the project's ad connection, what a moment can be reported as:

ProviderkindTargetsCreate
LinkedInrulesconversion rules of the ad account (name, type, number)yes – rule with method Conversions API
Google Adsactionsoffline conversion actions (Import → clicks)yes – action type UPLOAD_CLICKS
Metaeventsstandard events Lead, Schedule, Purchase, … (plus the pixels of the connected ad accounts in accounts)not needed
TikTokeventsstandard events SubmitForm, Contact, CompletePayment, …not needed

The answer never fails on a platform problem; problem.code says what is wrong and the dashboard wizard explains it: not_connected (connect the ad account first), expired (reconnect), approval_pending (LinkedIn still reviews your app for the Advertising/Conversions API – the sign-in was refused for its scopes), missing_scope (the connection may not manage conversions – choose or enter a rule by hand), no_account (assign an ad account to the project), rate_limited, upstream.

POST …/destinations/{provider}/targets with {"moment": "lead"} (MCP conversions_target_create) creates „X3 · Neuer Lead“ (or name) at LinkedIn or Google Ads. It is idempotent by name, audited (destination.target_create) and never touches campaigns, budgets or ads. A refusal for missing permissions answers connector_permission_denied.

The deployment caps every destination: X3_CONVERSIONS_MODE (dry_run by default outside X3_ENV=production) and the kill switch X3_CONVERSIONS_DISABLED=1.

Composio transport

ProviderThrough ComposioNotes
MetaMETAADS_SEND_CONVERSION_EVENTSneeds a Meta connection whose token can access the pixel
Google AdsuploadClickConversions via the Composio proxyuses the Google connection; loginCustomerId for MCC access
LinkedIn/rest/conversionEvents via the Composio proxyneeds rw_conversions on the LinkedIn auth config
TikTok–direct only

A provider is either direct or Composio, never both. Select the connection with adConnectionId.

Recording from your server

import { createX3Server, requestContext } from "@x3growth/sdk/server";

const x3 = createX3Server({ apiUrl: process.env.X3_API_URL!, apiKey: process.env.X3_SECRET_KEY! });

await x3.conversions.create({
  definition: "demo_booked",
  sessionId,                 // from getIds() in the browser, sent with your form
  eventId: `booking:${bookingId}`,
  email, phone, firstName, lastName,
  value: 500, currency: "EUR",
  ...requestContext(request), // IP, user agent, _fbp/_fbc/_ttp (after consent)
});

See Server helper for request context (IP, user agent, _fbp/_fbc) and the combined leads.create({ conversion }) call.

WhatsApp contacts with a reference code

With whatsappRef on, the heat plugin appends a short code to the prefilled WhatsApp text („… Ref K7Q2“) and stores it with the visit. When you record that contact later, pass the code as waRef to POST /v1/projects/{project}/leads or POST /v1/projects/{project}/conversions (MCP conversions_mark: wa_ref) instead of a sessionId. The value may be the code, „REF: k7q2“ or the whole pasted message; case does not matter, and 0/O/1/I (never part of a code) are read as the letters they are mistaken for. The lead is then linked to exactly that visit (traits.evidence = ref_code): its attribution, click ids and test flag count, as for any lead with a session.

  • GET /v1/projects/{project}/wa-refs/{code} shows the visit first (startedAt, entryPage, campaign, isTest, sessionExists, leadId of a lead that already holds the code).
  • An unknown code, a code of another project and a visit that no longer exists answer not_found.
  • A code that already belongs to another lead answers conflict with that leadId; send waRefOverride: true to link it anyway.

Enhanced match parameters

Every upload carries as many match keys as 3x knows – from the converting request and from the customer journey the conversion belongs to:

  • Click ids from any session of the journey: per click-id type (gclid, gbraid, wbraid, fbclid, li_fat_id, ttclid) the click closest before the conversion (latest click at or before the conversion time + 5 minutes) within 90 days, even when the converting visit came without a click id. The conversion's own session wins when it has one. Meta's fbc is built from the first sighting of that fbclid (fb.1.<first click ms>.<fbclid>) unless the browser sent an _fbc cookie.
  • external_id = SHA-256 of the journey id (stable for the person; Meta external_id, TikTok external_id).
  • Identity from the journey's leads (non-spam): hashed e-mail, phone (Meta: digits; Google, TikTok: E.164 with +), first and last name, city, state, postal code and country – normalized per provider. leads.create accepts city, state, zip and country; they are stored as hashes (the postal code in plaintext only with settings.pii.storePlaintext, which Google's addressInfo needs).
  • Consented ad cookies _fbp/_ttp remembered for the journey (90 days), so a conversion recorded later from your server (for example a confirmed WhatsApp lead) still carries them.
  • Request context (IP, user agent) of the converting request – deleted after upload, at the latest after 7 days.

Nothing new is stored on the visitor's device for this without consent; see Consent and CMPs.

Match quality

For every upload 3x records which parameters it sent (uploads.<provider>.match, for example ["em", "ph", "fbc", "fbp", "external_id", "client_ip_address", "client_user_agent"]) and whether a click id or identity came from another session of the journey (uploads.<provider>.journey). The dashboard shows them per conversion (fbc ✓ fbp ✓ em ✓ ph – external_id ✓) with an estimated match quality (0–10, modelled on Meta's Event Match Quality – the platforms compute the real value) and aggregates the coverage per destination:

GET /v1/projects/{project}/analytics/match-quality?days=30     (scope conversions:read)

returns per provider the conversions with a recorded match, how many carried each parameter, the share, the average estimated score, the grades (high, medium, low, none) and how many used journey data. MCP: conversions_match_quality.

Watching the pipeline

  • Dashboard → Conversions: last conversions with per-platform status, retry button, filters.
  • GET /v1/projects/{project}/conversions?provider=meta&provider_status=failed (scope conversions:read).
  • MCP conversions_list, conversions_mark, conversions_retry, conversions_update_status, conversions_definitions_list.
  • Troubleshooting lists every status and error with its fix.