问题
On a particular type of page, I have an event that fires every time someone enrolls in a product. The event is:
Category: Enroll
Action: < Name of Product >
Label: enroll
I am able to create a report that lists the number of times the event was fired on Pages by using the metric of total events
and filtering by the label enroll
This gives the page that it was fired on and the count of the event.
I'm now trying to do conversion rate. So, I'd want to get
(Total Events on the page (filtered by Event Label="enroll")) / Unique Pageviews
I can't figure out how to do the total events filtered in Data Studio using a calculated metric. Is there a good way to do this?
回答1:
Try using REGEXP_MATCH in the sum of a case statement to achieve what you need.
Creating a metrics as follows and then do the division by unique pageviews as a second metric.
SUM(case when REGEXP_MATCH(Event Label, "enroll") then 1 else 0 end)
来源:https://stackoverflow.com/questions/52822231/filtering-data-in-a-custom-metric