AnalyticsGoogle Analytics

Setting Up Google Analytics

Follow these steps to integrate Google Analytics.

Step 1: Create a Google Analytics Account

  1. Go to the Google Analytics website.
  2. Sign in with your Google account and create a new property for your website.
  3. In the left-hand menu, navigate to Admin > Data Streams.
  4. Click on “Create Stream” and select the Web option.
  5. Enter your website URL and stream name, then click “Create Stream.”
  6. You’ll receive a Measurement ID (e.g., G-XXXXXXXXXX).

Step 2: Add Measurement ID to .env.local

  1. In your project’s .env.local file, add the following environment variable:
    NEXT_PUBLIC_GOOGLE_ANALYTICS=G-XXXXXXXXXX