About five minutes, on the free plan, without a credit card.
1
Install the SDK
There is no dedicated Remix package. The OpenPanel web SDK is the supported path for Remix and is published on npm as @openpanel/web.
npm install @openpanel/web
2
Create the client
apiUrl is required. Without it the SDK falls back to its built-in default of https://api.openpanel.dev and your events go to OpenPanel's own host rather than Privytics.
// app/op.ts
import { OpenPanel } from '@openpanel/web';
export const op = new OpenPanel({
clientId: 'YOUR_CLIENT_ID',
apiUrl: 'https://api.privytics.com',
trackScreenViews: true,
trackOutgoingLinks: true,
trackAttributes: true,
});
3
Load it from your client entry
Importing the module in entry.client.tsx runs the constructor once, in the browser only, before hydration.
// app/entry.client.tsx
import { RemixBrowser } from '@remix-run/react';
import { StrictMode, startTransition } from 'react';
import { hydrateRoot } from 'react-dom/client';
import './op';
startTransition(() => {
hydrateRoot(
document,
<StrictMode>
<RemixBrowser />
</StrictMode>
);
});
4
Track a custom event
Screen views are automatic. Call op.track for anything else. With trackAttributes enabled you can also write <button type="button" data-track="signup_clicked" /> and skip the handler.
// app/routes/pricing.tsx
import { op } from '~/op';
export default function Pricing() {
return (
<button
type="button"
onClick={() => op.track('signup_clicked', { plan: 'pro' })}
>
Start free
</button>
);
}
5
Identify signed-in users
Optional. Pass your own user id to link sessions into a single profile. This is opt-in and needs your own lawful basis.
import { op } from '~/op';
op.identify({
profileId: '123', // Required
firstName: 'Joe',
lastName: 'Doe',
email: 'joe@doe.com',
properties: {
tier: 'premium',
},
});
6
Alternative: plain script tag
If you cannot or would rather not add a client module, put this in the <head> of app/root.tsx instead of installing the SDK. The first block queues calls until the tracker loads, the second loads it. apiUrl still has to point 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>