feat(analytics): integrate Google Analytics (Closes #40)#98
Merged
priyankarpal merged 4 commits intoOct 25, 2025
Conversation
Resolves reactplay#40. Adds Google Analytics using @next/third-parties/google. Tracks page views automatically and adds custom event tracking for key CTA buttons.
✅ Deploy Preview for reactkolkata ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
Author
|
@priyankarpal The build failure is fixed now. This PR should be ready to merge. Please let me know if you need the actual Google Analytics ID added before merging, or if it will be configured later in the deployment settings. |
removed package-lock.json Signed-off-by: Priyankar Pal <88102392+priyankarpal@users.noreply.github.com>
priyankarpal
approved these changes
Oct 25, 2025
Member
priyankarpal
left a comment
There was a problem hiding this comment.
looks good 🎉 adding env to the cloud provider
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves #40. Adds Google Analytics using @next/third-parties/google. Tracks page views automatically and adds custom event tracking for key CTA buttons.
Summary
This PR integrates Google Analytics 4 (GA4) into the application using the official
@next/third-parties/googlepackage. It fulfills Issue #40 by tracking page views, event clicks, and engagement without affecting performance.Changes
@next/third-partiespackage.NEXT_PUBLIC_GA_IDto.env.local(currently using a placeholder).<GoogleAnalytics />component tosrc/app/[locale]/layout.tsxto enable automatic page view tracking.trackGAEventinsrc/utils/analytics.tsfor sending custom events.trackGAEventcalls (with"use client";) to track clicks on:navbar/index.tsx).hero/index.tsx).footer/index.tsx).Testing
I tested these changes locally by:
docker-compose up.google-analytics.com.gtag/jsandcollectrequests were sent on page load and on client-side navigation (clicking navbar links).collectrequests were sent immediately upon clicking the tracked buttons (Join Community, See Events, Social Icons).Related Issue
Resolves #40
Notes
NEXT_PUBLIC_GA_IDenvironment variable. The actual Measurement ID needs to be provided and configured in the deployment environment for data to appear in the real GA dashboard.