Skip to content

Tracking events

Events are how revenue (or any conversion you care about) enters OpenPartner. Each event references the user that triggered it; OpenPartner walks Identity → Click to determine attribution.

Standard events

These are recognized by the default attribution model:

EventUse for
signupUser account creation.
trial_startedTrial subscription started.
subscription_createdPaid subscription created.
invoice_paidRecurring revenue. Most attribution programs commission on this.

Calling event()

op.event('subscription_created', {
amount: 4900, // in minor units (cents)
currency: 'USD',
productId: 'pro_monthly',
});

amount and currency are required for any event you plan to commission on.

Custom events

You can emit any event name you want:

op.event('demo_booked', { dealValue: 50000 });

Then configure a commission rule in the admin UI that targets your custom event by name.

Server-side emission

For revenue events you don’t want clients deciding, emit from your server:

import fetch from 'node-fetch';
await fetch('https://api.openpartner.dev/v1/events', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.OPENPARTNER_SERVER_KEY}`,
'content-type': 'application/json',
},
body: JSON.stringify({
userId: user.id,
type: 'invoice_paid',
amount: 4900,
currency: 'USD',
}),
});

This is the recommended path for invoice_paid and any other event that drives money — it keeps the event source authoritative.