How to use the Google Analytics 4 Query Explorer to export data

The Google Analytics Query Explorer lets you build precise API queries to pull exactly the data you need from your GA4 account, without writing a line of code.

If you've ever exported GA4 data through the standard interface and ended up with a flat report that doesn't update itself, you know the problem. The Query Explorer solves it: build the query once, test it, and connect it to your dashboard so the data flows automatically. No waiting for someone to pull a number. No pasting raw data into a spreadsheet and hoping nothing shifts.

What is the Google Analytics Query Explorer?

The Google Analytics Query Explorer is a browser-based interface that lets you build API queries to retrieve data from your Google Analytics 4 account. You choose the property, date range, metrics, and dimensions, run the query, and get back a structured data output you can connect to dashboards and reports.

Why use the Google Analytics Query Explorer?

GA4's built-in reports give you a starting point, but they're fixed. You can't easily pull custom combinations of metrics and dimensions, and the export options are basic. The Query Explorer gives you control over exactly what data you get, in a format that works with automated data connections.

That matters when you're making decisions based on your marketing numbers. If the data in your dashboard is stale, incomplete, or filtered differently than you expected, you're not working from a reliable picture. The Query Explorer lets you validate the query before it ever reaches your dashboard, so you know the numbers are right.

1.00

Benefits of using the Google Analytics Query Explorer

The Query Explorer offers several advantages over pulling data directly from the GA4 interface:

  • Flexibility in data extraction: GA4's event-based model opens up more granular analysis than Universal Analytics did. The Query Explorer lets you reach into that model and pull the specific combinations of data your reporting actually needs.

  • Advanced filtering and segmentation: Dimension and metric filters let you refine your data set before it reaches your dashboard, so you're not filtering manually after the fact.

  • Testing and validation: You see the output before you build anything. That means you can confirm the query returns what you expect, and that your GA4 data will work alongside other sources in a tool like Klips.

  • Automation and integration: The query produces a structured JSON output that connects directly to dashboard tools, replacing the manual step of pulling and pasting numbers.

  • Learning and exploration: Experimenting in the Query Explorer is one of the fastest ways to understand GA4's data model, which metrics and dimensions are compatible, and what the underlying data actually looks like.

How to use the Google Analytics Query Explorer for Google Analytics 4

Here's what the process looks like from start to finish:

  • Select a property
  • Select a date range
  • Select one or more metrics
  • Select one or more dimensions
  • Apply advanced filters
  • Test the query

Select a property

Choose the GA4 property you want to pull data from. This is the website, app, or digital asset tied to your Google Analytics 4 account.

1.00

Select a date range

Set the date range for your query. You can use fixed calendar dates (YYYY-MM-DD) or relative values like today, yesterday, or NdaysAgo. Google's DateRange documentation covers the full range of options.

1.00

Select one or more metrics

Metrics are the quantitative measurements in your query: the actual numbers. Examples include users, conversions, eventCount, and engagement rate. You can include multiple metrics in a single query.

1.00

Select one or more dimensions

Dimensions are the qualitative values that break your metrics into segments. A dimension of "Date" applied to the metric "Users" gives you a daily user count over your selected date range, rather than a single aggregate number.

1.00

Apply advanced filters

Filters let you narrow the data before it comes back. You can filter by dimension (for example, only include sessions where sessionDefaultChannelGrouping is Organic Search) or by metric (for example, only include pages above a certain user threshold). This is where the Query Explorer starts to earn its value for data for your marketing reporting.

1.00

Test the query

Click "Make Request" to run the query and see a sample output. Review the structure and confirm the data looks right before you connect it to anything. If a combination of metrics and dimensions returns an error, swap one out and try again.

1.00

Advanced tips for the Google Analytics 4 Query Explorer

The Query Explorer rewards a bit of preparation. These practices will save you time and keep your data reliable:

  • Plan before you build: Know which metrics and dimensions you need before opening the tool. A clear plan prevents errors and cuts down on back-and-forth testing.

  • Test every query before connecting it: Confirm the output looks right in the Query Explorer before you wire it to a dashboard. Catching a problem here is much easier than diagnosing it downstream.

  • Create multiple focused queries: It's tempting to build one query that covers everything. Resist it. Adding too many dimensions causes the data set to grow exponentially. Smaller, purpose-built queries are easier to maintain and more reliable.

  • Use GA4's event model deliberately: Custom dimensions and metric filters let you extract precise slices of data. Use them rather than pulling broad data sets and filtering later.

  • Register custom parameters as custom dimensions: If you've set up custom parameters in Google Tag Manager but don't see them in the Query Explorer, you'll need to register those parameters as custom dimensions in GA4 first.

  • Watch for data sampling: Large queries may trigger sampling in GA4. If you need precise numbers, adjust your date range or query scope to stay under the threshold.

  • Document your queries: Keep a record of what each query returns and where it connects. You'll thank yourself the next time you need to build something similar.

Klips logo Level up your decision making

Create custom dashboards for you and your team.

Get started with Klips

How to use the Google Analytics Query Explorer for Universal Analytics

Universal Analytics stopped collecting data on July 1, 2023. The Query Explorer still works for UA properties, which is useful if you need to pull historical data for comparison or long-term trend reporting.

Here's how to export Google Analytics data from the UA Query Explorer:

  • Select a view
  • Select a date range
  • Select metrics
  • Select dimensions
  • Export your Google Analytics data

Select a view

Choose the account, property, and view you want to pull data from. For most users, a view maps to a website. Select the main view your team uses for reporting, not a test or filtered view.

  • Click the Account menu and select an account.
  • Click the Property menu and select a property.
  • Click the View menu and select a view.

1.00

Select a date range

Set your date range using one of three formats. Check out Google's documentation to learn more:

  • Calendar date: such as 2021-01-31
  • Relative date: such as today or yesterday
  • NdaysAgo value: such as 30daysAgo or 7daysAgo

For most historical pulls, a fixed calendar date range gives you the most predictable results.

Select metrics

Every query needs at least one metric.

What is a metric in Google Analytics?

Metrics are quantitative measurements that represent user activity on your website: goals completed, number of users, page sessions, and so on. When you query a metric, the result is an aggregate value for the date range you selected.

For example, querying "users" for the past 7 days returns a single number representing total users over that period.

1.00

  • In the Metrics field, select one or more metrics.
  • Click the Run Query button to test.
  • If the query returns an error, swap out incompatible metrics and try again.

1.00

Select dimensions

Dimensions are optional, but skipping them limits what you can do with the data. Common dimensions include Date, Channel Grouping, Source/Medium, Country, and Goal Completion Location.

What is a dimension in Google Analytics?

Dimensions are qualitative values that describe and segment your metrics. Applying the "Date" dimension to a "Users" metric gives you a daily breakdown rather than a single total.

1.00

  • In the Dimensions field, select one or more dimensions.
  • Click the Run Query button to test.
  • If the query returns an error, swap out incompatible dimensions and try again.

Export your Google Analytics data

You have two options once the query runs cleanly.

Export as .tsv: Download the file and open it in Excel or Sheets. Good for one-time pulls or ad hoc analysis.

Copy the API request: Select "include access token," copy the query to your clipboard, and paste it into your browser to see the raw JSON output. That same query can connect to a dashboard tool like Klips to automate ongoing data retrieval. For a lean team, this approach means consistent, reliable numbers without pulling data manually every time.

  • Double-check all fields before running.
  • Click the Run Query button.
  • Export as .tsv or copy the API request to your clipboard.

Using filters and segments in Query Explorer

Filters and segments let you get specific with your data. A few examples of what that looks like in practice:

  • Analysing traffic from a single source, such as Facebook or Reddit
  • Looking at hourly traffic patterns to find the best time to push site updates
  • Grouping visitors by average time on page or number of visits

Using filters in Query Explorer

Filters refine the data your query returns. You can filter on metrics or dimensions, and each has six unique operators. Check out the filter operators documentation for more information.

For example, to isolate Facebook paid traffic, you would apply this filter:

ga:sourceMedium==facebook / cpc

1.00

You can go further: filter for sessions above a certain time-on-site threshold, or pages that exceed a minimum user count. The filter logic is flexible enough to support most segmentation needs.

Using segments in Query Explorer

Every segment available in your GA view is also available in the Query Explorer, including built-in segments, custom segments, and dynamic segments you define on the fly. Here's the documentation for your reference.

1.00

Get more from your web analytics data

The Query Explorer closes the gap between what GA4 collects and what your team actually sees. Build the query once, connect it to a dashboard, and the numbers stay current without anyone having to pull them.

Klips connects directly to GA4 via the Query Explorer, so your marketing dashboards reflect real data without manual effort. Explore how Klips handles automated data connections to see what that looks like in practice.

Published 2026-08-23

Klips logo

Build custom dashboards for you and your team.