Google Analytics

Learn how to add Google Analytics to your project.

Note

You can choose to skip these instructions if you are not interested in using Google Analytics.

Note

You can view more complete instructions on how to setup Google Analytics here.

Setup

Google Analytics is a web analytics service provided by Google.

To get started, go to Google Analytics and sign in with your Google account.

Click on "Start measuring", and fill out the form to describe your website and define a property name (e.g. "My Website").

Then, create a data stream for your website, and copy the "Measurement ID" (e.g. "G-1234567890") to a separate file:

env.txt
NEXT_PUBLIC_GA_TRACKING_ID="your-measurement-id"

Note

You do not need to use these environment variables in your local development environment. They are only used in your production environment.

When you are ready to deploy your project, you can add these values to your environment variables in your hosting provider.

On this page