Appearance
Installation
The PackEdge JavaScript SDK is a tiny browser/Node client for the public feature-usage tracking endpoint.
- Size: ~2.4 KB (minified IIFE), ~3.8 KB (ESM)
- Transport:
navigator.sendBeacon→fetch(..., { keepalive: true })fallback - Behavior: fire-and-forget, never throws, safe to ship to customer browsers
via npm
bash
npm install @packedge/js-sdk
# or
pnpm add @packedge/js-sdk
# or
yarn add @packedge/js-sdkts
import packedge from '@packedge/js-sdk';
packedge.init('pk_your_public_key', {
licenseKey: 'XXXX-XXXX-XXXX-XXXX', // optional
});
packedge.track('feature_used', { feature: 'export', format: 'pdf' });via <script> tag
Drop in the IIFE bundle and call packedge.init() from your page.
html
<script src="https://unpkg.com/@packedge/js-sdk/dist/index.global.js"></script>
<script>
packedge.init('pk_your_public_key');
packedge.track('feature_used', { feature: 'export' });
</script>The script attaches to window.packedge, so any later module that imports packedge from @packedge/js-sdk and any inline <script> will share the same singleton.
Finding your public key
The product's public key (pk_…) is shown on its Integrations → SDK tab in the Console. It's safe to ship in browser code — it identifies the product but doesn't grant write access to any private resources.
Where events go
Each track() call hits POST https://api.packedge.dev/public/v1/event and shows up almost immediately in the product's Analytics → Feature Usage tab — sparklines, adoption rate, day-of-week × hour heatmap, drilldown drawer per feature.
See Tracking events for the recommended event name + property conventions, and API reference for the full SDK surface.
