# PostHog

If your application already tracks events with PostHog, the Altertable JavaScript SDK can forward those captured events into the `product_analytics` catalog. Your existing PostHog tracking calls can stay in place.

## Connect PostHog

Enable [Product Analytics](/docs/product-analytics.md) and copy its [API key](/docs/ingest-data/product-analytics/authentication.md). Initialize Altertable before PostHog:

```typescript
import posthog from 'posthog-js';
import { altertable } from '@altertable/altertable-js';

altertable.init('YOUR_API_KEY', {
  adapters: { posthog },
});

posthog.init('POSTHOG_KEY');
```

While the adapter is configured, Altertable's own `track`, `page`, `identify`, `alias`, `updateTraits`, and `reset` calls are ignored, and its automatic capture stays off. Altertable still applies its tracking consent setting. Forwarded events do not pass through `transformEvent`.

PostHog events need a distinct ID and timestamp. Cookieless PostHog events are not supported.

For events tracked directly with Altertable, see [Track](/docs/ingest-data/product-analytics/track.md).