proxy nextjs events

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-05-12 22:14:35 +02:00
committed by Carl-Gerhard Lindesvärd
parent 494044a3e2
commit c5d7807584
3 changed files with 82 additions and 0 deletions

View File

@@ -208,3 +208,16 @@ opServer.event('my_server_event', { ok: '✅' });
// Pass `profileId` to track events for a specific user
opServer.event('my_server_event', { profileId: '123', ok: '✅' });
```
### Proxy events
With `createNextRouteHandler` you can proxy your events through your server, this will ensure all events are tracked since there is a lot of adblockers that block requests to third party domains.
```typescript
import { createNextRouteHandler } from '@openpanel/nextjs';
export const { POST } = createNextRouteHandler({
clientId: '{YOUR_CLIENT_ID}',
clientSecret: '{YOUR_CLIENT_SECRET}',
});
```