Skip to content

Commit

Permalink
Guard against calling ga function if it doesn't (yet) exist
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleAMathews committed Jul 4, 2017
1 parent 0da9690 commit a10aed5
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
exports.onRouteUpdate = function({ location }) {
// Don't track while developing.
if (process.env.NODE_ENV === `production`) {
if (process.env.NODE_ENV === `production` && typeof ga === `function`) {
ga(`set`, `page`, (location || {}).pathname)
ga(`send`, `pageview`)
}
Expand Down

0 comments on commit a10aed5

Please sign in to comment.