-
-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
565-feat: Connect google analytics #698
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
π WalkthroughWalkthroughThe pull request introduces Google Analytics tracking to the Next.js application by adding the Changes
Assessment against linked issues
The implementation successfully adds Google Analytics tracking to the application, meeting the primary objective of issue #565. However, the current code does not explicitly handle tracking external links, which was mentioned in the additional context. π Recent review detailsConfiguration used: .coderabbit.yaml β Files ignored due to path filters (1)
π Files selected for processing (2)
π§ Files skipped from review as they are similar to previous changes (2)
β° Context from checks skipped due to timeout of 90000ms (2)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? πͺ§ TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
π§Ή Nitpick comments (1)
src/app/analytics.tsx (1)
19-20
: Consider externalizing the GA ID.
Itβs standard practice to store environment-specific tokens, likeG-THXM004SPR
, in environment variables (e.g.process.env
) for better maintainability.
π Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
β Files ignored due to path filters (1)
package-lock.json
is excluded by!**/package-lock.json
π Files selected for processing (3)
package.json
(1 hunks)src/app/analytics.tsx
(1 hunks)src/app/layout.tsx
(2 hunks)
π Additional comments (5)
src/app/analytics.tsx (2)
1-1
: Directive for client-side usage is appropriate.
Since this component depends on browser APIs (window.dataLayer
), 'use client'
is correctly specified.
7-16
: Ensure robust handling of window.dataLayer
.
Although this logic works correctly in a client component, consider verifying that window.dataLayer
is not overwritten by other scripts.
If you wish, I can generate a script to check for potential collisions with other scripts manipulating window.dataLayer
.
src/app/layout.tsx (2)
2-2
: New import declaration is well-structured.
The import from ./analytics
is clear and consistent with the project structure.
46-46
: Correct usage of <Analytics />
in layout.
Integrating <Analytics />
at the bottom of <body>
ensures that the rest of the layout is rendered first, which is suitable for analytics tracking.
package.json (1)
26-26
: Verify the stability of @next/third-parties
dependency.
Check if there are known issues with version ^15.0.2
to ensure long-term reliability.
Use this script to scan for potential advisories:
β Verification successful
@next/third-parties
dependency is stable and properly used
The package shows no security vulnerabilities, is being used correctly for Google Analytics integration, and is locked to a specific version (15.0.2) in package-lock.json. The dependency is part of the official Next.js ecosystem, making it a reliable choice.
π Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Checking for known vulnerabilities or updates in @next/third-parties
gh api graphql -f query='
{
securityVulnerabilities(first: 5, ecosystem: NPM, package: "@next/third-parties") {
nodes {
advisory {
summary
severity
publishedAt
}
vulnerableVersionRange
firstPatchedVersion {
identifier
}
}
}
}
'
Length of output: 353
Script:
#!/bin/bash
# Let's check the usage of @next/third-parties in the codebase
rg "@next/third-parties" -A 2
# Also check package-lock.json for current resolved version
rg '"@next/third-parties"' package-lock.json
Length of output: 1020
Lighthouse Report:
|
Lighthouse Report:
|
What type of PR is this? (select all that apply)
Description
Added custom
Analitics.tsx
component with GA tag.Related Tickets & Documents
Added/updated tests?
[optional] Are there any post deployment tasks we need to perform?
[optional] What gif best describes this PR or how it makes you feel?
Summary by CodeRabbit
New Features
Dependencies
@next/third-parties
package to support analytics functionality