`ReferenceError: ga is not defined` on some pages
Categories
(developer.mozilla.org Graveyard :: General, defect)
Tracking
(Not tracked)
People
(Reporter: peterbe, Assigned: peterbe)
Details
(Keywords: in-triage)
Attachments
(2 files)
Steps to reproduce
- Open dev tools Web Console
- Load https://developer.mozilla.org/en-US/docs/Web/HTML/Element/figure with Firefox Content Blocking
ReferenceError: ga is not defined
The screenshot mentioned line is referencing line 91 which isn't right but very near is the line ga('send', 'pageview', {'hitCallback': removeUtms});
which I suspect gets called after window.onload
even though ga
might not have been created successfully (in the lines above).
Assignee | ||
Comment 1•6 years ago
|
||
I noticed, it happens on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach but not https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray
Clicking around, it seems quite random. Repeatable when you refresh the page but varying depending on the page.
Updated•6 years ago
|
Assignee | ||
Comment 2•6 years ago
|
||
I figured it out. The perf-post-message-handler.js
assumes it can use ga
without saying where it's coming from. You and I know it comes from window
but if you don't say that you get that kind of error.
Comment 3•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
Landed in master https://github.com/mozilla/kuma/commit/986cdddfd7318f8999ba48a80e4d02e783db54d2
And deployed to prod.
Assignee | ||
Comment 5•6 years ago
|
||
Turns out, there's a file called perf-post-message-handler.min.js that gets used in production.
https://github.com/mozilla/kuma/blob/master/kuma/static/js/utils/perf-post-message-handler.min.js
Why is this even checked into git?!
Either way, this file is what gets used in production instead of https://github.com/mozilla/kuma/blob/master/kuma/static/js/utils/perf-post-message-handler.js
Assignee | ||
Comment 6•6 years ago
|
||
We fixed that too.
Updated•5 years ago
|
Description
•