nextjs-google-analytics icon indicating copy to clipboard operation
nextjs-google-analytics copied to clipboard

Cannot read properties of null (reading 'events') while making production build

Open morwalz opened this issue 3 years ago • 1 comments

Why making production build i am getting this error. I placed the google analytics component in head section. TypeError: Cannot read properties of null (reading 'events') at usePageViews (/srv/habilelabs/production/frontend/node_modules/nextjs-google-analytics/dist/hooks/usePageViews.js:28:16)

morwalz avatar Aug 25 '22 20:08 morwalz

Moving it ouside of <Head /> fixed it for me

CallumJHays avatar Oct 10 '22 02:10 CallumJHays

Hi!

Sorry for the late reply.

Which version are you using?

Could you share a reproducible example?

MauricioRobayo avatar Oct 30 '22 02:10 MauricioRobayo

I believe this might be related to some bad documentation the project used to have.

Could you try upgrading to the latest version and going through the Readme again, the usage has been simplified.

MauricioRobayo avatar Oct 30 '22 10:10 MauricioRobayo

Is it ok to close this issue?

MauricioRobayo avatar Nov 21 '22 02:11 MauricioRobayo

Yeah she'll be 'right

CallumJHays avatar Nov 21 '22 23:11 CallumJHays