c15t
Version:
Headless JavaScript consent management platform for cookie banners, privacy preferences, consent storage, and script gating.
162 lines (125 loc) • 5.42 kB
Markdown
---
title: LinkedIn Insights
description: Track conversions and build matched audiences for LinkedIn
advertising campaigns.
icon: linkedin
group: integrations
---
LinkedIn Insight Tag is LinkedIn's conversion tracking and audience matching tool for LinkedIn advertising campaigns. It tracks website actions, measures ad performance, builds website retargeting audiences, and provides aggregate audience insights about visitors from LinkedIn member accounts.
## Official LinkedIn documentation
* [Add the LinkedIn Insight Tag to your website](https://www.linkedin.com/help/lms/answer/a418880)
* [LinkedIn Insight Tag overview](https://www.linkedin.com/help/lms/answer/a489169)
* [LinkedIn Insight Tag FAQs](https://www.linkedin.com/help/lms/answer/a427660)
* [Insight Tag source status](https://www.linkedin.com/help/lms/answer/a488323)
* [Compatible tag management systems](https://www.linkedin.com/help/lms/answer/a422760)
* [LinkedIn Ads Agreement](https://www.linkedin.com/legal/sas-terms)
## Integrate with c15t
**React**
```tsx
import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/react';
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
const scripts = [
linkedinInsights({
id: '123456789012345',
}),
];
export function ConsentProvider({ children }: { children: ReactNode }) {
return (
<ConsentManagerProvider
options={{
mode: 'hosted',
backendURL: 'https://your-instance.c15t.dev',
scripts,
}}
>
{children}
</ConsentManagerProvider>
);
}
```
**Next.js**
```tsx
'use client';
import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/nextjs';
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
const scripts = [
linkedinInsights({
id: '123456789012345',
}),
];
export function ConsentProvider({ children }: { children: ReactNode }) {
return (
<ConsentManagerProvider
options={{
mode: 'hosted',
backendURL: '/api/c15t',
scripts,
}}
>
{children}
</ConsentManagerProvider>
);
}
```
**JavaScript**
```ts
import { getOrCreateConsentRuntime } from 'c15t';
import { linkedinInsights } from '@c15t/scripts/linkedin-insights';
getOrCreateConsentRuntime({
mode: 'hosted',
backendURL: 'https://your-instance.c15t.dev',
scripts: [
linkedinInsights({
id: '123456789012345',
}),
],
});
```
## How c15t loads it
* **Category:** `marketing` (Ads & Pixels)
* **Loads when:** marketing consent is granted
* **Default install:** c15t sets the LinkedIn partner ID globals, seeds the `lintrk` queue, and loads LinkedIn's `insight.min.js`
* **On revocation:** unloaded - c15t removes the script element from the DOM
> ⚠️ **Warning:**
> LinkedIn says the Insight Tag should not be installed on pages that collect or contain Sensitive Data, including certain consumer health or financial pages. If your app has those pages, only include this script on eligible routes and confirm the placement with your legal team.
Use the LinkedIn Insight Tag partner ID as `id`. You can find it in Campaign Manager under **Data** -> **Signals manager** -> **Insight Tag**.
c15t intentionally does not add LinkedIn's `<noscript>` image pixel fallback. The integration is consent-gated JavaScript, so the script only loads after `marketing` consent is granted.
## Tracking events in your app
c15t gates the LinkedIn Insight Tag from loading until `marketing` consent is granted. Page tracking is automatic once the script loads, but if you fire custom conversions through `window.lintrk(...)`, those calls are **not** automatically gated - `window.lintrk` does not exist before consent is granted, and is removed again if consent is revoked.
Guard custom conversion calls by checking consent state:
```tsx
import { useCallback } from 'react';
import { useConsentManager } from '@c15t/react';
function useTrackSignup() {
const { has } = useConsentManager();
return useCallback(() => {
if (has('marketing')) {
window.lintrk?.('track', { conversion_id: 12345 });
}
}, [has]);
}
function SignupButton() {
const trackSignup = useTrackSignup();
return <button onClick={trackSignup}>Sign up</button>;
}
```
## Verify setup
LinkedIn validates the tag after an associated domain or URL receives traffic. Source status can take a few minutes and up to 24 hours to update after the first page load:
* **Active:** signal received in the past seven days
* **No recent activity:** no signal for more than seven days
* **Unverified:** no signal received yet
## Types
### LinkedInInsightsOptions
|Property|Value|
|:--|:--|
|Type Name|\`LinkedInInsightsOptions\`|
|Source Path|\`./packages/scripts/src/vendors/ads-and-pixels/linkedin-insights.ts\`|
\*ExtractedTypeTable: Could not extract "LinkedInInsightsOptions" from "./packages/scripts/src/vendors/ads-and-pixels/linkedin-insights.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*
### Script
|Property|Value|
|:--|:--|
|Type Name|\`Script\`|
|Source Path|\`./packages/core/src/libs/script-loader/types.ts\`|
\*ExtractedTypeTable: Could not extract "Script" from "./packages/core/src/libs/script-loader/types.ts" using base path "/home/runner/work/c15t/c15t". Verify the path/name and that the file is included by your tsconfig.\*