Reputation: 105
I'm trying to generate a simple report in Google Data Studio that will report back all page views and events on a certain type of "Page" (those that contain /apply/
)
The report works fine, but the "Page" URLs make it difficult to read the report. The Page Titles are unfortunately all the same, so I'm trying to turn the URL into something more readable.
All the page results currently look something like this in Google Analytics and Google Data Studio:
/apply/?job-title=Reindeer+Trainer+-+North+Pole
/apply/?job-title=Wicked+Witch+-+Over+The+Rainbow
/apply/?job-title=Tooth+Fairy+-+Linen+Closet
I'd like to have the report show something like:
Reindeer Trainer - North Pole
Wicked Witch - Over The Rainbow
Tooth Fairy - Linen Closet
Would I need to do a calculated field and then just do a replace function to remove all the unwanted characters, and if so, would I then need to still have the page result visible in order for the PageViews
and Events
to show up accurately? Or would I need to do something totally different?
Upvotes: 1
Views: 111
Reputation: 6482
This REGEXP_EXTRACT
and REGEXP_REPLACE
formula does the trick:
REGEXP_REPLACE(REGEXP_EXTRACT(Page, "^/apply/.*=(.*)$"), "\\+", " ")
Formula Breakdown:
A two step process; the new additions to the formula are marked in Bold:
1) REGEXP_EXTRACT
: Captures all the text after the =
, however, only for pages that begin with /apply/
;
2) REGEXP_REPLACE
: Replaces the +
with a space.
REGEXP_EXTRACT(Page, "^/apply/.=(.)$")
REGEXP_REPLACE(
REGEXP_EXTRACT(Page, "^/apply/.*=(.*)$")
, "\\+", " ") `
Google Data Studio Report (Google Sheets Embedded) to demonstrate.
Upvotes: 1
Reputation: 5208
You are on the right track. Create a new calculated field using the "page" dimension and replace. You won't need to have the "page" dimension visible after that.
Upvotes: 2