feat: revenue tracking

* wip

* wip

* wip

* wip

* show revenue better on overview

* align realtime and overview counters

* update revenue docs

* always return device id

* add project settings, improve projects charts,

* fix: comments

* fixes

* fix migration

* ignore sql files

* fix comments
This commit is contained in:
Carl-Gerhard Lindesvärd
2025-11-19 14:27:34 +01:00
committed by GitHub
parent d61cbf6f2c
commit 790801b728
58 changed files with 2191 additions and 23691 deletions

View File

@@ -183,6 +183,28 @@ export class OpenPanel {
});
}
async revenue(
amount: number,
properties?: TrackProperties & { deviceId?: string },
) {
const deviceId = properties?.deviceId;
delete properties?.deviceId;
return this.track('revenue', {
...(properties ?? {}),
...(deviceId ? { __deviceId: deviceId } : {}),
__revenue: amount,
});
}
async fetchDeviceId(): Promise<string> {
const result = await this.api.fetch<undefined, { deviceId: string }>(
'/track/device-id',
undefined,
{ method: 'GET', keepalive: false },
);
return result?.deviceId ?? '';
}
clear() {
this.profileId = undefined;
// should we force a session end here?