alphagov / govuk_frontend_toolkit

❗️GOV.UK Frontend Toolkit is deprecated, and will only receive major bug fixes and security patches.
MIT License
403 stars 107 forks source link

Google analytics error #456

Closed bendiggle closed 6 years ago

bendiggle commented 6 years ago

Currently our google analytics is not working for version 7.4.2.

It is erroring here: https://github.com/alphagov/govuk_frontend_toolkit/blob/master/javascripts/govuk/analytics/analytics.js#L102, where location is undefined.

Below is an image of the errors in the browser.

screen shot 2018-03-06 at 16 13 54

Any ideas?

36degrees commented 6 years ago

Thanks for raising this. That function is called from trackPageview which passes window.location as the location argument.

The error you're seeing suggests that window.location is undefined, which would be unusual – is there anything you're doing in your code that could be causing this?

bendiggle commented 6 years ago

Hi @36degrees, thanks for getting back to me. This problem has been resolved. It was an issue with our webpack config. Thanks again!