GA Dev Tools: Google Analytics Tools for Developers
GA Dev Tools (ga-dev-tools.google) is Google's free set of demos and tools for developers working with Google Analytics 4: the Campaign URL Builder, Event Builder, Dimensions & Metrics Explorer, Query Explorer and an Enhanced Ecommerce demo. Pair them with GA4's developer APIs (the Measurement Protocol for sending events from servers and the Data API for pulling reports) and DebugView for checking events live. If GA4 isn't a fit, developer-friendly web analytics tools such as PostHog, Plausible and Umami are covered at the end.
Everything below reflects GA4 as of October 2026. Universal Analytics stopped processing data in July 2023 (July 2024 for paid 360 properties), so ignore any guide that tells you to use "UA-" IDs, the old Hit Builder or the Core Reporting API v3.
The GA4 tools on ga-dev-tools.google
| Tool | What it does | When to use it |
|---|---|---|
| Campaign URL Builder | Adds UTM parameters to a URL | Tagging links in emails, ads, social posts, launches |
| Event Builder | Builds, validates and sends Measurement Protocol events | Testing a server-side event before you write code |
| Dimensions & Metrics Explorer | Lists the API names of every dimension and metric, including your custom ones | Finding the exact name (sessionSource, activeUsers) for an API query |
| Query Explorer | Runs Data API reports against your property in the browser | Prototyping a report and copying the request JSON |
| Enhanced Ecommerce | A demo store showing GA4 ecommerce events | Seeing what view_item, add_to_cart and purchase look like |
The Event Builder, Dimensions & Metrics Explorer and Query Explorer need you to sign in with a Google account that has access to a GA4 property. The site's source is on GitHub.
Campaign URL Builder: tag links with UTM parameters
GA4 reads these parameters from the landing page URL and fills in the traffic source reports:
| Parameter | Required | Example |
|---|---|---|
utm_source |
Yes | newsletter, x, devhunt |
utm_medium |
Yes | email, social, referral, cpc |
utm_campaign |
Yes | oct-launch |
utm_id |
No | launch-2026-10 |
utm_term |
No | Paid search keyword |
utm_content |
No | header-link vs footer-link |
Example output:
https://example.com/pricing?utm_source=newsletter&utm_medium=email&utm_campaign=oct-launch
Tips: keep values lowercase (GA4 treats Email and email as different values), never put UTM tags on links between your own pages (they overwrite the visit's real traffic source), and keep a shared list of the source and medium names your team uses.
Send events from a server: the Measurement Protocol
The Measurement Protocol lets a backend send events to GA4, for example a purchase confirmed by a payment webhook or a signup completed through an API.
- In GA4, go to Admin > Data collection and modification > Data streams, pick your web stream, open Measurement Protocol API secrets and click Create (sending events).
- Copy your Measurement ID (
G-XXXXXXX) from the same stream. - Read the visitor's
client_idfrom the_gacookie in the browser (or withgtag('get', 'G-XXXXXXX', 'client_id', cb)) and store it with the user or order, so server events join the same user. - Send the event:
curl -X POST "https://www.google-analytics.com/mp/collect?measurement_id=G-XXXXXXX&api_secret=YOUR_SECRET" \
-H "Content-Type: application/json" \
-d '{
"client_id": "123456789.1700000000",
"events": [{
"name": "purchase",
"params": { "currency": "USD", "value": 49, "transaction_id": "T-1001" }
}]
}'
- Test first against the validation endpoint,
https://www.google-analytics.com/debug/mp/collect, which returns validation messages instead of recording the event. The Event Builder does the same thing in a form.
Limits worth knowing: up to 25 events per request, 25 parameters per event, event names of 40 characters or fewer, and a body under 130 kB. Google also notes that the Measurement Protocol is meant to add to on-site tagging (gtag.js or Tag Manager), not replace it: events sent only from a server get partial reporting. Keep the API secret on the server; never ship it in browser code.
Pull reports with the GA4 Data API
The Google Analytics Data API returns the same numbers as the GA4 interface. Its main method is runReport. A minimal Node.js example with the official client:
// npm install @google-analytics/data
const { BetaAnalyticsDataClient } = require('@google-analytics/data');
const client = new BetaAnalyticsDataClient(); // uses GOOGLE_APPLICATION_CREDENTIALS
async function main() {
const [report] = await client.runReport({
property: 'properties/123456789',
dateRanges: [{ startDate: '28daysAgo', endDate: 'today' }],
dimensions: [{ name: 'sessionSource' }],
metrics: [{ name: 'activeUsers' }],
limit: 10,
});
for (const row of report.rows ?? []) {
console.log(row.dimensionValues[0].value, row.metricValues[0].value);
}
}
main();
Setup steps:
- Create a Google Cloud project and enable the Google Analytics Data API.
- Create a service account and download its JSON key; point
GOOGLE_APPLICATION_CREDENTIALSat it. - In GA4, Admin > Property access management, add the service account's email as a Viewer.
- Use the numeric Property ID (from Admin > Property details), not the
G-measurement ID.
Build the query in Query Explorer first, then copy the dimension and metric names into code. The Data API has per-property token quotas, so cache results instead of querying on every page view. For configuration tasks (creating properties, streams, custom dimensions), use the separate Admin API.
Check events live with DebugView
Before trusting any new event, watch it arrive:
- Turn on debug mode: use Tag Assistant on your site, or add
debug_mode: trueto yourgtag('config', ...)call (remove the parameter afterwards; setting it tofalsedoesn't turn it off). - In GA4, go to Admin > Data display > DebugView (DebugView help).
- Trigger the event on your site. It shows in the seconds stream within a few seconds, with its parameters.
Events won't appear if consent mode is active and you haven't accepted analytics cookies, or if an ad blocker stops the request, which is a common "it doesn't work" cause during testing.
GA4 gotchas for developers
- Data retention defaults to 2 months for event-level data in explorations. Change it to 14 months in Admin > Data collection and modification > Data retention.
- Single-page apps: GA4's Enhanced Measurement can track history changes as page views. If you also send manual
page_viewevents on route changes, you'll double count. Pick one. - Ad blockers and consent remove a noticeable share of traffic from any client-side analytics, so GA4 numbers will be lower than server logs.
- Thresholding: GA4 can hide rows with small user counts in some reports, which surprises people on low-traffic sites.
Web analytics tools developers prefer
GA4 is free and strong for marketing attribution, but many developer teams choose something lighter or more product-focused:
| Tool | Why developers pick it | Open source / self-host |
|---|---|---|
| PostHog | Product analytics, session replay, feature flags and experiments in one | Yes |
| Plausible | Simple, cookie-free traffic dashboard | Yes (Community Edition) |
| Umami | Lightweight, cookie-free, easy to self-host | Yes |
| Matomo | Full GA-style suite you can host yourself | Yes |
| Cloudflare Web Analytics | Free, privacy-first basics for any site | No |
For prices, free tiers and a side-by-side of ten services, see our web analytics services comparison. For more options, browse free Google Analytics alternatives and DevHunt's analytics tools.
FAQ
What is GA Dev Tools?
It's Google's site of demos and tools for Google Analytics developers, at ga-dev-tools.google. The GA4 section includes the Campaign URL Builder, Event Builder, Dimensions & Metrics Explorer, Query Explorer and an Enhanced Ecommerce demo. It's free, and its source code is public on GitHub.
How do I use the Google Analytics campaign URL builder?
Open the GA4 Campaign URL Builder, enter the page URL, plus utm_source, utm_medium and utm_campaign (and optional term, content and ID), then copy the generated link. GA4 attributes visits from that link to the source, medium and campaign you entered.
Is there a Google Analytics API for developers?
Yes. The Measurement Protocol sends events to GA4 from servers or devices, the Data API reads report data, and the Admin API manages accounts, properties and settings. All work only with GA4 properties.
How do I test Google Analytics events without polluting data?
Send Measurement Protocol events to the /debug/mp/collect validation endpoint, or use the Event Builder, which validates them. For on-site events, enable debug mode and watch DebugView. Many teams also use a separate GA4 property for staging.
Is Google Analytics free for developers?
The standard GA4 product is free. Google Analytics 360 is the paid enterprise version with higher limits and an SLA, sold through Google's sales team.