Setting Up Google Analytics
Follow these steps to integrate Google Analytics.
Step 1: Create a Google Analytics Account
- Go to the Google Analytics website.
- Sign in with your Google account and create a new property for your website.
- In the left-hand menu, navigate to Admin > + Create and select Property.
- You’ll receive a Measurement ID (e.g.,
G-XXXXXXXXXX
).
Step 2: Add Measurement ID to .env.local
- In your project’s
.env.local
file, add the following environment variable:NEXT_PUBLIC_GOOGLE_ANALYTICS=G-XXXXXXXXXX