Hello, I used this library in my react app (server side rendering) and I saw some error in my server when in production, it pointed in "react-ga.js" file, line 891. Error says "document is undefined".
Please help me with this, did I miss something for setup?
Update, I fixed the error by checking if document is undefined.
@kenjoe Hello. I am having the same problem.
Please tell me how to check.
Hi @kunmura I added if statement like this:
if(typeof window !== 'undefined' && typeof document !== 'undefined') {
// Your ReactGA initialization here..
}
@kenjoe Thank you so much!! i'll try it.
Most helpful comment
Hi @kunmura I added if statement like this:
if(typeof window !== 'undefined' && typeof document !== 'undefined') {// Your ReactGA initialization here..}