teena
teena

Reputation: 21

Google Data Studio: How to combine trailing slash + non-trailing slash URLs?

I'm using Google Data Studio to create a dashboard for my Google Analytics data.

I'm trying to find the number of users visiting a Page, so I used Regex as seen:

1

But instead I got 2 urls (trailing slash & non-trailing slash) - screenshot:

2

Leading me to...

My 2 questions:

  1. How do I combine both urls into 1 url?
  2. And is it possible to apply this (combining trailing slash & non-trailing slashing urls) as a rule across all urls?

Upvotes: 2

Views: 2462

Answers (3)

techscolasticus
techscolasticus

Reputation: 97

If you have unique page titles for the pages in question, you can use that dimension instead of using page and creating a regex replace fx to combine into one. Using page titles also combines data for 1 URL with different parameters.

Upvotes: 1

Alistair
Alistair

Reputation: 491

You could create a new dimension and use REGEXP_REPLACE to remove the trailing slashes.

REGEXP_REPLACE(Page,"/$","")

Upvotes: 1

Nimantha
Nimantha

Reputation: 6471

It can be achieved by using the REGEXP_REPLACE Calculated Field below (which removes the last / (trailing forward slash) when it's present):

REGEXP_REPLACE(Page, "(/)$", "")

Editable Google Data Studio Report (Embedded Google Sheets Data Source) and a GIF to elaborate:

Upvotes: 6

Related Questions