Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sanity): add telemetry when creating a draft #7459

Merged
merged 1 commit into from
Sep 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {usePaneRouter} from '../../components'
import {structureLocaleNamespace} from '../../i18n'
import {type PaneMenuItem} from '../../types'
import {useStructureTool} from '../../useStructureTool'
import {DocumentURLCopied} from './__telemetry__'
import {CreatedDraft, DocumentURLCopied} from './__telemetry__'
import {
DEFAULT_MENU_ITEM_GROUPS,
EMPTY_PARAMS,
Expand Down Expand Up @@ -294,6 +294,10 @@ export const DocumentPaneProvider = memo((props: DocumentPaneProviderProps) => {
})

patchRef.current = (event: PatchEvent) => {
// when creating a new draft
if (!editState.draft && !editState.published) {
telemetry.log(CreatedDraft)
}
patch.execute(toMutationPatches(event.patches), initialValue.value)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,13 @@ export const DocumentURLCopied = defineEvent({
version: 1,
description: 'User copied document URL to clipboard',
})

/**
* When a draft is successfully created
* @internal
*/
export const CreatedDraft = defineEvent({
name: 'Create a new draft',
version: 1,
description: 'User created a new draft',
})
Loading