DEV Community


Discussion on: Google Analytics with react-router v4

nodefiend profile image
chowderhead Author

Nice observation !

I actually didn’t even plan for google to fail at anything hahahahaha

But , luckily this method will be unphased by google analytics failing because what it’s doing is checking to see if the ga function is loaded in the first place .

If you look at trackgoogleanalytics() you can see that the first conditional checks if the method is attached to the window object , if not then none of the code runs

Forem Open with the Forem app