About five minutes, on the free plan, without a credit card.
1
Install the SDK
Privytics runs the open source OpenPanel engine, so you use OpenPanel's official npm package.
npm install @openpanel/web
2
Initialise the client
Set apiUrl so the SDK sends events to the Privytics ingestion API instead of the upstream default host.
// op.ts
import { OpenPanel } from '@openpanel/web';
export const op = new OpenPanel({
apiUrl: 'https://api.privytics.com',
clientId: 'YOUR_CLIENT_ID',
trackScreenViews: true,
trackOutgoingLinks: true,
trackAttributes: true,
});
3
Track an event
The first argument is the event name, the second is an optional properties object.
// main.ts
import { op } from './op.js';
op.track('my_event', { foo: 'bar' });
4
Identify a signed in user
Optional. Call identify() with your own user id to get profiles that join sessions together. profileId is the only required field. This is opt in and needs your own lawful basis.
import { op } from './op.js';
op.identify({
profileId: '123', // Required
firstName: 'Joe',
lastName: 'Doe',
email: 'joe@doe.com',
properties: {
tier: 'premium',
},
});
5
Or drop in a script tag, with no build step
If you are not running a bundler, paste this into the <head> of your HTML instead of installing the package. The first block queues calls until the tracker loads, the second loads it. apiUrl still points ingestion at Privytics.
<script>
window.op = window.op || function (...args) { (window.op.q = window.op.q || []).push(args); };
window.op('init', {
apiUrl: 'https://api.privytics.com',
clientId: 'YOUR_CLIENT_ID',
trackScreenViews: true,
trackOutgoingLinks: true,
});
</script>
<script src="https://privytics.com/op1.js" defer></script>