SCALIX help

← All tools

lads_create_conversion_rule

LinkedIn Ads write high risk

Part of the Conversion Tracking Agent.

What it does

Create a LinkedIn conversion rule (POST /rest/conversions) so conversions can be attributed to ads. TWO modes: OMIT conversion_method to create an Insight Tag / pixel rule (works with rw_ads); set conversion_method=CONVERSIONS_API for server/offline event STREAMING (Conversions API / CAPI), which needs the separately-approved rw_conversions scope. Body: account (sponsoredAccount URN), name, type (LEAD, QUALIFIED_LEAD, PURCHASE, SIGN_UP, DOWNLOAD, ADD_TO_CART, KEY_PAGE_VIEW, SUBMIT_APPLICATION, etc.), and attribution settings: postClickAttributionWindowSize (1/7/30/90; 365 ONLY for SUBMIT_APPLICATION/PURCHASE/ADD_TO_CART/QUALIFIED_LEAD/LEAD), viewThroughAttributionWindowSize (same allowed values; default 7), attributionType (LAST_TOUCH_BY_CAMPAIGN default | LAST_TOUCH_BY_CONVERSION), valueType (DYNAMIC/FIXED/NO_VALUE), enabled. Optional autoAssociationType (ALL_CAMPAIGNS auto-associates up to 200 ACTIVE campaigns | OBJECTIVE_BASED). Preview->approve->execute->log: show name, type, windows, and campaign association; on approval, create. Returns id (x-restli-id); a CONVERSIONS_API rule's id is used to send events as urn:lla:llaPartnerConversion:{id}. Requires a non-VIEWER role on the account (and rw_conversions when conversion_method=CONVERSIONS_API). QUALIFIED_LEAD rules also feed qualifiedLeads/costPerQualifiedLead reporting metrics and can be a Lead-Gen optimization target. 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 set up offline/server-side conversion tracking (CRM-won deals, qualified leads, purchases) before streaming events. Confirm type and attribution windows with the user, then create. Do NOT create rules in an account the bearer isn't scoped to.

Inputs

NameTypeRequiredDescription
accountstringyesSponsored account; normalize to urn:li:sponsoredAccount:{id}. Within bearer scope.
namestringyesRule name shown in Campaign Manager + reports. Trim.
typestringyesConversion behavior — enum-normalize to one of these supported LinkedIn types: LEAD, QUALIFIED_LEAD, PURCHASE, SIGN_UP, DOWNLOAD, ADD_TO_CART, KEY_PAGE_VIEW, SUBMIT_APPLICATION, START_CHECKOUT, SUBSCRIBE, INSTALL, OTHER. Use KEY_PAGE_VIEW for a page view; 'LANDING_PAGE' is NOT a valid type (422).
conversion_methodenum(CONVERSIONS_API)noOMIT (default) for an Insight Tag / pixel rule (creates with rw_ads). Set CONVERSIONS_API only for server/offline event STREAMING — that needs the separately-approved rw_conversions scope, else a 400 'Conversion permissions are needed for this type of Conversion'.
post_click_window_daysintegernoAllowed 1/7/30/90 (365 ONLY for SUBMIT_APPLICATION/PURCHASE/ADD_TO_CART/QUALIFIED_LEAD/LEAD). Default 30.
view_through_window_daysintegernoAllowed 1/7/30/90 (365 limited to the same types). Default 7.
attribution_typestringnoLAST_TOUCH_BY_CAMPAIGN (default) | LAST_TOUCH_BY_CONVERSION.
value_typestringnoDYNAMIC (default; use per-event value) | FIXED (rule value) | NO_VALUE.
enabledbooleannoDefault true; only enabled rules match conversions.
auto_association_typestringnoALL_CAMPAIGNS (auto-associates up to 200 ACTIVE campaigns) | OBJECTIVE_BASED; omit to associate none. Sent as the autoAssociationType QUERY param, not a body field.
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: only configure tracking for the authorizing client's account; events must carry hashed PII with member consent and minimal fields. The authenticated user must hold a non-VIEWER role on the ad account.

Reminder

Configure conversion tracking only for the authorizing client; events must carry hashed PII with consent and minimal fields.

Errors

Error classMeansWhat to doRetry
PERMISSION_DENIEDUser has VIEWER-only role or rw_conversions scope not granted (403).Ensure a non-VIEWER role. rw_conversions needs LinkedIn to approve the Scalix app for the Conversions API program; reconnecting does not add it. Omit conversion_method for an Insight Tag rule.no
INVALID_ARGUMENTInvalid type, disallowed attribution window for the type (e.g. 365 on a non-eligible type), or bad enum (400) — surface message.Pick an allowed window for the type (365 only for SUBMIT_APPLICATION/PURCHASE/ADD_TO_CART/QUALIFIED_LEAD/LEAD); fix enum; do not guess.no
TOKEN_REVOKEDToken expired/revoked (401).Refresh and retry once; else re-auth.yes
RESOURCE_EXHAUSTEDRate limit (429).Backoff 5/10/20s cap 60s; respect Retry-After.yes
PLATFORM_ERRORLinkedIn 5xx.Retry with backoff.yes

Edge cases

  • 365-day window requested for a non-eligible type -> 400; restrict to the 5 eligible types or pick 90.
  • autoAssociationType=ALL_CAMPAIGNS caps at 200 ACTIVE campaigns — warn if the account has more.
  • valueType=DYNAMIC requires events to carry conversionValue; FIXED uses the rule's value; NO_VALUE ignores event value.
  • QUALIFIED_LEAD rule also drives qualifiedLeads/costPerQualifiedLead metrics and can be an optimization target.
  • Idempotency: re-creating the same-named rule makes a duplicate — list existing rules first.
  • enabled:false rule is created but won't match events until enabled.
  • conversion_method=CONVERSIONS_API is refused at preview (access_gated) while Scalix does not request rw_conversions (SCALIX_LINKEDIN_EXTRA_SCOPES): omit conversion_method for an Insight Tag rule.