npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@baukit/analytics-posthog-native

v0.3.0

Published

PostHog React Native transport for @baukit/analytics-core.

Downloads

169

Readme

@baukit/analytics-posthog-native

PostHog React Native transport for @baukit/analytics-core. It translates only envelopes that have already passed the core's consent gate, event allowlist, and scrubber.

Self-hosted setup

Install the core and React Native SDK alongside the adapter:

pnpm add @baukit/analytics-core @baukit/analytics-posthog-native posthog-react-native

Use the configured factory with an explicit self-hosted URL. There is deliberately no PostHog Cloud default:

import { AnalyticsClient } from '@baukit/analytics-core';
import { createPostHogNativeTransport } from '@baukit/analytics-posthog-native';

const transport = createPostHogNativeTransport({
  apiKey: 'phc_project_key',
  apiHost: 'https://posthog.analytics.example.com',
});

const analytics = new AnalyticsClient({
  context,
  allowlist,
  transport,
  uuidFactory: secureReactNativeUuidFactory,
});

SDK initialization is lazy: posthog-react-native is loaded and constructed only when the core sends its first consent-approved batch. Its initial distinct ID is bootstrapped from the core envelope. App lifecycle capture, push capture, default person properties, error autocapture, session replay, surveys, and feature-flag preloading are disabled. Person profiles are limited to identified users.

An application that already owns a configured client can wrap it instead:

import { PostHogNativeTransport } from '@baukit/analytics-posthog-native';

const transport = new PostHogNativeTransport(posthog);

When wrapping an instance, the application remains responsible for initializing it only after consent and applying equivalent privacy settings.

The adapter exports a minimal structural PostHogNativeClient interface for mocks and wrappers, while its initializer options compile against posthog-react-native's published types. This keeps unit tests runnable without installing or booting a React Native runtime.

Mapping

  • capture flattens the core-stamped context and already-scrubbed event properties, preserving the core capture time as the PostHog timestamp.
  • identify passes the internal user UUID and the core's already-scrubbed traits. Those traits are the only values used for PostHog person-property $set behavior.
  • alias passes the core's known user UUID to the React Native SDK's alias method.
  • reset resets the PostHog identity after the core has rotated its own anonymous UUID.

Deliberate omissions

This package does not decide consent, generate or validate product identity, define events, allowlist properties, scrub PII, buffer commands, enable automatic capture, record sessions, or add provider-specific event properties. Those policy decisions stay in @baukit/analytics-core (or, for provider project retention and deletion, in operations).