Dynamic Web Lab

How to Generate a Manual GA4 Access Token for Lean GA4 Tracker

If you’re using Lean GA4 Tracker and want to unlock the built-in analytics dashboard and charts, you’ll need to provide a Manual GA4 Access Token. This access token allows the plugin to securely request reporting data from the Google Analytics Data API (such as users, pageviews, events, and WooCommerce sales).

Without the token, your dashboard will only show placeholders instead of live stats.

In this guide, we’ll show you step-by-step how to generate the token and connect it to Lean GA4 Tracker.


What Is a Manual GA4 Access Token?

  • It’s a short-lived key that grants read-only access to your Google Analytics 4 property.
  • It does not modify your analytics data — it only allows the plugin to fetch metrics.
  • For now (MVP release), tokens expire after about 1 hour. In future versions, Lean GA4 Tracker will support automatic refresh via OAuth.

Prerequisites

Before you begin, make sure you have:

  • Access to your Google Analytics 4 property.
  • Your GA4 Property ID (numeric, e.g. 123456789).
  • A Google account with at least Viewer access to that property.
  • Access to Google OAuth 2.0 Playground.

Step-by-Step Guide

  1. Go to Google OAuth 2.0 Playground.
  2. In Step 1: Select & Authorize APIs, paste the following scope:
https://www.googleapis.com/auth/analytics.readonly
  1. Click Authorize APIs and sign in with your Google account.
  2. After authorization, copy the Authorization Code.
  3. In Step 2, click Exchange authorization code for tokens.
  4. You will see an Access Token (and possibly a Refresh Token).
  5. Copy the Access Token.
  6. Go to your WordPress Admin → Settings → Lean GA4 Tracker → Authentication.
  7. Paste the token into the Manual GA4 Access Token field.
  8. Save your changes.

Now return to the Dashboard tab in Lean GA4 Tracker, and you should see live GA4 stats and charts.


Important Notes

  • Token Expiration: Access tokens typically expire in about 1 hour. You’ll need to generate and paste a new one when this happens (for MVP).
  • Read-Only Access: The scope used only grants analytics read access, so your data is safe.
  • Property ID Required: Make sure the GA4 Property ID field in settings is also filled out.

Coming Soon

We’re actively working on:

  • Automatic OAuth authentication with token refresh.
  • More WooCommerce eCommerce reports.
  • Date range selectors and trend charts.

FAQ

Q: Do I need a token if I only want to send events?

No. Sending events to GA4 only requires the Measurement ID. The token is only for reporting features (dashboard, charts).

Q: Where do I find my GA4 Property ID?

Go to Google Analytics → Admin → Property Settings. The ID looks like a string of digits (e.g. 345678912).

Q: Is the token safe?

Yes, but treat it like a password. The plugin uses it securely for read-only API calls. Never share it publicly.


👉 That’s it! You now know how to generate and use a Manual GA4 Access Token with Lean GA4 Tracker.


How to Generate a Manual GA4 Access Token for Lean GA4 Tracker – Lean GA4 Tracker Documentation