diff --git a/src/browser/browserApi.ts b/src/browser/browserApi.ts index edeb77c459..198b3eec53 100644 --- a/src/browser/browserApi.ts +++ b/src/browser/browserApi.ts @@ -63,7 +63,7 @@ export default class BrowserApi { } } - static getApplicationVersion(): any { + static getApplicationVersion(): string { if (BrowserApi.isChromeApi) { return chrome.runtime.getManifest().version; } else if (BrowserApi.isSafariApi) { diff --git a/src/popup/app/settings/about.component.ts b/src/popup/app/settings/about.component.ts index f5a4dfa43a..21c215139b 100644 --- a/src/popup/app/settings/about.component.ts +++ b/src/popup/app/settings/about.component.ts @@ -1,5 +1,7 @@ import * as template from './about.component.html'; +import BrowserApi from '../../../browser/browserApi'; + export class AboutController { version: string; year: number; @@ -8,7 +10,7 @@ export class AboutController { constructor(private i18nService: any) { this.i18n = i18nService; this.year = (new Date()).getFullYear(); - this.version = chrome.runtime.getManifest().version; + this.version = BrowserApi.getApplicationVersion(); } } diff --git a/src/scripts/analytics.ts b/src/scripts/analytics.ts index 106646f77e..1b1368bbd8 100644 --- a/src/scripts/analytics.ts +++ b/src/scripts/analytics.ts @@ -16,6 +16,7 @@ export default class Analytics { private gaFunc: Function = null; private win: any; private isBackground: boolean = false; + private appVersion: string = BrowserApi.getApplicationVersion(); constructor(win: Window) { const bgPage = BrowserApi.getBackgroundPage(); @@ -70,7 +71,7 @@ export default class Analytics { return; } - const version = encodeURIComponent(BrowserApi.getApplicationVersion()); + const version = encodeURIComponent(this.appVersion); let message = 'v=1&tid=' + this.gaTrackingId + '&cid=' + gaAnonAppId + '&cd1=' + version; if (param1 === 'pageview' && param2) {