DEV Community

Discussion on: Setting Up Google Analytics with React Context in Next.js

Collapse
 
sonyarianto profile image
Sony AK

Nice article, but now I am using GA4, is there any difference on implementation for GA4?

Collapse
 
markkdev profile image
Mark Khuzam

Hi Sony,

This implementation focuses more on storing the user data in state and allowing you to make logging scalable throughout your entire application.

Using GA4 would only require extending the logging functions to accept data being passed in.

You can initialize GA4 in the same place as the tutorial, then when you have user data you can begin logging it to the GA4 api

Collapse
 
sonyarianto profile image
Sony AK

thank you :)