From f29b58aba542350f2729bcd61932b6a5ebb41bc4 Mon Sep 17 00:00:00 2001 From: Luke Barnard Date: Wed, 28 Mar 2018 10:31:03 +0100 Subject: [PATCH] Always expect generationTimeMs --- src/Analytics.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Analytics.js b/src/Analytics.js index bb49c19cf5..2ef058b11b 100644 --- a/src/Analytics.js +++ b/src/Analytics.js @@ -148,6 +148,9 @@ class Analytics { } trackPageChange(generationTimeMs) { + if (typeof generationTimeMs !== 'number') { + throw new Error('Analytics.trackPageChange: expected generationTimeMs to be a number'); + } if (this.disabled) return; if (this.firstPage) { // De-duplicate first page @@ -156,9 +159,7 @@ class Analytics { return; } this._paq.push(['setCustomUrl', getRedactedUrl()]); - if (typeof generationTimeMs === 'number') { - this._paq.push(['setGenerationTimeMs', generationTimeMs]); - } + this._paq.push(['setGenerationTimeMs', generationTimeMs]); this._paq.push(['trackPageView']); }