Skip to content

Connect Google Analytics

Connect a DevDeck project to a Google Analytics 4 (GA4) web data stream to track page views from the published production site.

DevDeck adds the Google tag to the production build and sends a page_view event when a visitor first opens the app or navigates to another client-side route. Analytics reports remain in Google Analytics.

What this connection does

The connection is for production page-view tracking. It does not give DevDeck or your generated app access to Google Analytics reports, and it does not create or modify Google Analytics accounts, properties, or data streams.

Before you begin

You need:

  • A Google Analytics account.
  • A GA4 property for the site you want to measure.
  • A Web data stream in that property.
  • Permission to configure the DevDeck project.

Step 1: Get your GA4 Measurement ID

A Measurement ID identifies the web data stream that receives your site's events. It starts with G-, for example G-XXXXXXXXXX.

  1. Sign in to Google Analytics.
  2. Select the account and GA4 property you want to use.
  3. Open Admin.
  4. Under Data collection and modification, select Data streams.
  5. Select the Web data stream for your app.
  6. Copy the Measurement ID shown in the stream details.

If you do not have a web data stream yet, select Add stream → Web, enter the production site URL and a stream name, and create the stream before copying its Measurement ID.

A Measurement ID is not a secret

Google Analytics places this ID in your site's browser code. It identifies the destination for analytics events, but it does not grant access to your Google Analytics account or reports.

Step 2: Connect Google Analytics in DevDeck

  1. Open the project in DevDeck.
  2. Select Connections.
  3. Find Google Analytics and select Connect. If it is already connected, select Configure to change the Measurement ID.
  4. Paste the GA4 Measurement ID into GA4 Measurement ID.
  5. Select Save.
  6. Publish the project to apply the connection to the production site.

DevDeck accepts IDs in the GA4 format G- followed by 4–20 uppercase letters or numbers. DevDeck checks the format, but cannot verify that the ID belongs to you or points to the intended data stream.

Publishing is required

Saving, changing, or disconnecting Google Analytics does not immediately change the live site. Publish the project again to update production tracking.

Step 3: Verify page views

After publishing:

  1. Open the published production site in a browser.
  2. Visit a few pages or navigate between routes.
  3. In Google Analytics, open Reports → Realtime.
  4. Confirm that an active user and page_view events appear.

Realtime events can take a few minutes to appear. Preview activity is not sent through this production connection.

Change or disconnect the connection

To use a different web data stream, open Connections, select Configure for Google Analytics, replace the Measurement ID, save, and publish again.

To stop production tracking, disconnect Google Analytics from Connections, then publish the project again. Disconnecting the project does not delete or disable the web data stream in Google Analytics.

Troubleshooting

The Measurement ID is rejected

Confirm that you copied a GA4 Measurement ID, not a property ID, stream ID, Google tag ID from another product, or account number. A valid value starts with G-.

No events appear in Realtime

Check the following:

  • The project was published after the connection was saved.
  • You opened the published production site rather than DevDeck preview.
  • The saved Measurement ID matches the intended web data stream.
  • An ad blocker, tracking protection, or consent configuration is not blocking googletagmanager.com.
  • You waited a few minutes and refreshed the Realtime report.

Page views appear twice

Do not add a second gtag.js snippet or another automatic page-view tracker to the generated app. DevDeck already installs page-view tracking for a connected production project.

You are responsible for configuring analytics in accordance with the privacy, cookie-consent, and data-protection requirements that apply to your site and its visitors.

For more information, see Google's guide to finding your Measurement ID.

Build and ship apps with DevDeck.