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 through the tracking tags API.
The LinkedIn Insight Tag is the site tag behind LinkedIn website conversions and retargeting. Zernio exposes it under the platform-neutral tracking tags API on your linkedinads connection: 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, and install it on a connected Shopify store or WordPress site. This is the site tag; a campaign's Dynamic UTM parameters are on URL tracking tags.
Ids
| Field | Value |
|---|---|
accountId | The linkedinads connection |
tagId | The Insight Tag's partner id (numeric). The API id is the id the site embeds, so siteTagId equals id. |
adAccountId | A 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[].id | The 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, and the tag has no name of its own (Zernio returns Insight Tag <id>).
Read and create
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 and the ad account's conversion rules as events.
POST /v1/accounts/{accountId}/tracking-tags with adAccountId 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 and 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, which 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).
Conversion rules
LinkedIn conversions are separate rules owned by an ad account, exposed 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.
| Operation | Behavior |
|---|---|
| List | Every conversion rule of the ad account, enabled or not (status active or inactive). |
| Create | Creates an event-specific Insight Tag rule, the kind a page fires by id. Not idempotent. |
| Update | Partial update of any field below. |
| Delete | Disables 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, so 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, 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.
LinkedIn allows one Insight Tag per ad account, so a grant to an account that already uses another tag answers 400 (LinkedIn itself returns a bare 500 there). 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: one row per domain the tag has fired on (kind: "domain", domainName, lastFiredTime, creationTime, blocked) and 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(LinkedIn's documented image pixel, with the parameter namesinsight.min.jssends). 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), as aconversionIdhit with the value, currency, order id and aneventIdLinkedIn uses to deduplicate against the Conversions API. Theli_fat_idclick id is captured from the landing URL. See the event mapping. - WordPress: LinkedIn's Insight Tag base code. LinkedIn has no official WordPress plugin, so a blocked install points to pasting the tag's
codeinto the theme.
The Shopify install stores the rule ids it found, so install again after you add or change conversion rules.
What the API cannot do
| Operation | Evidence |
|---|---|
| Delete an Insight Tag | Absent from LinkedIn's docs; DELETE /rest/insightTags/{id} has no route. |
| Delete a conversion rule | Absent from the conversion-tracking docs; DELETE /rest/conversions/{id} has no route, so delete disables. |
| Name or rename the tag | Insight Tags have no name field. |
| Fire counts | LinkedIn reports last-callback times only. |
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.