Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Warning
Deprecation Notice
The Marketing Version 202403 (Marketing March 2024) has been sunset. We recommend that you migrate to the latest 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.
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:
See the following setup requirements to perform conversion tracking:
Note
Advertisers with an existing Insight Tag and LLA relationship must have their LLA account internally allowlisted.
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 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
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 |
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 the Insight Tag for a given Ad account. An account can have only one Insight Tag.
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 for a given Insight Tag ID.
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>"
}
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
.
HTTP/1.1 204 No Content
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
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:
FULL
access to the Insight Tag. This role must be passed to another Ad Account if no other Ad Account currently has FULL
access.FULL
access to a new Insight Tag that a different Ad Account currently has FULL
access to.To query for the access role associated to an advertiser account and Insight Tag, use q=account
and the sponsoredAccountUrn
.
{
"elements": [
{
"account": "urn:li:sponsoredAccount:123456",
"insightTag": "urn:tscp:insightTag:100",
"role": "FULL"
}
],
"paging": {
"count": 10,
"links": [],
"start": 0
}
}
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
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 |
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
Field key | Field Descriptions |
---|---|
account | The sponsored account URN. |
insightTag | The Insight Tag URN. |
targetAccount | The sponsored account URN of the recipient. |
POST https://api.linkedin.com/rest/insightTagsPermission?action=revokeAccess
{
"account": "urn:li:sponsoredAccount:123456",
"insightTag": "urn:tscp:insightTag:100",
"targetAccount": "urn:li:sponsoredAccount:7890"
}
POST https://api.linkedin.com/v2/insightTagsPermission?action=revokeAccess
{
"account": "urn:li:sponsoredAccount:123456",
"insightTag": "urn:tscp:insightTag:100",
"targetAccount": "urn:li:sponsoredAccount:7890"
}
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 professional demographics.
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 all the domains associated with an Ad account. Sorted by most recent first. Returns a max of 100 records if no count is specified.
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":[]
}
}
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 professional demographics.
HTTP/1.1 204 No Content
ETag: W/"0"
X-RestLi-Protocol-Version: 2.0.0
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 professional demographics.
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
}
}
}
}
}
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": {}
}
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}
{ "blocked": true, "insightTag": "urn:tscp:insightTag:3981306", "created": 1447843020000, "domainName": "example.com" }
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}
{
"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": {}
}
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}
{
"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
}
}
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.
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
Field Key | Type/Info | Field Descriptions |
---|---|---|
attributionType | string, default=LAST_TOUCH_BY_CAMPAIGN |
|
account | URN | The Sponsored Account URN that this Conversion resides under. This can be either specified in URL query parameter or in the request JSON body. Example: urn:li:sponsoredAccount:12345 |
enabled | boolean Optional, default=true |
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 | string | A short name for this rule, which will be shown in the UI and in reports. |
type | string | 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). |
Field Key | Type/Info | Field Descriptions |
---|---|---|
attributionType | string, default=LAST_TOUCH_BY_CAMPAIGN |
|
account | URN | The Sponsored Account URN that this Conversion resides under. This can be either specified in URL query parameter or in the request JSON body. Example: urn:li:sponsoredAccount:12345 |
enabled | boolean Optional, default=true |
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 | string | A short name for this rule, which will be shown in the UI and in reports. |
type | string | 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). | |
valueType | string, default=DYNAMIC |
|
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"
} ]
]
}
{
"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.
When you create multiple conversions, the header X-RestLi-Method
must be included in the request and set to BATCH_CREATE
.
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"
}
]
]
}
]
}
{
"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
}
]
}
The following endpoint returns a single conversion
record.
{
"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"
}
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
.
{
"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": {}
}
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.
{
"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":[]
}
}
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.
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"
}
]
]
}
}
}
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"
}
]
]
}
}
}
}
}
{
"results": {
"104004": {
"status": 204
},
"107620": {
"status": 204
}
},
"errors": {}
}
Campaign Conversions are association records between campaigns and conversions.
A successful response returns a 204 No Content
HTTP status code.
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
.
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.
{
"associatedAt": 1506552037373,
"campaign": "urn:li:sponsoredCampaign:337643194",
"conversion": "urn:lla:llaPartnerConversion:70203"
}
A successful response returns a 200 OK
HTTP status code.
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
.
{
"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.
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
.
{
"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":[]
}
}
A successful response returns a 204 No Content
HTTP status code.
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
.
A successful response returns a 204 No Content
HTTP status code.
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.
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/
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. |
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" />
Training
Learning path
Use advance techniques in canvas apps to perform custom updates and optimization - Training
Use advance techniques in canvas apps to perform custom updates and optimization