Insight Tag Conversion Tracking
Warning
Deprecation Notice
The Marketing Version 202310 (Marketing October 2023) and earlier versions (excluding 202306 and 202307) have been sunset. Additionally, the unversioned APIs will be sunset soon. We recommend that you migrate to the versioned APIs as well as migrate to the new Content and Community Management APIs to avoid disruptions. See the Migration page for more details.
If you haven’t yet migrated and have questions, submit a request on the LinkedIn Developer Support Portal.
Conversion tracking gives advertisers confidence that an ad product delivers a measurable return on investment. This includes better ad reporting based on tracked conversions coming from impressions, the ability to optimize campaigns through better targeting and impression delivery, and more efficient media planning and budget allocation through impression tracking and attribution.
Permissions
There are two conditions for successful calls: (1) Scope permissions to rw_ads
and/or r_ads
, and (2) the user assigning permission holding one of the following roles in the Ad Account.
Scope permissions:
rw_ads
(Read/Write)r_ads
(Read-Only)
Ad Account Roles:
ACCOUNT_BILLING_ADMIN
ACCOUNT_MANAGER
CAMPAIGN_MANAGER
CREATIVE_MANAGER
VIEWER
(Read-Only, even with rw_ads scope)
For more information on Ad Account roles and permissions:
Requirements
See the following setup requirements to perform conversion tracking:
- Create Insight Tag for an advertiser account
- Deploy the Insight Tag JavaScript snippet in a common header or footer on the advertiser’s site. This is your tracking code and is unique to the advertiser account
- Create one or more conversions that have URL matching rules or conversion image pixel
- Add campaign(s) to the conversions
Note
Advertisers with an existing Insight Tag and LLA relationship must have their LLA account internally allowlisted.
Insight Tags
Schema
Field | Type | Description | Example |
---|---|---|---|
id | long | The ID for this Insight Tag. | 100 |
tag | string | The HTML tag contents, either the JS or the image. Read-only. | <script type=\"text/javascript\"></script> |
sponsoredAccounts | SponsoredAccountUrn[] default=[] |
Identifies the sponsored accounts associated with this Insight Tag. Create-only. | ["urn:li:sponsoredAccount:123456"] |
firstPartyTrackingEnabled | boolean default=true |
If first party tracking is enabled for this Insight Tag, then the Insight Tag will attempt to drop a first party cookie on the advertiser's domain given that the page url contains the 1st party tracking id. This setting will propagate to all the accounts with the same Insight Tag. Read more: First-Party Cookies on LinkedIn. | true |
Create an Insight Tag
Create Insight Tag for given Ad account. Copy the tag code from newly created Insight Tag and paste at global footer, right above the closing of HTML <body>
tag of advertiser’s website. Adding the tag to the global footer will let you track conversions or re-target on any page across your whole site.
POST https://api.linkedin.com/rest/insightTags
POST https://api.linkedin.com/v2/insightTags
Request Body Fields
Field key | Field Descriptions |
---|---|
sponsoredAccounts | Sponsored accounts associated with this insight tag. Passing multiple Ad accounts won't create insight tag for all Ad accounts. It will fail to create insight tag. Use Insight Tag Permissions endpoint to share this insight with other Ad Accounts. Create-Only |
Sample Request
Sample Response
HTTP/1.1 201 Created
Content-Type: application/json
Location: /insightTags/100
x-restli-id: 100
X-RestLi-Protocol-Version: 2.0.0
{
"firstPartyTrackingEnabled": true,
"sponsoredAccounts": [
"urn:li:sponsoredAccount:123456"
],
"id": 100,
"tag": "<script type=\"text/javascript\"></script>"
}
A successful response returns a 201 Created
HTTP status code and the ID in the x-linkedin-id
response header.
Once the tag is installed on your website and traffic to your site exists, you can verify the tag is working by making the Find Insight Tag Domains by Account request. It takes 5 to 10 minutes to populate insight tag domains after the webpage is updated with Insight Tag JavaScript and after a visit to that webpage.
Find Insight Tag by Account
Find the Insight Tag for a given Ad account. An account can have only one Insight Tag.
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
{
"elements": [
{
"firstPartyTrackingEnabled": true,
"sponsoredAccounts": [
"urn:li:sponsoredAccount:123456"
],
"id": 100,
"tag": "<script type=\"text/javascript\"></script>"
}
],
"paging": {
"count": 10,
"start": 0,
"links": []
}
}
Get Insight Tag
Get Insight Tag for a given Insight Tag ID.
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
{
"firstPartyTrackingEnabled": true,
"sponsoredAccounts": [
"urn:li:sponsoredAccount:123456"
],
"id": 100,
"tag": "<script type=\"text/javascript\"></script>"
}
Partial Update Insight Tag
Update Insight Tag’s firstPartyTrackingEnabled
using this API. Please make sure the header X-RestLi-Method
must be included in the request and set to PARTIAL_UPDATE
.
Sample Request
Sample Response
HTTP/1.1 204 No Content
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
Insight Tag Permissions
There are two access roles for Insight Tag permissions: FULL
(administrator) and USE_ONLY
.
FULL
has general administrative permissions to the Insight Tag.USE_ONLY
can only edit and view conversions and match rules.
More details about what actions each role can take are in the table below.
Access role | View Insight Tag | Update Insight Tag | Grant/revoke Insight Tag Access | Update Insight Tag Domains |
---|---|---|---|---|
FULL | Yes | Yes | Yes | Yes |
USE_ONLY | Yes | No | No | No |
When creating an Insight Tag, the advertiser account creating the Insight Tag gets the FULL
role by default. Alternatively, an advertiser account that does not have an Insight Tag can be granted FULL
or USE_ONLY
access to an Insight Tag from another advertiser account.
A Sponsored Account can have only one Insight Tag associated to it at any given time. An Insight Tag may have multiple ad accounts associated with it. An Insight Tag must have at least 1 account with FULL
access assigned.
If a Sponsored Account with an existing Insight Tag wants to use a different or new Insight Tag, the account must:
- Ensure at least 1 other Ad Account has
FULL
access to the Insight Tag. This role must be passed to another Ad Account if no other Ad Account currently hasFULL
access. - Revoke access to the Insight Tag for the original Ad Account.
- Give
FULL
access to a new Insight Tag that a different Ad Account currently hasFULL
access to.
Insight Tag Permissions for an Advertiser Account
To query for the access role associated to an advertiser account and Insight Tag, use q=account
and the sponsoredAccountUrn
.
Sample Response
{
"elements": [
{
"account": "urn:li:sponsoredAccount:123456",
"insightTag": "urn:tscp:insightTag:100",
"role": "FULL"
}
],
"paging": {
"count": 10,
"links": [],
"start": 0
}
}
Grant Insight Tag Access to a Different Advertiser Account
Give access to another Ad Account by granting an access role to an Insight Tag.
POST https://api.linkedin.com/rest/insightTagsPermission?action=grantAccess
::: moniker-end
POST https://api.linkedin.com/v2/insightTagsPermission?action=grantAccess
Request Body Fields
Field key | Field Descriptions |
---|---|
account | The sponsored account URN. |
insightTag | The Insight Tag URN. |
targetAccount | The sponsored account URN of the recipient. |
role | FULL or USE_ONLY |
Sample Request
Revoke Insight Tag Access from an Advertiser Account
Revoke access to another advertiser account by removing an access role to an Insight Tag.
An Insight Tag must be associated with at least one Ad Account. The API does not allow you to revoke access to an Insight Tag when there's only one remaining associated Ad Account because it would create an orphan Insight Tag.
POST https://api.linkedin.com/rest/insightTagsPermission?action=revokeAccess
POST https://api.linkedin.com/v2/insightTagsPermission?action=revokeAccess
Request Body Fields
Field key | Field Descriptions |
---|---|
account | The sponsored account URN. |
insightTag | The Insight Tag URN. |
targetAccount | The sponsored account URN of the recipient. |
Sample Request
POST https://api.linkedin.com/rest/insightTagsPermission?action=revokeAccess
{
"account": "urn:li:sponsoredAccount:123456",
"insightTag": "urn:tscp:insightTag:100",
"targetAccount": "urn:li:sponsoredAccount:7890"
}
Insight Tag Domains
POST https://api.linkedin.com/v2/insightTagsPermission?action=revokeAccess
{
"account": "urn:li:sponsoredAccount:123456",
"insightTag": "urn:tscp:insightTag:100",
"targetAccount": "urn:li:sponsoredAccount:7890"
}
Insight Tag Domains V2
Once the Insight Tag code is placed on the partner’s sites, we will receive signals from these sites. The list of domains associated with this Insight Tag will be automatically populated. Advertisers can also block any unrecognized domains. Blocking a domain may impact associated conversions, website audiences and website demographics.
Schema
Field key | Field Descriptions | Example |
---|---|---|
created | A timestamp corresponding to the creation of the domain | 1560228798550 |
insightTag | The Insight Tag Urn for this domain. | urn:tscp:insightTag:100 |
domainName | The domain name without the protocol. | www.example.com |
lastCallbackAt | The last time (in milliseconds) the Insight Tag for this domain called back to the server. | 1560228798550 |
blocked | Whether this domain should be tagged as blocked. Block domains will not send a signal to downstream services, so conversion tracking, re-targeting, etc won't get captured under blocked domains. | true |
Find Insight Tag Domains by Account
Find all the domains associated with an Ad account. Sorted by most recent first. Returns a max of 100 records if no count is specified.
Sample Request
Sample Response
HTTP/1.1 200 OK
Content-Type: application/json
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
{
"elements": [
{
"created": 1560228798550,
"blocked": false,
"lastCallbackAt": 1560228798550,
"domainName": "www.yourdomain.com",
"insightTag": "urn:tscp:insightTag:100"
},
{
"created": 1560228798550,
"blocked": false,
"lastCallbackAt": 1560228798550,
"domainName": "www.example.com",
"insightTag": "urn:tscp:insightTag:101"
},
...
],
"paging": {
"count": 10,
"start": 0,
"links":[]
}
}
Partial Update Insight Tag Domain
Update Insight Tag domain using partial update. Advertiser can block/allow domain using this method. Blocking a domain may impact associated conversions, website audiences and website demographics.
Sample Request
Sample Response
HTTP/1.1 204 No Content
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
Batch Partial Update Insight Tag Domains
Bulk update insight tag domains using batch partial update. Advertiser can block/allow domains using this method. Blocking a domain may impact associated conversions, website audiences and website demographics.
Sample Request
POST https://api.linkedin.com/rest/insightTagDomains?ids=List((account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com),(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.example.com))
{
"entities": {
"(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com)": {
"patch": {
"$set": {
"blocked": false
}
}
},
"(account:urn%3Ali%3AsponsoredAccount%3A507578740,domainName:www.example.com)": {
"patch": {
"$set": {
"blocked": true
}
}
}
}
}
POST https://api.linkedin.com/v2/insightTagDomainsV2?ids=List((account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com),(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.example.com))
{
"entities": {
"(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com)": {
"patch": {
"$set": {
"blocked": false
}
}
},
"(account:urn%3Ali%3AsponsoredAccount%3A507578740,domainName:www.example.com)": {
"patch": {
"$set": {
"blocked": true
}
}
}
}
}
Sample Response
HTTP/1.1 200 OK
X-LI-ResponseOrigin: RGW
Content-Type: application/json
ETag: W/"2113768114"
X-RestLi-Protocol-Version: 2.0.0
Content-Length: 285
{
"results": {
"(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com)": {
"status": 204
},
"(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.example.com)": {
"status": 204
}
},
"errors": {}
}
Get Insight Tag Domains
The following endpoint returns a single insightTagDomain
record.
GET https://api.linkedin.com/rest/insightTagDomains/(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.example.com)
GET https://api.linkedin.com/v2/insightTagDomains/{insightTagDomainId}?account={sponsoredAccountUrn}
Sample Response
{ "blocked": true, "insightTag": "urn:tscp:insightTag:3981306", "created": 1447843020000, "domainName": "example.com" }
Batch Get
Multiple records can be requested with a Batch Get that accepts multiple ids
parameters each with an insightTagDomain
ID.
GET https://api.linkedin.com/rest/insightTagDomains?ids=List((account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com),(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.example.com))
GET https://api.linkedin.com/v2/insightTagDomains?ids={insightTagDomainId1}&ids={insightTagDomainId2}&ids={insightTagDomainId3}&account={sponsoredAccountUrn}
Sample Response
{
"errors": {},
"results": {
"(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.yourdomain.com)": {
"blocked": true,
"insightTag": "urn:tscp:insightTag:3981306",
"created": 1447843020000,
"domainName": "yourdomain.com"
},
"(account:urn%3Ali%3AsponsoredAccount%3A123456,domainName:www.example.com)": {
"blocked": false,
"insightTag": "urn:tscp:insightTag:3981306",
"created": 1447843020000,
"domainName": "example.com"
}
},
"statuses": {}
}
Find Insight Tag Domains by Account
All Insight Tag Domains associated with an Ad Account can be used with the following endpoint:
GET https://api.linkedin.com/rest/insightTagDomains?q=account&account={sponsoredAccountURN}
For more precision, you can also include a domainName
parameter.
GET https://api.linkedin.com/rest/insightTagDomains?q=account&account={sponsoredAccountURN}&domainName={domainName}
GET https://api.linkedin.com/v2/insightTagDomains?q=account&account={sponsoredAccountURN}
For more precision, you can also include a domainName
parameter.
GET https://api.linkedin.com/v2/insightTagDomains?q=accountAndDomainName&account={sponsoredAccountURN}&domainName={domainName}
Sample Response
{
"elements": [
{
"blocked":true,
"insightTag":"urn:tscp:insightTag:3981306",
"created": 1447843020000,
"domainName": "example1.com"
},
{
"blocked":true,
"insightTag":"urn:tscp:insightTag:3981306",
"created": 1447843020000,
"domainName": "example2.com"
}
],
"paging": {
"count": 10,
"links": [],
"start": 0
}
}
Conversions
LinkedIn conversion tracking is an analytical function powered by the LinkedIn Insight Tag. Conversions are actions a member makes that are valuable to your business. Conversion tracking gathers insights into post-click and view-through conversions of your LinkedIn ads campaigns, giving you the ability to measure the impact and ROI of your ads.
The Insight Tag Conversion Tracking API supports both event-specific and site-wide tags.
For more information on conversion tracking, see this help article.
Create a Conversion
Conversions for Insight Tag can be created with the following endpoint. Include rules in the urlMatchRuleExpression
field to track site-wide conversions. Don't include any urlMatchRuleExpression
to track event-specific conversions.
POST https://api.linkedin.com/rest/conversions
POST https://api.linkedin.com/v2/conversions
Schema
Field Key | Type/Info | Field Descriptions |
---|---|---|
attributionType | LAST_TOUCH_BY_CAMPAIGN(DEFAULT) LAST_TOUCH_BY_CONVERSION | LAST_TOUCH_BY_CAMPAIGN(Each campaign): conversion actions are counted once for each campaign to which they can be attributed LAST_TOUCH_BY_CONVERSION(Single Campaign): conversion actions are counted once for each Conversion with at least one associated campaign. learn more |
account | The Sponsored Account URN that this Conversion resides under. This can be either specified in URL query parameter or in the request JSON body. | |
enabled | Set to true or false to enable or disable this rule from matching on the advertiser’s website. The initial state can be either, but only rules that are enabled will trigger conversion events. | |
name | A short name for this rule, which will be shown in the UI and in reports. | |
type | The type of the rule. Can be one of the following:
|
|
latestFirstPartyCallbackAt | Time in milliseconds Read Only | As part of mitigating Intelligent Tracking Prevention, we have introduced an option to advertisers so that they can choose to drop LINKEDIN cookies as first party cookies or third party cookies. This field will help in debugging when advertisers switch from first party to third party. |
postClickAttributionWindowSize | int, default="30" | Specifies a user's settings on the post click attribution window in days. By setting these fields to something else, the advertiser can narrow the window. Allowed values are 1, 7, or 30. learn more |
viewThroughAttributionWindowSize | int, default="7" | Specifies a user's settings on the view through (post view) attribution window in days. By setting these fields to something else, the advertiser can narrow the window. Allowed values are 1, 7, or 30. learn more |
lastCallbackAt | Time in milliseconds Read Only | The last time one or more of the URL match rules fired and called back to the server. It may take 20 min to update. |
value | Optional. The monetary value for this conversion. If this is set, the currency code should be identical to the currency set on the advertiser account. | |
currencyCode | Identifying code for currency type. See currency codes for the valid codes. | |
amount | The amount of money as a real number string. | |
associatedCampaigns | URN CampaignConversion[] | Read only. Array of campaigns associated with this conversion. |
urlMatchRuleExpression | urlMatchRuleExpression | Expression used to determine if a page view event matches. The top-level expression is the logical disjunction(OR) of AdUrlMatchRules, that are grouped by logical conjunction(AND). Example: (matchRule1 AND matchRule2 AND matchRule3) OR (matchRule4 AND matchRule2). Refer to sample request on how to build these rules. |
matchType | The type of this match rule that specifies how the URL will be matched. Can be one of the following:
|
|
matchValue | The URL value text to match. Regular expressions or special syntax are not supported. Examples: 'www.example.com', 'example.com/download.php', 'example.com/download/coolWhitepaper'. For CONTAINS only: 'example.com/order OR example.com/checkout'. There is no need to include the protocol (for example, http, https). | |
type | The type of this match rule that specifies how the URL will be matched. Can be one of the following:
|
|
matchValue | The URL value text to match. Regular expressions or special syntax are not supported. Examples: 'www.example.com', 'example.com/download.php', 'example.com/download/coolWhitepaper'. For CONTAINS only: 'example.com/order OR example.com/checkout'. There is no need to include the protocol (for example, http, https). |
Sample Request
POST https://api.linkedin.com/rest/conversions
{
"postClickAttributionWindowSize": 7,
"viewThroughAttributionWindowSize": 1,
"type": "OTHER",
"name": "test",
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"account": "urn:li:sponsoredAccount:519072844",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com/category"
},
{
"matchType": "CONTAINS",
"matchValue": "/product1"
},
{
"matchType": "CONTAINS",
"matchValue": "/sku100"
}
],
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/product1"
} ]
]
}
POST https://api.linkedin.com/v2/conversions
{
"postClickAttributionWindowSize": 7,
"viewThroughAttributionWindowSize": 1,
"type": "OTHER",
"name": "test",
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"account": "urn:li:sponsoredAccount:519072844",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com/category"
},
{
"matchType": "CONTAINS",
"matchValue": "/product1"
},
{
"matchType": "CONTAINS",
"matchValue": "/sku100"
}
],
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/product1"
} ]
]
}
Sample Response
{
"postClickAttributionWindowSize": 7,
"created": 1566320988691,
"viewThroughAttributionWindowSize": 1,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=107612&fmt=img\" />",
"type": "OTHER",
"enabled": true,
"associatedCampaigns": [],
"campaigns": [],
"name": "test",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com/category"
},
{
"matchType": "CONTAINS",
"matchValue": "/product1"
},
{
"matchType": "CONTAINS",
"matchValue": "/sku100"
}
],
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/product1"
}
]
],
"lastModified": 1566320988691,
"id": 107612,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"key": {
"id": 107612,
"account": "urn:li:sponsoredAccount:519072844"
},
"account": "urn:li:sponsoredAccount:519072844"
}
A successful response returns a 201 Created
HTTP status code and the ID in the x-linkedin-id
response header.
Batch Create
When you create multiple conversions, the header X-RestLi-Method
must be included in the request and set to BATCH_CREATE
.
Sample Request
POST https://api.linkedin.com/rest/conversions
{
"elements": [
{
"postClickAttributionWindowSize": 7,
"viewThroughAttributionWindowSize": 1,
"type": "OTHER",
"name": "test 1 last touch by campaign",
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"account": "urn:li:sponsoredAccount:519072844"
},
{
"postClickAttributionWindowSize": 7,
"viewThroughAttributionWindowSize": 1,
"type": "OTHER",
"name": "test",
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"account": "urn:li:sponsoredAccount:519072844",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com/products"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/orderConfirmation"
}
]
]
}
]
}
POST https://api.linkedin.com/v2/conversions
{
"elements": [
{
"postClickAttributionWindowSize": 7,
"viewThroughAttributionWindowSize": 1,
"type": "OTHER",
"name": "test 1 last touch by campaign",
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"account": "urn:li:sponsoredAccount:519072844"
},
{
"postClickAttributionWindowSize": 7,
"viewThroughAttributionWindowSize": 1,
"type": "OTHER",
"name": "test",
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"account": "urn:li:sponsoredAccount:519072844",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com/products"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/orderConfirmation"
}
]
]
}
]
}
Sample Response
{
"elements": [
{
"location": "/conversions/107628",
"id": "107628",
"entity": {
"postClickAttributionWindowSize": 7,
"created": 1566323091819,
"viewThroughAttributionWindowSize": 1,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=107628&fmt=img\" />",
"type": "OTHER",
"enabled": true,
"associatedCampaigns": [],
"campaigns": [],
"name": "test 1 last touch by campaign",
"lastModified": 1566323091819,
"id": 107628,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"account": "urn:li:sponsoredAccount:519072844"
},
"status": 201
},
{
"location": "/conversions/107620",
"id": "107620",
"entity": {
"postClickAttributionWindowSize": 7,
"created": 1566323091819,
"viewThroughAttributionWindowSize": 1,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=107620&fmt=img\" />",
"type": "OTHER",
"enabled": true,
"associatedCampaigns": [],
"campaigns": [],
"name": "test",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com/products"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/orderConfirmation"
}
]
],
"lastModified": 1566323091819,
"id": 107620,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"account": "urn:li:sponsoredAccount:519072844"
},
"status": 201
}
]
}
Get Conversions
The following endpoint returns a single conversion
record.
Sample Response
{
"postClickAttributionWindowSize": 1,
"viewThroughAttributionWindowSize": 1,
"created": 1566323091819,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=107620&fmt=img\" />",
"type": "OTHER",
"enabled": true,
"associatedCampaigns": [
{
"campaign": "urn:li:sponsoredCampaign:345396555",
"associatedAt": 1563657869695,
"conversion": "urn:lla:llaPartnerConversion:104012"
}
],
"campaigns": [
"urn:li:sponsoredCampaign:345396555"
],
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/order-confirmation"
}
]
],
"name": "test 1 last touch by campaign",
"lastModified": 1566325446875,
"id": 104012,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"account": "urn:li:sponsoredAccount:519072844"
}
Batch Get
Multiple records can be requested with a Batch Get that accepts multiple ids
parameters each with a conversion
ID. Conversion ids should be passed in List format and encoded as shown in the examples below. Also API request requires the header X-Restli-Protocol-Version: 2.0.0
.
Sample Response
{
"statuses": {},
"results": {
"104004": {
"postClickAttributionWindowSize": 30,
"created": 1563230255308,
"viewThroughAttributionWindowSize": 7,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=104004&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": true,
"associatedCampaigns": [
{
"campaign": "urn:li:sponsoredCampaign:345396555",
"associatedAt": 1563657869695,
"conversion": "urn:lla:llaPartnerConversion:104004"
}
],
"campaigns": [
"urn:li:sponsoredCampaign:345396555"
],
"name": "test",
"lastModified": 1563230265652,
"id": 104004,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"value": {
"amount": "10",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844"
},
"104012": {
"postClickAttributionWindowSize": 30,
"created": 1563230311551,
"viewThroughAttributionWindowSize": 7,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=104012&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": true,
"associatedCampaigns": [
{
"campaign": "urn:li:sponsoredCampaign:345396555",
"associatedAt": 1563657869695,
"conversion": "urn:lla:llaPartnerConversion:104012"
}
],
"campaigns": [
"urn:li:sponsoredCampaign:345396555"
],
"name": "test via campaign creation",
"urlMatchRuleExpression": [
[
{
"matchType": "CONTAINS",
"matchValue": "thankyou"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/thankyou"
}
]
],
"lastModified": 1563831171814,
"id": 104012,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [
{
"matchValue": "thankyou",
"type": "CONTAINS"
},
{
"matchValue": "EXACT",
"type": "www.yourdomain.com/thankyou"
}
],
"value": {
"amount": "10",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844"
}
},
"errors": {}
}
Find Conversions by Ad Account
All conversions associated with an ad account can be retrieved by using the following API which takes in a sponsoredAccount
URN in the account
parameter.
Sample Response
{
"elements": [
{
"postClickAttributionWindowSize": 30,
"viewThroughAttributionWindowSize": 7,
"created": 1563230311551,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=104012&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": true,
"associatedCampaigns": [
{
"campaign": "urn:li:sponsoredCampaign:345396555",
"associatedAt": 1563657869695,
"conversion": "urn:lla:llaPartnerConversion:107620"
}
],
"campaigns": [
"urn:li:sponsoredCampaign:345396555"
],
"name": "test via campaign creation",
"urlMatchRuleExpression": [
[
{
"matchType": "CONTAINS",
"matchValue": "thankyou"
}
]
],
"lastModified": 1563230311551,
"id": 104012,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [
{
"matchValue": "thankyou",
"type": "CONTAINS"
}
],
"value": {
"amount": "10",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844"
},
{
"postClickAttributionWindowSize": 30,
"viewThroughAttributionWindowSize": 7,
"created": 1563230255308,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=104004&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": true,
"associatedCampaigns": [
{
"campaign": "urn:li:sponsoredCampaign:345396555",
"associatedAt": 1563657869695,
"conversion": "urn:lla:llaPartnerConversion:104004"
}
],
"campaigns": [
"urn:li:sponsoredCampaign:345396555"
],
"name": "test",
"lastModified": 1563230265652,
"id": 104004,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"value": {
"amount": "10",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844",
"key": {
"id": 104004,
"account": "urn:li:sponsoredAccount:519072844"
}
},
{
"postClickAttributionWindowSize": 30,
"viewThroughAttributionWindowSize": 7,
"created": 1558369606720,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=94924&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": false,
"associatedCampaigns": [],
"campaigns": [],
"name": "test 123",
"lastModified": 1558369606720,
"id": 94924,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"value": {
"amount": "0",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844",
"key": {
"id": 94924,
"account": "urn:li:sponsoredAccount:519072844"
}
},
{
"postClickAttributionWindowSize": 30,
"viewThroughAttributionWindowSize": 7,
"created": 1558369532355,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=94916&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": true,
"associatedCampaigns": [
{
"campaign": "urn:li:sponsoredCampaign:345396555",
"associatedAt": 1563657869695,
"conversion": "urn:lla:llaPartnerConversion:94916"
}
],
"campaigns": [
"urn:li:sponsoredCampaign:345396555"
],
"name": "test conversion",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.google.com"
}
]
],
"lastModified": 1558369532355,
"id": 94916,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [
{
"matchValue": "www.google.com",
"type": "STARTS_WITH"
}
],
"value": {
"amount": "0",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844",
"key": {
"id": 94916,
"account": "urn:li:sponsoredAccount:519072844"
}
},
{
"postClickAttributionWindowSize": 30,
"viewThroughAttributionWindowSize": 7,
"created": 1558369470905,
"imagePixelTag": "<img height=\"1\" width=\"1\" style=\"display:none;\" alt=\"\" src=\"https://px.ads.linkedin.com/collect/?pid=175804&conversionId=94908&fmt=img\" />",
"type": "ADD_TO_CART",
"enabled": false,
"associatedCampaigns": [],
"campaigns": [],
"name": "test conversion",
"lastModified": 1558369470905,
"id": 94908,
"attributionType": "LAST_TOUCH_BY_CAMPAIGN",
"urlRules": [],
"value": {
"amount": "0",
"currencyCode": "USD"
},
"account": "urn:li:sponsoredAccount:519072844",
"key": {
"id": 94908,
"account": "urn:li:sponsoredAccount:519072844"
}
}
],
"paging": {
"count": 10,
"start": 0,
"links":[]
}
}
Update a Conversion
Use this to update your conversion. Only the field that changes needs to be specified. All fields can be modified, but should be done so with care. If you update campaigns or urlMatchRuleExpression
, then all the existing items in the array need to be specified. The update replaces the whole field, rather than appending the new updated values.
The header X-RestLi-Method
must be included in the request and set to partial_update
.
Updating a field does not change the data associated with previous conversion events. For example, changing the value of a conversion from $50 to $25 does not change the $50 value associated with conversion events for this rule that triggered previous to the change.
Sample Request
POST https://api.linkedin.com/rest/conversions/107524?account=urn%3Ali%3AsponsoredAccount%3A519072844
{
"patch": {
"$set": {
"postClickAttributionWindowSize": 1,
"viewThroughAttributionWindowSize": 1,
"name": "test 1 last touch by campaign",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/order-confirmation"
}
]
]
}
}
}
POST https://api.linkedin.com/v2/conversions/107524?account=urn%3Ali%3AsponsoredAccount%3A519072844
{
"patch": {
"$set": {
"postClickAttributionWindowSize": 1,
"viewThroughAttributionWindowSize": 1,
"name": "test 1 last touch by campaign",
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/order-confirmation"
}
]
]
}
}
}
Batch Partial Update
To make multiple updates in a single request, the header X-RestLi-Method
must be included in the request and set to BATCH_PARTIAL_UPDATE
. Conversion ids
should be passed in List format shown in the examples below. Also API request requires the header X-Restli-Protocol-Version: 2.0.0
.
POST https://api.linkedin.com/rest/conversions?account=urn%3Ali%3AsponsoredAccount%3A519072844&ids=List(104004,107620)
{
"entities": {
"104004": {
"patch": {
"$set": {
"postClickAttributionWindowSize": 1
}
}
},
"107620": {
"patch": {
"$set": {
"postClickAttributionWindowSize": 1,
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/order-confirmation"
}
]
]
}
}
}
}
}
POST https://api.linkedin.com/v2/conversions?account=urn%3Ali%3AsponsoredAccount%3A519072844&ids=List(104004,107620)
{
"entities": {
"104004": {
"patch": {
"$set": {
"postClickAttributionWindowSize": 1
}
}
},
"107620": {
"patch": {
"$set": {
"postClickAttributionWindowSize": 1,
"urlMatchRuleExpression": [
[
{
"matchType": "STARTS_WITH",
"matchValue": "www.yourdomain.com"
},
{
"matchType": "CONTAINS",
"matchValue": "/category/"
}
],
[
{
"matchType": "EXACT",
"matchValue": "www.yourdomain.com/order-confirmation"
}
]
]
}
}
}
}
}
Sample Response
{
"results": {
"104004": {
"status": 204
},
"107620": {
"status": 204
}
},
"errors": {}
}
Campaign Conversions
Campaign Conversions are association records between campaigns and conversions.
Create a Campaign Conversion
Sample Request
A successful response returns a 204 No Content
HTTP status code.
Batch Create
Multiple campaign conversions can be created with a Batch Create that accepts ids
parameters each with a campaign URN
and conversion URN
. The campaign and conversion URNs should be passed in List format and encoded as shown in the examples below. Also API request requires the header X-Restli-Protocol-Version: 2.0.0
.
Sample Request
PUT https://api.linkedin.com/rest/campaignConversions?ids=List((campaign:urn%3Ali%3AsponsoredCampaign%3A345396555,conversion:urn%3Alla%3AllaPartnerConversion%3A104004))
{
"entities":{
"(campaign:urn%3Ali%3AsponsoredCampaign%3A345396555,conversion:urn%3Alla%3AllaPartnerConversion%3A104004)":{
"campaign":"urn:li:sponsoredCampaign:345396555",
"conversion":"urn:lla:llaPartnerConversion:104004"
}
}
}
PUT https://api.linkedin.com/v2/campaignConversions?ids=List((campaign:urn%3Ali%3AsponsoredCampaign%3A345396555,conversion:urn%3Alla%3AllaPartnerConversion%3A104004))
{
"entities":{
"(campaign:urn%3Ali%3AsponsoredCampaign%3A345396555,conversion:urn%3Alla%3AllaPartnerConversion%3A104004)":{
"campaign":"urn:li:sponsoredCampaign:345396555",
"conversion":"urn:lla:llaPartnerConversion:104004"
}
}
}
A successful response returns a 204 No Content
HTTP status code.
Get Campaign Conversion
Sample Request
Sample Response
{
"associatedAt": 1506552037373,
"campaign": "urn:li:sponsoredCampaign:337643194",
"conversion": "urn:lla:llaPartnerConversion:70203"
}
A successful response returns a 200 OK
HTTP status code.
Batch Get
Multiple campaign conversion records can be requested with a Batch Get that accepts ids
parameters each with a campaign URN
and campaignConversions
URN.
The campaign and conversion URNs should be passed in List format and encoded as shown in the examples below. Also API request requires the header X-Restli-Protocol-Version: 2.0.0
.
Sample Request
Sample Response
{
"statuses": {},
"results": {
"(campaign:urn%3Ali%3AsponsoredCampaign%3A345396555,conversion:urn%3Alla%3AllaPartnerConversion%3A104004)": {
"associatedAt": 1563657869695,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:104004"
},
"(campaign:urn%3Ali%3AsponsoredCampaign%3A345396555,conversion:urn%3Alla%3AllaPartnerConversion%3A104012)": {
"associatedAt": 1563657869695,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:104012"
}
},
"errors": {}
}
A successful response returns a 200 OK
HTTP status code.
Find Campaign Conversions by Campaigns
All campaign conversions associated with campaign(s) can be retrieved by using the following API that takes in a list of sponsored campaign URNs in campaigns parameter. API accepts parameter q=campaigns
to find campaign conversions. The campaign
URNs should be passed in List format and encoded as shown in the examples below. Also API request requires the header X-Restli-Protocol-Version: 2.0.0
.
Sample Request
Sample Response
{
"elements": [
{
"associatedAt": 1503516717694,
"campaign": "urn:li:sponsoredCampaign:324175962",
"conversion": "urn:lla:llaPartnerConversion:58980"
},
{
"associatedAt": 1563657869695,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:94916"
},
{
"associatedAt": 1565302307661,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:107604"
},
{
"associatedAt": 1565300532743,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:107596"
},
{
"associatedAt": 1563657869695,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:104012"
},
{
"associatedAt": 1565387276816,
"campaign": "urn:li:sponsoredCampaign:345396555",
"conversion": "urn:lla:llaPartnerConversion:104004"
}
],
"paging": {
"count": 10,
"start": 0,
"links":[]
}
}
Delete Campaign Conversion
Sample Request
A successful response returns a 204 No Content
HTTP status code.
Batch Delete Campaign Conversion
Sample Request
Multiple campaign conversion records can be deleted with a Batch delete API that accepts ids
parameters each with a campaign URN
and campaignConversions
URN.
The campaign and conversion URNs should be passed in List format and encoded as shown in the examples below. Also API request requires the header X-Restli-Protocol-Version: 2.0.0
.
Sample Request
A successful response returns a 204 No Content
HTTP status code.
Path to Conversion API Metrics
Conversion data from events such as impressions or clicks before the most recent event is now available. For example, you can query multiple impressions leading to the same conversion action instead of only the most recent action.
Prerequisites
LinkedIn supports receiving custom order IDs. Advertisers can define the conversion type they want to track by writing custom Javascript that calls the endpoint directly to register conversion actions.
You must pass cookies associated with the linkedin.com domain during the call since this process is typically handled by the insight tag, and can be verified in the request headers.
The primary URL is
https://px.ads.linkedin.com/collect/
Query Parameters
The following table details query parameters:
Parameter | Description |
---|---|
pid |
LinkedIn's insight tag ID. This parameter must be associated with at least one account. |
url (optional) |
This parameter uses this URL for the conversion match URL. If the parameter is missing, the default value is the referring party in the request headers. This must be URL-encoded. Ignored if conversionId is present. |
fmt |
The format of the query. Only img is supported. |
conversionId (optional) |
LinkedIn-defined ID created in Campaign Manager. If present, this parameter will ignore the url parameter and will try to attribute campaigns associated with the conversion ID found in Campaign Manager. |
oid (optional) |
The order ID. If present, this parameter attributes any impressions or clicks within 90 days. By making a call to an adEventWithConversion , you can fetch all events with any order IDs that lead to a conversion event. You need to create and set the order ID. This parameter is required for the Path to Conversion feature. |
Implementation Examples
Placing the following examples on a web page will correctly direct an event to LinkedIn's tracking server.
The following example shows an event with both the conversionId
and orderId
parameters.
<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=12345&conversionId=12345&oid=12345fmt=img" />
The following example shows an event with the orderId
parameter only. It relies on URL match rules defined in campaign manager.
<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=12345&oid=12345fmt=img" />
The following example shows an event with an override URL:
<img height="1" width="1" style="display:none;" alt="" src="https://px.ads.linkedin.com/collect/?pid=12345&url=https%3A%2F%2Fwww.test.com&fmt=img" />