Skip to content

Commit 83f528f

Browse files
authored
Merge pull request #6351 from Shopify/theme-monorail-event-reporting
Theme monorail event reporting
2 parents f8f44b9 + c12289e commit 83f528f

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/theme': patch
3+
---
4+
5+
Moved analytics logging in theme command layer to ensure we properly log all events

packages/theme/src/cli/utilities/theme-command.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,7 @@ export default abstract class ThemeCommand extends Command {
100100
recordEvent(`theme-command:${commandName}:single-env:authenticated`)
101101

102102
await this.command(flags, session)
103+
await this.logAnalyticsData(session)
103104
return
104105
}
105106

@@ -262,6 +263,7 @@ export default abstract class ThemeCommand extends Command {
262263
recordEvent(`theme-command:${commandName}:multi-env:authenticated`)
263264

264265
await this.command(flags, session, true, {stdout, stderr})
266+
await this.logAnalyticsData(session)
265267
})
266268

267269
// eslint-disable-next-line no-catch-all/no-catch-all
@@ -305,7 +307,6 @@ export default abstract class ThemeCommand extends Command {
305307
const store = flags.store as string
306308
const password = flags.password as string
307309
const session = await ensureAuthenticatedThemes(ensureThemeStore({store}), password)
308-
await this.logAnalyticsData(session)
309310

310311
return session
311312
}
@@ -360,7 +361,9 @@ export default abstract class ThemeCommand extends Command {
360361
})
361362
}
362363

363-
private async logAnalyticsData(session: AdminSession): Promise<void> {
364+
private async logAnalyticsData(session?: AdminSession): Promise<void> {
365+
if (!session) return
366+
364367
const data = compileData()
365368

366369
await addPublicMetadata(() => ({

0 commit comments

Comments
 (0)