Skip to content

Commit a565d57

Browse files
committed
feat: add more telemetry events
1 parent 5314fff commit a565d57

11 files changed

Lines changed: 25 additions & 23 deletions

packages/devtools/client/components/AssetDetails.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ async function renameAsset() {
244244
title="Copy public path"
245245
icon="carbon-copy"
246246
:border="false"
247-
@click="copy(asset.publicPath)"
247+
@click="copy(asset.publicPath, 'assets-public-path')"
248248
/>
249249
<NButton
250250
v-tooltip="'Open in browser'"

packages/devtools/client/components/CodeSnippets.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { CodeSnippet } from '../../types'
44
55
const props = defineProps<{
66
codeSnippets: CodeSnippet[]
7+
eventType?: string
78
}>()
89
910
const selected = shallowRef<CodeSnippet | undefined>(props.codeSnippets[0])
@@ -45,7 +46,7 @@ watchEffect(() => {
4546
<div flex="~ gap-2" px3 pb3 n="sm primary">
4647
<NButton
4748
icon="carbon-copy"
48-
@click="copy(selected!.code)"
49+
@click="copy(selected!.code, eventType || `code-snippet-${selected.name}`)"
4950
>
5051
Copy
5152
</NButton>

packages/devtools/client/components/ComponentDetails.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ const copy = useCopy()
1919
<div flex="~ col gap1" items-start of-hidden>
2020
<div flex="~ gap2" px3>
2121
<ComponentName :component="component" />
22-
<NButton title="Copy name" flex-none icon="carbon-copy" :border="false" @click="copy(`<${name}></${name}>`)" />
22+
<NButton
23+
title="Copy name" flex-none icon="carbon-copy" :border="false"
24+
@click="copy(`<${name}></${name}>`, 'component-name')"
25+
/>
2326
<NBadge
2427
v-if="component.global"
2528
n="green"

packages/devtools/client/components/ComposableItem.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const docsUrl = computed(() => {
5555
:markdown="item.meta.description"
5656
/>
5757
<div flex="~ gap2" n="primary xs">
58-
<NButton icon="carbon-copy" @click="copy(name)">
58+
<NButton icon="carbon-copy" @click="copy(name, 'imports-name')">
5959
Copy
6060
</NButton>
6161
<NButton v-if="filepath" icon="carbon-code" @click="filepath && openInEditor(filepath)">

packages/devtools/client/components/NpmVersionCheck.vue

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ async function updateWithConfirm() {
3232
const processId = await update(async (command) => {
3333
return PromiseConfirm.start(command)
3434
})
35+
36+
telemetry('npm:update', {
37+
packageName: props.packageName,
38+
oldVersion: info.value?.current,
39+
})
40+
3541
if (processId && shouldRestartServer.value) {
3642
restartDialogs.value.push({
3743
id: processId,

packages/devtools/client/components/OpenGraphMissingTabs.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ const selectedTab = ref(tabs[0])
108108
<p flex="~ gap-1 wrap items-center">
109109
<NButton
110110
icon="carbon-copy" n="xs" px-2
111-
@click="copy(codeSnippet)"
111+
@click="copy(codeSnippet, 'open-graph-suggestion')"
112112
>
113113
Copy
114114
</NButton>
@@ -133,7 +133,7 @@ const selectedTab = ref(tabs[0])
133133
<div flex="~ gap-2" n="sm primary" absolute right-2 top-2>
134134
<NButton
135135
icon="carbon-copy"
136-
@click="copy(codeSnippet)"
136+
@click="copy(codeSnippet, 'open-graph-suggestion')"
137137
>
138138
Copy
139139
</NButton>

packages/devtools/client/components/PictureInPictureButton.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function popup() {
4040
<p>
4141
Your current browser does not seem to support the API, or the flag is not enabled yet.
4242
You can try enabling the flag by visiting
43-
<NButton n="xs primary" title="Click to Copy" @click="copy('chrome://flags/#document-picture-in-picture-api')">
43+
<NButton n="xs primary" title="Click to Copy" @click="copy('chrome://flags/#document-picture-in-picture-api', 'external-docs')">
4444
chrome://flags/#document-picture-in-picture-api
4545
</NButton>
4646
and restart the browser.

packages/devtools/client/components/ServerRouteDetails.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ const copy = useCopy()
347347
n="xs blue"
348348
icon="carbon:copy"
349349
:border="false"
350-
@click="copy(finalURL)"
350+
@click="copy(finalURL, 'server-route-url')"
351351
/>
352352
<NButton
353353
v-tooltip="'Open in Editor'"

packages/devtools/client/components/TimelineArgumentView.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ const copy = useCopy()
8282
<NButton
8383
title="Copy to clipboard"
8484
icon="carbon-copy"
85-
@click="copy(JSON.stringify(clone, null, 2))"
85+
@click="copy(JSON.stringify(clone, null, 2), 'timeline-argument')"
8686
>
8787
Copy
8888
</NButton>

packages/devtools/client/composables/editor.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { useClipboard } from '@vueuse/core'
2+
import { telemetryEvent } from '../../src/server-rpc/telemetry'
23

34
export function useOpenInEditor() {
45
const config = useServerConfig()
@@ -30,9 +31,13 @@ export function useOpenInEditor() {
3031
export function useCopy() {
3132
const clipboard = useClipboard()
3233

33-
return (text: string) => {
34+
return (text: string, type?: string) => {
3435
clipboard.copy(text)
3536

37+
telemetry('copy', {
38+
copyType: type,
39+
})
40+
3641
devtoolsUiShowNotification({
3742
message: 'Copied to clipboard',
3843
icon: 'carbon-checkmark',

0 commit comments

Comments
 (0)