I am having trouble extracting unique page views that don't contain duplicates of the same page with added parameters.

Currently, I am extracting page views (Metric) with Dimension 'Page Title' and 'Page'

For example:

Let's say we have page views for the following address:


If a user searched for the term 'stamp' (in Google or internal search engine), a new set of page views is generated for the following address:


I am only interested in one set of data (page views) for that page. That is, I want to count the total page views, without having the data split up into multiple page views.

1 Answer 1


There's a couple ways to achieve this.

  1. Create an additional View in Google Analytics and apply a custom Search and Replace filter using RegEx. The idea is to target the parameter and remove it from the URL (known as Request URI in the filter settings) as the data is being process into GA. You won't lose the source URL data if you do this in a separate View from the main one in your GA property. This is the simplest and cleanest method. enter image description here

You can take this a step further, if you wanted to have your cake and eat it too. In addition to the first step, you could create a custom dimension in the GA property called 'Search Term', using your example above, and extract the parameter from the URL into the custom dimension. Now, you have clean URLs as well as the search term that referred the user to the page. enter image description here

  1. Create a custom dimension in Data Studio and use REGEXP_EXTRACT to remove the parameter. This is trickier to set up but it doesn't require touching Google Analytics at all. You should wrap each line in a CASE statement and include an ELSE for URLs that don't match the specified RegEx. enter image description here In the example above, I'm saying "when the Page URL has a parameter, then extract everything in the URL up to the '?'". I've identified the parameter by checking if the '?' is NOT the first character of the string value, that '?' is followed by word characters, then an '=', then additional characters after the equal sign. I'm extracting all the characters up to the first instance of '?'. The parentheses indicate the part you want to extract. '[^?]' means any character besides '?'.

Help links:

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.