SCALIX help

← All tools

lads_send_conversion_event

LinkedIn Ads write high risk

Part of the Conversion Tracking Agent.

What it does

Stream an offline/server conversion event to a CAPI rule. POST /rest/conversionEvents with conversion=urn:lla:llaPartnerConversion:{id}, conversionHappenedAt (epoch MILLISECONDS, MUST be within the past 90 days), optional conversionValue {currencyCode, amount(decimal string)}, optional eventId (for dedup), and user{userIds:[{idType,idValue}], userInfo?, lead?, externalIds?}. idType: SHA256_EMAIL (email lowercased+whitespace-stripped then SHA-256 HEX, 64 chars), LINKEDIN_FIRST_PARTY_ADS_TRACKING_UUID (li_fat_id click ID), PLAINTEXT_IP_ADDRESS (IPv4; LinkedIn salts+hashes), SHA256_IP_ADDRESS (64 hex), ACXIOM_ID, GOOGLE_AID. At least one userId is required UNLESS userInfo/lead/externalIds is provided, in which case userIds goes as an empty list [] (Scalix sends [] when it is omitted). At preview Scalix refuses a plain email address, a hash of the wrong length, a non-IPv4 PLAINTEXT_IP_ADDRESS, an unknown idType, userInfo with only one name, a user with no identifier, an event older than 90 days or in seconds, and a conversion that is not a rule id or urn:lla:llaPartnerConversion URN; then, without rw_conversions, it refuses the send. userInfo lifts match rate but requires BOTH firstName+lastName. Batch many events with X-RestLi-Method: BATCH_CREATE and a body of {"elements":[ ... ]} (each element carries its own conversion URN), up to 5,000 events per batch. Batches are ALL-OR-NOTHING: a single invalid element fails the entire batch with HTTP 400 — there are no per-row successes. Preview->approve->execute->log: confirm the rule, hashing, and consent, then send; write the immutable audit entry. Use eventId for idempotent retries/dedup. Requires rw_conversions and a non-VIEWER role. Two-phase (parity with Google, ADR-028/029): the first call (no preview_id) builds the request locally and returns a preview_id — nothing is sent to LinkedIn; re-call with that preview_id and identical arguments to COMMIT (single-use, 30-min; a changed/forged/replayed token fails closed).

When to use it

Use to report a real offline/server conversion (CRM-won deal, qualified lead, purchase) so LinkedIn can attribute it. Confirm consent and that identifiers are hashed, then send with an eventId for dedup. Do NOT send unhashed PII, fabricated events, or events older than 90 days.

Inputs

NameTypeRequiredDescription
conversionstringyesConversion rule URN urn:lla:llaPartnerConversion:{id}, or the bare rule id (sent as that URN). In BATCH_CREATE each element in elements[] carries its own conversion URN.
conversion_happened_atintegeryesEpoch MILLISECONDS (append 000 if source is seconds). MUST be within the last 90 days; an older one, or one in seconds, is refused at preview.
userobjectyes{userIds:[{idType,idValue}], userInfo?{firstName,lastName,companyName?,title?,countryCode?}, lead?(urn:li:leadGenFormResponse:{id}), externalIds?}. Emails MUST be lowercased+trimmed then SHA-256 HEX before send. If providing only userInfo/lead/externalIds, userIds goes as an empty list [] (sent as [] when omitted); userInfo needs both firstName and lastName.
conversion_valueobjectno{currencyCode (ISO e.g. USD), amount (decimal STRING e.g. '50.0')}. Used only if rule valueType=DYNAMIC; ignored by NO_VALUE; FIXED uses the rule value.
event_idstringnoAdvertiser-generated unique id for deduplication; reuse the SAME value on retry for idempotency.
elementsarraynoFor batched sends only: array of conversion-event objects (each with its own conversion URN, conversionHappenedAt, user, optional conversionValue/eventId). Max 5,000 per batch. Posted as body {"elements":[ ... ]} with X-RestLi-Method: BATCH_CREATE. All-or-nothing: any invalid element fails the whole batch.
preview_idstringnoOmit it to preview: nothing is applied, and the call returns a preview_id bound to this exact request. Pass it only after the user approves that preview in a later message, with the same arguments (leave out validate_only, and add any confirmation flag the preview names). Single-use, expires in 30 minutes; changed arguments need a fresh preview.

Safeguards

A change in two steps. The first call previews and changes nothing; Claude shows you the preview and applies it only after you approve, within 30 minutes and with the same arguments. Every applied change goes to the audit log. How changes are approved.

Policy

Conversions API: hash all PII (SHA-256 HEX of normalized email) before sending; obtain member consent for offline matching; send minimal fields; never retain or reuse the raw identifiers; never fabricate events. Event timestamp must be within 90 days. The authenticated user must hold a non-VIEWER role.

Reminder

Hash PII, send minimal consented data only for the authorizing client, and never log raw identifiers; member-derived data is purged per retention policy.

Errors

Error classMeansWhat to doRetry
INVALID_ARGUMENTBad conversion URN, timestamp not in ms or older than 90 days, no valid identifier, userIds non-empty-but-invalid, or unhashed email (400) — surface message.Fix to urn:lla:llaPartnerConversion:{id}, ms timestamp within 90 days, and at least one valid hashed identifier (or [] userIds with userInfo/lead/externalIds); do not guess.no
CONVERSION_BATCH_VALIDATION_ERRORBATCH_CREATE is all-or-nothing: a single invalid element fails the ENTIRE batch with HTTP 400; the error body carries a batchIndex pointing at the offending element (no per-row success results).Read batchIndex, correct that element, and RESUBMIT the whole {"elements":[ ... ]} payload (reuse each element's eventId to avoid double-counting); do not assume any element was accepted.no
PERMISSION_DENIEDVIEWER role or missing rw_conversions / no access to the rule's account (403).Ensure a non-VIEWER role and approved CAPI scope; re-auth if scope missing (needs_reauth).no
RESOURCE_EXHAUSTEDRate limit (429).Backoff 5/10/20s cap 60s; batch events (<=5,000); respect Retry-After.yes
TOKEN_REVOKEDToken expired/revoked (401).Refresh and retry once (reuse eventId); else re-auth.yes
PLATFORM_ERRORLinkedIn 5xx.Retry with backoff reusing eventId for idempotency.yes

Edge cases

  • Timestamp in seconds -> multiply to ms (append 000); events >90 days old are rejected.
  • No valid userId but userInfo/lead/externalIds provided -> userIds MUST be an empty list [] or 400; Scalix sends [] when userIds is omitted.
  • externalIds list max size 1 — only the first value is used.
  • BATCH_CREATE is all-or-nothing: one bad element fails the whole batch (HTTP 400 with batchIndex); fix that element and resubmit the entire {"elements":[ ... ]} payload.
  • Max 5,000 events per batch — split larger sets.
  • Retry without reusing eventId risks double-counting; always reuse eventId on retry.
  • PLAINTEXT_IP_ADDRESS only supports IPv4; LinkedIn salts+hashes server-side.
  • userInfo improves match but requires BOTH firstName and lastName, else invalid.
  • valueType=NO_VALUE rule ignores conversionValue; FIXED uses the rule value not the event's.