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' } }) }) }) })