c15t
Version:
Headless JavaScript consent management platform for cookie banners, privacy preferences, consent storage, and script gating.
143 lines (114 loc) • 3.61 kB
Markdown
title: Pirsch
description: Privacy-friendly, cookieless analytics loaded with Pirsch's fixed
script id and identification-code attributes.
group: integrations
icon: pirsch
[Pirsch](https://pirsch.io) provides privacy-friendly, cookieless web analytics. The official embed loads a single deferred script with an `id` of `pianjs` and your `data-code` identification code. c15t preserves that script id so the Pirsch loader can find its own element and read the configured attributes.
## Integrate with c15t
**React**
```tsx
import { type ReactNode } from 'react';
import { ConsentManagerProvider } from '@c15t/react';
import { pirsch } from '@c15t/scripts/pirsch';
const scripts = [
pirsch({
identificationCode: 'YOUR_IDENTIFICATION_CODE',
}),
];
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 { pirsch } from '@c15t/scripts/pirsch';
const scripts = [
pirsch({
identificationCode: 'YOUR_IDENTIFICATION_CODE',
}),
];
export function ConsentProvider({ children }: { children: ReactNode }) {
return (
<ConsentManagerProvider
options={{
mode: 'hosted',
backendURL: '/api/c15t',
scripts,
}}
>
{children}
</ConsentManagerProvider>
);
}
```
**JavaScript**
```ts
import { getOrCreateConsentRuntime } from 'c15t';
import { pirsch } from '@c15t/scripts/pirsch';
getOrCreateConsentRuntime({
mode: 'hosted',
backendURL: 'https://your-instance.c15t.dev',
scripts: [
pirsch({
identificationCode: 'YOUR_IDENTIFICATION_CODE',
}),
],
});
```
## How c15t loads it
* **Category:** `measurement` (Analytics)
* **Loads when:** measurement consent is granted
* **On revocation:** unloaded — c15t removes the script element from the DOM. Pirsch is cookieless, so no client-side cookies need clearing.
The helper maps Pirsch's core script attributes:
```ts
pirsch({
identificationCode: 'YOUR_IDENTIFICATION_CODE',
domain: 'rollup.example.com:ROLLUP_IDENTIFICATION_CODE',
dev: 'example.com',
hitEndpoint: 'https://analytics.example.com/hit',
eventEndpoint: 'https://analytics.example.com/event',
disablePageViews: true,
})
```
Use the extended loader when you need Pirsch's extended script variant:
```ts
pirsch({
identificationCode: 'YOUR_IDENTIFICATION_CODE',
extended: true,
})
```
To proxy or self-host the loader, pass a custom URL:
```ts
pirsch({
identificationCode: 'YOUR_IDENTIFICATION_CODE',
scriptUrl: 'https://analytics.example.com/pa.js',
})
```
## Types
### PirschOptions
|Property|Value|
|:--|:--|
|Type Name|\`PirschOptions\`|
|Source Path|\`./packages/scripts/src/vendors/analytics/pirsch.ts\`|
\*ExtractedTypeTable: Could not extract "PirschOptions" from "./packages/scripts/src/vendors/analytics/pirsch.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.\*