hello@newnorth.nl+31 (0) 85 401 31 62
/Journal

Query parameters: how one page turns into a thousand rows

ReferenceAnalytics2023.01.30
Freek Kampen
Freek KampenCo-founder, New North Digital

Filters, sorting and click IDs split every page into dozens of variants in GA4. How to clean them up without wrecking attribution.

What a query parameter is

A query parameter is the bit after the question mark in a URL: a key, an equals sign and a value. Chain several together with an ampersand.

https://shop.com/shoes?colour=red&size=40

Your server reads them to filter, sort or search. Analytics and advertising tools read them to work out where a visitor came from.

Three kinds you will run into

  • Functional. ?colour=red, ?page=2, ?sort=price-asc. Part of how the site works.
  • Campaign. utm_source, utm_medium, utm_campaign, utm_content and utm_term. You add these yourself to attribute traffic.
  • Click IDs. gclid and wbraid from Google, fbclid from Meta, msclkid from Microsoft, ttclid from TikTok. The ad platform appends these for you.

Why your report falls apart

GA4 stores page_location with the full query string attached. Every unique combination becomes its own row.

A category page with four filters and three sort options therefore produces dozens of variants of the same page. Add click IDs, which are unique per click, and one page can occupy thousands of rows.

Two things break. Your pages report becomes unreadable, because traffic to a single page is spread across a hundred lines. And you run into GA4's cardinality limit, after which the remainder disappears into (other).

Cleaning up without wrecking attribution

GA4 has a setting for this. Admin, Data streams, your web stream, Tagging settings, then the option to remove unwanted query parameters from page URLs. You supply a list of parameter names and GA4 strips them from the reported URL.

Leave utm parameters and click IDs alone. GA4 needs them to determine source and campaign. Strip them and your attribution collapses into direct traffic.

Do clean up: CMS session IDs, filter and sort parameters, internal search parameters, and whatever your testing or personalisation tool appends.

If you would rather fix it at the source, build a GTM variable that rewrites page_location before the GA4 tag fires. That gives you more control and costs maintenance every time a new parameter appears. For most sites the GA4 setting is enough.

What to do with this

  • Open your pages report and look at the row count rather than the traffic. One page appearing fifty times tells you everything.
  • Add the common noise parameters to the GA4 setting. Start with your filters and sorting.
  • Do not touch utm or click IDs.
  • If you still need the full URL for analysis, use the BigQuery export. The raw page_location is there, and you can clean it per query with REGEXP_REPLACE.

Want to talk about this?

Let's talk data.

Tell us about your stack, your goals, the data you wish you had.

Takes 1 minute