'Calculated metric Google Data Studio
I'm trying to create a new metric in Google Data Studio. What I want to do is to have a metric that count the number of sessions to specific pages. Say I have two pages in Google Analytics and I want to calculate the sessions to these pages into one metric. I'm trying to do this with calculated fields in Google Data Studio but can't seem to get it right.
Here's my code so far:
CASE
WHEN sessioner IN
REGEXP_MATCH(page 1|page2) THEN "Name"
ELSE ""
END
Solution 1:[1]
I think you're trying to get something like the following:
CASE
WHEN REGEXP_MATCH(sessioner, "page 1|page2") THEN "Name"
ELSE ""
END
Where sessioner is your current page title dimension, "page 1" and "page2" are page titles and name is the new page title grouping.
Solution 2:[2]
I think you may be interested replacing 'sessioner' with a parameter for url like 'page path' or 'page title screen name' (for GA4).
Another option is to create a filter on your visual for including only those specific pages, that can be reused for other visuals as well, and will apply to any metrics you include (users, sessions, avg. sessions per user, etc).
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Bobbylank |
| Solution 2 |
