mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-13 16:16:46 +08:00
feat: add more tracking events (#6866)
Added most tracking events what is missing: - still need a way to track events in blocksuite - some events may not 100% accurate of the one defined in the PRD
This commit is contained in:
@@ -28,6 +28,13 @@ export class TelemetryService extends Service {
|
||||
track_pageview: true,
|
||||
persistence: 'localStorage',
|
||||
});
|
||||
mixpanel.register({
|
||||
appVersion: runtimeConfig.appVersion,
|
||||
environment: runtimeConfig.appBuildType,
|
||||
editorVersion: runtimeConfig.editorVersion,
|
||||
isSelfHosted: Boolean(runtimeConfig.isSelfHosted),
|
||||
isDesktop: environment.isDesktop,
|
||||
});
|
||||
}
|
||||
const account = this.auth.session.account$.value;
|
||||
this.updateIdentity(account);
|
||||
|
||||
@@ -1,7 +1,29 @@
|
||||
import { Service } from '@toeverything/infra';
|
||||
import { mixpanel } from '@affine/core/utils';
|
||||
import { createEvent, Service } from '@toeverything/infra';
|
||||
import { combineLatest, distinctUntilChanged, map, skip } from 'rxjs';
|
||||
|
||||
import { Workbench } from '../entities/workbench';
|
||||
|
||||
export const WorkbenchLocationChanged = createEvent<string>(
|
||||
'WorkbenchLocationChanged'
|
||||
);
|
||||
|
||||
export class WorkbenchService extends Service {
|
||||
constructor() {
|
||||
super();
|
||||
combineLatest([this.workbench.location$, this.workbench.basename$])
|
||||
.pipe(
|
||||
map(([location, basename]) => basename + location.pathname),
|
||||
distinctUntilChanged(),
|
||||
skip(1)
|
||||
)
|
||||
.subscribe(newLocation => {
|
||||
this.eventBus.root.emit(WorkbenchLocationChanged, newLocation);
|
||||
mixpanel.track_pageview({
|
||||
location: newLocation,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
workbench = this.framework.createEntity(Workbench);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user