From e117d86b1694bb14ee651a4331f9a87cb42653e5 Mon Sep 17 00:00:00 2001 From: Tatsuya Sato Date: Wed, 25 Sep 2024 22:43:45 +0900 Subject: [PATCH] Rename installation events --- src/installation-handler.js | 6 +++--- test/installation-hander.test.js | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/installation-handler.js b/src/installation-handler.js index 0e2c556..3614942 100644 --- a/src/installation-handler.js +++ b/src/installation-handler.js @@ -15,7 +15,7 @@ export async function installationHandler({ previousVersion, reason }) { const { version } = chrome.runtime.getManifest() if (reason === 'install') { - await sendTrackEvent({ name: 'installed', params: { version } }) + await sendTrackEvent({ name: 'custom-installed', params: { version } }) .then(saveLastInstalledVersion) .then(() => console.debug(`lastInstalledVersion is set: ${version}`)) } else if (reason === 'update') { @@ -24,11 +24,11 @@ export async function installationHandler({ previousVersion, reason }) { // if already installed, just update the version if (lastInstalledVersion) { console.debug(`lastInstalledVersion is ${lastInstalledVersion}`) - sendTrackEvent({ name: 'updated', params: { version, previousVersion } }) + sendTrackEvent({ name: 'custom-updated', params: { version, previousVersion } }) return } - sendTrackEvent({ name: 'installed', params: { version } }) + sendTrackEvent({ name: 'custom-installed', params: { version } }) .then(saveLastInstalledVersion) }) } diff --git a/test/installation-hander.test.js b/test/installation-hander.test.js index 0ac4662..25a6893 100644 --- a/test/installation-hander.test.js +++ b/test/installation-hander.test.js @@ -27,7 +27,7 @@ describe('installationHandler', () => { it('should send installed event to google analytics', async () => { await installationHandler({ reason: 'install' }) - expect(sendTrackEvent).toHaveBeenCalledWith({ name: 'installed', params: { version: '4.4.4' } }) + expect(sendTrackEvent).toHaveBeenCalledWith({ name: 'custom-installed', params: { version: '4.4.4' } }) expect(chrome.storage.local.set).toHaveBeenCalledWith({ lastInstalledVersion: '4.4.4' }) }) }) @@ -37,7 +37,7 @@ describe('installationHandler', () => { chrome.storage.local.get.mockReturnValue(Promise.resolve({ lastInstalledVersion: '3.3.3' })) await installationHandler({ reason: 'update', previousVersion: '4.4.3' }) - expect(sendTrackEvent).toHaveBeenCalledWith({ name: 'updated', params: { version: '4.4.4', previousVersion: '4.4.3' } }) + expect(sendTrackEvent).toHaveBeenCalledWith({ name: 'custom-updated', params: { version: '4.4.4', previousVersion: '4.4.3' } }) expect(chrome.storage.local.set).not.toHaveBeenCalled() }) @@ -45,7 +45,7 @@ describe('installationHandler', () => { chrome.storage.local.get.mockReturnValue(Promise.resolve({ lastInstalledVersion: null })) await installationHandler({ reason: 'update', previousVersion: '4.4.3' }) - expect(sendTrackEvent).toHaveBeenCalledWith({ name: 'installed', params: { version: '4.4.4' } }) + expect(sendTrackEvent).toHaveBeenCalledWith({ name: 'custom-installed', params: { version: '4.4.4' } }) }) }) })