TLDR: LinkedIn Insight Tag has no built-in consent API. The only compliant approach is blocking it until consent. GetCookies handles this with a simple data attribute.
Read full summary
LinkedIn Insight Tag powers conversion tracking for LinkedIn Ads. Unlike Meta and TikTok, it doesn't have a consent API—you must prevent loading entirely until consent. This guide shows how to do it properly.
*Summary by Claude AI*
## The LinkedIn Consent Problem
Meta Pixel has `fbq('consent', 'grant')`.
TikTok Pixel has `ttq.enableCookie()`.
LinkedIn Insight Tag has... nothing.
LinkedIn's tag doesn't include a consent API. Once it loads, it collects data. The only GDPR-compliant approach is preventing it from loading until consent.
This is actually simpler to implement, but requires a different pattern.
## The GetCookies Solution
Use the `data-cookieconsent` attribute to block the script until marketing consent:
```html
```
The `type="text/plain"` prevents execution. GetCookies changes it to `text/javascript` after marketing consent.
## How It Works
1. User loads your page
2. GetCookies shows consent banner
3. LinkedIn tag is blocked (type="text/plain")
4. User accepts marketing cookies
5. GetCookies activates the script (type="text/javascript")
6. LinkedIn tag loads and starts tracking
If user rejects marketing cookies, the tag never loads. Full compliance.
## Dynamic Loading Pattern
For more control, load the tag programmatically:
```javascript
window.addEventListener('getcookies:consent', (e) => {
if (e.detail.marketing && !window.linkedInLoaded) {
loadLinkedInTag();
window.linkedInLoaded = true;
}
});
function loadLinkedInTag() {
_linkedin_partner_id = "YOUR_PARTNER_ID";
window._linkedin_data_partner_ids = window._linkedin_data_partner_ids || [];
window._linkedin_data_partner_ids.push(_linkedin_partner_id);
var s = document.getElementsByTagName("script")[0];
var b = document.createElement("script");
b.type = "text/javascript";
b.async = true;
b.src = "https://snap.licdn.com/li.lms-analytics/insight.min.js";
s.parentNode.insertBefore(b, s);
}
```
## Conversion Tracking
After consent, track conversions:
```javascript
// Standard conversion
window.lintrk('track', { conversion_id: 123456 });
```
## LinkedIn Conversions API (Server-Side)
For better attribution, use server-side tracking:
```python
import requests
url = "https://api.linkedin.com/rest/conversionEvents"
headers = {
"Authorization": "Bearer YOUR_ACCESS_TOKEN",
"LinkedIn-Version": "202401",
"Content-Type": "application/json"
}
payload = {
"conversion": "urn:lla:llaPartnerConversion:123456",
"conversionHappenedAt": 1640000000000,
"user": {
"userIds": [{
"idType": "SHA256_EMAIL",
"idValue": "hashed_email"
}]
}
}
response = requests.post(url, headers=headers, json=payload)
```
Server-side events can run regardless of browser consent but should respect user preferences where possible.
## Testing
1. Install LinkedIn Insight Tag Helper extension
2. Load site in incognito
3. Before consent: Tag should NOT be in Network tab
4. Accept marketing cookies
5. Refresh: Tag should appear and fire
## The Bottom Line
LinkedIn Insight Tag doesn't have a consent API. The compliant approach is simple: don't load it until consent.
GetCookies makes this trivial with the `data-cookieconsent` attribute. One attribute change. Full compliance.
---
**Ready to make your LinkedIn tracking compliant?**
[Set up GetCookies in 5 minutes](https://getcookies.co)