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 (nullwhen 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
| 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.
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.
| 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 asiteEvent enableddefaultValuewithcurrency, both together, in the ad account's currency. The event's own value wins when it carries one.clickWindowDaysandviewWindowDays
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.
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. |
If it fails
| Error | Cause | Fix |
|---|---|---|
400 on firstPartyCookieStatus | The value is empty, and the switch has no unset state | Send first_party_cookie_enabled or first_party_cookie_disabled |
400 on a share grant | The ad account already uses another Insight Tag, and LinkedIn allows one per account | Revoke the account's current tag first, then grant again |
400 on a share revoke | It is the last ad account on the tag, which would leave it orphaned | Share the tag with another account first |
| A page never fires a rule | Conversions API and URL-match rules cannot be fired by id from a page | Create an Insight Tag rule on /events |
| Shopify fires the old rules | The install stores the rule ids it found | Install 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.