Always expect generationTimeMs

This commit is contained in:
Luke Barnard 2018-03-28 10:31:03 +01:00
parent 187e8ab8a8
commit f29b58aba5

View file

@ -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']);
}