(core) Add sign-up and sharing/invite telemetry

Summary:
Enhances sign-up telemetry with login and verification method metadata, and
adds UTM parameters to SendGrid invite email links and Grist document links.

Test Plan: Server and manual.

Reviewers: dsagal

Reviewed By: dsagal

Subscribers: dsagal

Differential Revision: https://phab.getgrist.com/D4169
This commit is contained in:
George Gevoian
2024-01-23 20:12:46 -08:00
parent dba3a59486
commit b77c762358
5 changed files with 28 additions and 8 deletions

View File

@@ -311,6 +311,8 @@ DetailView.prototype.buildFieldDom = function(field, row) {
kd.toggleClass('scissors', isCopyActive),
kd.toggleClass('record-add', row._isAddRow),
dom.autoDispose(isCopyActive),
// Optional icon. Currently only use to show formula icon.
dom('div.field-icon'),
fieldBuilder.buildDomWithCursor(row, isCellActive, isCellSelected)
)
);

View File

@@ -15,6 +15,7 @@ import {buildUpgradeButton} from 'app/client/ui/ProductUpgrades';
import {buildTutorialCard} from 'app/client/ui/TutorialCard';
import {buildPinnedDoc, createPinnedDocs} from 'app/client/ui/PinnedDocs';
import {shadowScroll} from 'app/client/ui/shadowScroll';
import {makeShareDocUrl} from 'app/client/ui/ShareMenu';
import {transition} from 'app/client/ui/transitions';
import {shouldShowWelcomeCoachingCall, showWelcomeCoachingCall} from 'app/client/ui/WelcomeCoachingCall';
import {shouldShowWelcomeQuestions, showWelcomeQuestions} from 'app/client/ui/WelcomeQuestions';
@@ -496,7 +497,7 @@ export function makeDocOptionsMenu(home: HomeModel, doc: Document, renaming: Obs
resourceType: 'document',
resourceId: doc.id,
resource: doc,
linkToCopy: urlState().makeUrl(docUrl(doc)),
linkToCopy: makeShareDocUrl(doc),
reload: () => api.getDocAccess(doc.id),
appModel: home.app,
});

View File

@@ -305,7 +305,7 @@ async function manageUsers(doc: DocInfo, docPageModel: DocPageModel) {
resource: doc,
docPageModel,
appModel: docPageModel.appModel,
linkToCopy: urlState().makeUrl(docUrl(doc)),
linkToCopy: makeShareDocUrl(doc),
// On save, re-fetch the document info, to toggle the "Public Access" icon if it changed.
// Skip if personal, since personal cannot affect "Public Access", and the only
// change possible is to remove the user (which would make refreshCurrentDoc fail)
@@ -314,6 +314,12 @@ async function manageUsers(doc: DocInfo, docPageModel: DocPageModel) {
});
}
export function makeShareDocUrl(doc: Document) {
const url = new URL(urlState().makeUrl(docUrl(doc)));
url.searchParams.set('utm_id', 'share-doc');
return url.href;
}
const cssShareButton = styled('div', `
display: flex;
align-items: center;

View File

@@ -770,10 +770,14 @@ export const TelemetryContracts: TelemetryContracts = {
},
signupFirstVisit: {
category: 'ProductVisits',
description: 'Triggered when a new user first opens the Grist app',
description: 'Triggered when a new user first opens the Grist app.',
minimumTelemetryLevel: Level.full,
retentionPeriod: 'indefinitely',
metadataContracts: {
loginMethod: {
description: 'The login method on getgrist.com. May be "Email + Password" or "Google".',
dataType: 'string',
},
siteId: {
description: 'The site id of first visit after signup.',
dataType: 'number',
@@ -798,6 +802,10 @@ export const TelemetryContracts: TelemetryContracts = {
minimumTelemetryLevel: Level.full,
retentionPeriod: 'indefinitely',
metadataContracts: {
verificationMethod: {
description: 'The verification method. May be "code" or "link".',
dataType: 'string',
},
isAnonymousTemplateSignup: {
description: 'Whether the user viewed any templates before signing up.',
dataType: 'boolean',