mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Add new telemetry events
Summary: Adds a handful of new telemetry events, and makes a few tweaks to allow for better organization of telemetry. Test Plan: Manual. Reviewers: paulfitz Reviewed By: paulfitz Differential Revision: https://phab.getgrist.com/D4100
This commit is contained in:
@@ -59,6 +59,8 @@ export class DocTutorial extends FloatingPopup {
|
||||
if (tableData) {
|
||||
this.autoDispose(tableData.tableActionEmitter.addListener(() => this._reloadSlides()));
|
||||
}
|
||||
|
||||
this._logTelemetryEvent('tutorialOpened');
|
||||
}
|
||||
|
||||
protected _buildTitle() {
|
||||
@@ -158,6 +160,24 @@ export class DocTutorial extends FloatingPopup {
|
||||
];
|
||||
}
|
||||
|
||||
private _logTelemetryEvent(event: 'tutorialOpened' | 'tutorialProgressChanged') {
|
||||
const currentSlideIndex = this._currentSlideIndex.get();
|
||||
const numSlides = this._slides.get()?.length;
|
||||
let percentComplete: number | undefined = undefined;
|
||||
if (numSlides !== undefined && numSlides > 0) {
|
||||
percentComplete = Math.floor(((currentSlideIndex + 1) / numSlides) * 100);
|
||||
}
|
||||
logTelemetryEvent(event, {
|
||||
full: {
|
||||
tutorialForkIdDigest: this._currentFork?.id,
|
||||
tutorialTrunkIdDigest: this._currentFork?.trunkId,
|
||||
lastSlideIndex: currentSlideIndex,
|
||||
numSlides,
|
||||
percentComplete,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
private async _loadSlides() {
|
||||
const tableId = 'GristDocTutorial';
|
||||
if (!this._docData.getTable(tableId)) {
|
||||
@@ -234,7 +254,6 @@ export class DocTutorial extends FloatingPopup {
|
||||
private async _saveCurrentSlidePosition() {
|
||||
const currentOptions = this._currentDoc?.options ?? {};
|
||||
const currentSlideIndex = this._currentSlideIndex.get();
|
||||
const numSlides = this._slides.get()?.length;
|
||||
await this._appModel.api.updateDoc(this._docId, {
|
||||
options: {
|
||||
...currentOptions,
|
||||
@@ -243,20 +262,7 @@ export class DocTutorial extends FloatingPopup {
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
let percentComplete: number | undefined = undefined;
|
||||
if (numSlides !== undefined && numSlides > 0) {
|
||||
percentComplete = Math.floor(((currentSlideIndex + 1) / numSlides) * 100);
|
||||
}
|
||||
logTelemetryEvent('tutorialProgressChanged', {
|
||||
full: {
|
||||
tutorialForkIdDigest: this._currentFork?.id,
|
||||
tutorialTrunkIdDigest: this._currentFork?.trunkId,
|
||||
lastSlideIndex: currentSlideIndex,
|
||||
numSlides,
|
||||
percentComplete,
|
||||
},
|
||||
});
|
||||
this._logTelemetryEvent('tutorialProgressChanged');
|
||||
}
|
||||
|
||||
private async _changeSlide(slideIndex: number) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import {logTelemetryEvent} from 'app/client/lib/telemetry';
|
||||
import {AppModel} from 'app/client/models/AppModel';
|
||||
import {bigBasicButton, bigPrimaryButtonLink} from 'app/client/ui2018/buttons';
|
||||
import {testId, theme, vars} from 'app/client/ui2018/cssVars';
|
||||
@@ -93,7 +94,10 @@ export function showWelcomeCoachingCall(triggerElement: Element, appModel: AppMo
|
||||
cssPopupButtons(
|
||||
bigPrimaryButtonLink(
|
||||
'Schedule Call',
|
||||
dom.on('click', () => dismissPopup(false)),
|
||||
dom.on('click', () => {
|
||||
dismissPopup(false);
|
||||
logTelemetryEvent('clickedScheduleCoachingCall');
|
||||
}),
|
||||
{
|
||||
href: FREE_COACHING_CALL_URL,
|
||||
target: '_blank',
|
||||
|
||||
Reference in New Issue
Block a user