Null check before accessing _paq

pull/21833/head
Luke Barnard 2018-05-03 18:25:00 +01:00
parent 22f2d6f292
commit 3ba51ba695
1 changed files with 8 additions and 7 deletions

View File

@ -164,13 +164,6 @@ class Analytics {
}
trackPageChange(generationTimeMs) {
if (typeof generationTimeMs === 'number') {
this._paq.push(['setGenerationTimeMs', generationTimeMs]);
} else {
console.warn('Analytics.trackPageChange: expected generationTimeMs to be a number');
// But continue anyway because we still want to track the change
}
if (this.disabled) return;
if (this.firstPage) {
// De-duplicate first page
@ -178,6 +171,14 @@ class Analytics {
this.firstPage = false;
return;
}
if (typeof generationTimeMs === 'number') {
this._paq.push(['setGenerationTimeMs', generationTimeMs]);
} else {
console.warn('Analytics.trackPageChange: expected generationTimeMs to be a number');
// But continue anyway because we still want to track the change
}
this._paq.push(['setCustomUrl', getRedactedUrl()]);
this._paq.push(['trackPageView']);
}