Zernio
APIFor you
Zernio
APIFor you
Platforms

LinkedIn Ads

Overview

Build

Create adsBoost a postLead Gen FormsCreative formats

Target

TargetingMatched AudiencesBid pricing & forecasts

Measure

AnalyticsConversions APIInsight TagURL tracking tags

Operate

Manage adsAd Library

Reference

Media & limits
Dashboard
OverviewPlatformsAPI ReferenceResources
LinkedIn Ads

Insight Tag

Read, create and share a LinkedIn Insight Tag, manage its conversion rules, check when it last fired, and install it on Shopify or WordPress.


The LinkedIn Insight Tag is the site tag behind LinkedIn website conversions and retargeting.

Read the tag

Zernio exposes it under the platform-neutral tracking tags API on your linkedinads connection.

With it you can:

  • Read or create an ad account's tag
  • Turn first-party tracking on or off
  • Manage the conversion rules a page fires
  • Share the tag with other ad accounts
  • Install it on a connected Shopify store or WordPress site

This page covers the site tag. A campaign's Dynamic UTM parameters are on URL tracking tags.

GET /v1/accounts/{accountId}/tracking-tags lists one tag per active ad account on the connection.

GET .../tracking-tags/{tagId} adds:

  • the base code
  • lastFiredTime, the latest callback across the tag's domains (null when it never fired)
  • installed
  • the ad account's conversion rules as events

To create a tag, call POST /v1/accounts/{accountId}/tracking-tags with adAccountId. It is idempotent on LinkedIn: when the ad account already has an Insight Tag, it returns that tag instead of creating another.

name is required by the endpoint but ignored, because LinkedIn tags have no name.

import Zernio from '@zernio/node';

const zernio = new Zernio();

const { data } = await zernio.trackingtags.createTrackingTag({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d' },
  body: { adAccountId: '517258773', name: 'Insight Tag' }
});

Response (201):

{
  "platform": "linkedinads",
  "tag": {
    "id": "9069513",
    "siteTagId": "9069513",
    "name": "Insight Tag 9069513",
    "platform": "linkedinads",
    "kind": "insight_tag",
    "status": "active",
    "ownerAdAccountId": "517258773",
    "code": "<script type=\"text/javascript\">\n_linkedin_partner_id = \"9069513\";...</script>",
    "lastFiredTime": 1804150800,
    "installed": true,
    "events": [
      { "id": "30828442", "name": "Purchase", "type": "PURCHASE", "status": "active", "siteEvent": "purchase", "siteEventId": "30828442", "defaultValue": 50, "currency": "USD", "clickWindowDays": 30, "viewWindowDays": 7 }
    ]
  }
}

PATCH .../tracking-tags/{tagId} accepts only firstPartyCookieStatus. It maps to LinkedIn's first-party tracking switch: first_party_cookie_enabled or first_party_cookie_disabled.

empty answers 400, because the switch has no unset state.

Ids

FieldValue
accountIdThe linkedinads connection
tagIdThe Insight Tag's partner id (numeric). The API id is the id the site embeds, so siteTagId equals id.
adAccountIdA LinkedIn ad account id, numeric or urn:li:sponsoredAccount:<id>. Conversion rules and domains live under an ad account; per-tag calls default to the account that owns the tag.
events[].idThe conversion rule id. For rules a page can fire, siteEventId is the same id (the conversionId a page sends).

kind is insight_tag. An ad account holds at most one Insight Tag.

The tag has no name of its own, so Zernio returns Insight Tag <id>.

Conversion rules

LinkedIn conversions are separate rules owned by an ad account. Zernio exposes them as the tag's events on /tracking-tags/{tagId}/events.

Pass adAccountId when the rules you want are not on the account that owns the tag.

OperationBehavior
ListEvery conversion rule of the ad account, enabled or not (status active or inactive).
CreateCreates an event-specific Insight Tag rule, the kind a page fires by id. Not idempotent.
UpdatePartial update of any field below.
DeleteDisables the rule (state: "disabled"); PATCH with enabled: true turns it back on. LinkedIn has no delete for rules (DELETE /rest/conversions/{id} has no route).

The body takes:

  • name
  • a LinkedIn conversion type in type (PURCHASE, ADD_TO_CART, LEAD, SIGN_UP, KEY_PAGE_VIEW, ...) or a siteEvent
  • enabled
  • defaultValue with currency, both together, in the ad account's currency. The event's own value wins when it carries one.
  • clickWindowDays and viewWindowDays
const { data } = await zernio.trackingtags.createTrackingTagEvent({
  path: { accountId: '66b2e19d8c3f5a7e9d0b1c2d', tagId: '9069513' },
  body: { name: 'Purchase', siteEvent: 'purchase', defaultValue: 50, currency: 'USD', clickWindowDays: 30, viewWindowDays: 7 }
});

Response (201):

{
  "platform": "linkedinads",
  "event": { "id": "30828442", "name": "Purchase", "type": "PURCHASE", "status": "active", "siteEvent": "purchase", "siteEventId": "30828442", "defaultValue": 50, "currency": "USD", "clickWindowDays": 30, "viewWindowDays": 7 }
}

Rules for the Conversions API and URL-match rules cannot be fired by id from a page. They carry no siteEventId or siteEvent.

page_view maps to KEY_PAGE_VIEW on create, but the Shopify install never fires it. The base tag already reports every page, and a key-page-view rule on every page would count each visit as a conversion.

Share with other ad accounts

GET, POST and DELETE .../tracking-tags/{tagId}/shared-accounts list, grant and revoke other ad accounts' access to the tag. Call them from the ad account that owns it.

A grant gives USE_ONLY access. The recipient can use the tag and its conversions but cannot edit, share or unshare it.

sharedAccounts[] covers the ad accounts this connection can see, with each account's role in its name.

One tag per account. LinkedIn allows one Insight Tag per ad account. A grant to an account that already uses another tag answers 400 (LinkedIn itself returns a bare 500 there).

Last account. Revoking the last ad account on a tag also answers 400. LinkedIn would accept it and leave the tag orphaned, so share it with another account first.

Stats

LinkedIn exposes no fire counts, so GET .../tracking-tags/{tagId}/stats is a health check. It returns two kinds of row:

  • One per domain the tag has fired on: kind: "domain", domainName, lastFiredTime, creationTime, blocked
  • One per conversion rule: kind: "conversion_rule", id, name, type, conversionMethod, status, lastFiredTime

Install on a store

Shopify. Every page view goes to px.ads.linkedin.com/collect. That is LinkedIn's documented image pixel, with the parameter names insight.min.js sends.

Any other storefront event is sent only when the ad account has an enabled, page-fireable rule of the matching type. The most recently fired one wins.

That event goes as a conversionId hit with the value, currency, order id and an eventId. LinkedIn uses the eventId to deduplicate against the Conversions API.

The li_fat_id click id is captured from the landing URL. See the event mapping.

WordPress. The install adds LinkedIn's Insight Tag base code. LinkedIn has no official WordPress plugin, so a blocked install points to pasting the tag's code into the theme.

The Shopify install stores the rule ids it found. Install again after you add or change conversion rules.

What the API cannot do

OperationEvidence
Delete an Insight TagAbsent from LinkedIn's docs; DELETE /rest/insightTags/{id} has no route.
Delete a conversion ruleAbsent from the conversion-tracking docs; DELETE /rest/conversions/{id} has no route, so delete disables.
Name or rename the tagInsight Tags have no name field.
Fire countsLinkedIn reports last-callback times only.

If it fails

ErrorCauseFix
400 on firstPartyCookieStatusThe value is empty, and the switch has no unset stateSend first_party_cookie_enabled or first_party_cookie_disabled
400 on a share grantThe ad account already uses another Insight Tag, and LinkedIn allows one per accountRevoke the account's current tag first, then grant again
400 on a share revokeIt is the last ad account on the tag, which would leave it orphanedShare the tag with another account first
A page never fires a ruleConversions API and URL-match rules cannot be fired by id from a pageCreate an Insight Tag rule on /events
Shopify fires the old rulesThe install stores the rule ids it foundInstall again after you add or change rules

Related

  • Pixels and tracking tags: the cross-platform model and capability matrix.
  • Conversions: server-side events and Conversions API rules.
  • URL tracking tags: a campaign's Dynamic UTM parameters.
  • List conversion events and Share a tracking tag: every field.
Was this page helpful?

Conversions API

Send offline conversion events to LinkedIn with POST /v1/ads/conversions, manage conversion rules, and read attribution back.

URL tracking tags

Read and set a LinkedIn campaign's Dynamic UTM parameters through GET and PATCH /v1/ads/{adId}/tracking-tags.

On this page

Read the tagIdsConversion rulesShare with other ad accountsStatsInstall on a storeWhat the API cannot doIf it failsRelated