send16-browser
v0.1.0
Published
Browser SDK for tracking events and identifying contacts with Send16
Maintainers
Readme
send16-browser
Tiny (~3kb gzipped) browser SDK for tracking events and identifying contacts with Send16.
Install
npm install send16-browserOr via CDN:
<script src="https://cdn.jsdelivr.net/npm/send16-browser/dist/index.global.js"></script>Usage
import { Send16 } from 'send16-browser';
const send16 = Send16.init({
publicKey: 'pk_live_xxxxxxxxxxxxxxxxxxxxxxxx',
source: 'acme-website', // optional, shows up in your Send16 dashboard
});
// Upsert a contact
await send16.identify({
email: '[email protected]',
name: 'Jane Doe',
properties: { plan: 'pro' },
});
// Track an event
await send16.track('purchase.completed', '[email protected]', {
amount: 99,
currency: 'USD',
});
// One-click unsubscribe
await send16.unsubscribe({ email: '[email protected]' });Publishable keys
Generate a publishable key (pk_live_*) from your Send16 dashboard at
Developers → API Keys → Create Key → Publishable.
Publishable keys are scoped to:
POST /api/eventsPOST /api/contacts/upsertPOST /api/suppressions
…and are gated by a per-key allowlist of origins. Configure your domains
(e.g. https://acme.com) in the same dialog when you create the key.
The SDK refuses to use sk_* (secret) keys — those are server-only.
