Closed Bug 1542817 Opened 6 years ago Closed 6 years ago

`ReferenceError: ga is not defined` on some pages

Categories

(developer.mozilla.org Graveyard :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: peterbe, Assigned: peterbe)

Details

(Keywords: in-triage)

Attachments

(2 files)

Steps to reproduce

  1. Open dev tools Web Console
  2. 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).

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.

Assignee: nobody → schalk.neethling.bugs
Status: NEW → ASSIGNED
Keywords: in-triage

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.

Assignee: schalk.neethling.bugs → peterbe
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED

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

Status: RESOLVED → REOPENED
Resolution: FIXED → ---

We fixed that too.

Status: REOPENED → RESOLVED
Closed: 6 years ago6 years ago
Resolution: --- → FIXED
Product: developer.mozilla.org → developer.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: