StackSee Analytics
Providers

Pirsch Provider

Privacy-focused, cookie-free web analytics

Pirsch is a privacy-friendly, cookie-free web analytics platform that's GDPR compliant by design.

Installation

pnpm install pirsch-sdk

Client-Side Usage

import { createClientAnalytics } from '@stacksee/analytics/client';
import { PirschClientProvider } from '@stacksee/analytics/providers/client';

const analytics = createClientAnalytics({
  providers: [
    new PirschClientProvider({
      identificationCode: 'your-pirsch-identification-code',
      hostname: 'example.com'
    })
  ]
});

await analytics.initialize();

Server-Side Usage

Access keys are simpler and more efficient as they don't require OAuth token refresh:

import { createServerAnalytics } from '@stacksee/analytics/server';
import { PirschServerProvider } from '@stacksee/analytics/providers/server';

const serverAnalytics = createServerAnalytics({
  providers: [
    new PirschServerProvider({
      hostname: 'example.com',
      clientSecret: process.env.PIRSCH_ACCESS_KEY!, // Starts with 'pa_'
      protocol: 'https'
    })
  ]
});

Option 2: Using OAuth Client Credentials

If using OAuth authentication, you must provide both clientId and clientSecret:

const serverAnalytics = createServerAnalytics({
  providers: [
    new PirschServerProvider({
      hostname: 'example.com',
      clientId: process.env.PIRSCH_CLIENT_ID!,
      clientSecret: process.env.PIRSCH_CLIENT_SECRET!,
      protocol: 'https'
    })
  ]
});

Important: Context Requirements

The Pirsch server provider requires valid request context (IP address and User-Agent) to function properly. If you're tracking server-side events without request context, those events will be automatically skipped.

For proper tracking:

  • Use the Proxy pattern to capture client requests
  • Ensure your proxy handler enriches events with IP and User-Agent
  • See Proxy Provider documentation for setup instructions

Privacy Features

  • ✅ No cookies
  • ✅ IP addresses anonymized
  • ✅ GDPR, CCPA, and PECR compliant
  • ✅ No cross-site tracking

Resources