For example, you want to get query parameters from URLs like this:
www.mystore.com/search?q=shoes&color=red
To simplify the process I use Google Sheets as a data source. But you can use raw data from Google Analytics as well:
When we have this data in Google Data Studio our goal is to have query parameter as separate columns in our report like this:
To do this we have to create, a new field, and use REGEXP to extract the data from URLs:
In code below "q" is the query parameter you want to extract for example "color":
REGEXP_EXTRACT(URL, 'q=([^&]+)')
~~~~
If you use Google Analytics as a data source, change the URL with PAGE dimension:
REGEXP_EXTRACT(Page, 'q=([^&]+)')
~~~~
Now we can create reports based on new fields:
Top comments (1)
This looks very close to what I need.
We have a search page that may have one or more of a collection of about 12 url params added to it, depending on optional settings a user may select when they run a search.
I'm setting these up as follows
REGEXP_EXTRACT(Page, 'swimmingpool=Yes')
Does that look right? And then I'd add them as a "metric" to my report ?