Hiya, I want a metric of how many times a user cli...
# announcements
b
Hiya, I want a metric of how many times a user clicks a button. If I choose “count” as the metric type, the dialog says I need to return a “value” column. However there isn’t any “value” for the button, only the event that it was clicked. How should I set this up please? (also, thank you so much for the assistance!) Here’s the metric SQL:
SELECT
user_id,
user_pseudo_id as anonymous_id,
TIMESTAMP_MICROS(event_timestamp) as timestamp
FROM
``analytics_xxx.events_*``
WHERE
event_name = 'Main CTA'
AND _TABLE_SUFFIX BETWEEN '20230313' AND '20230319'
Ah! Looks like this maybe works:
SELECT
user_id,
user_pseudo_id as anonymous_id,
TIMESTAMP_MICROS(event_timestamp) as timestamp,
1 as value
FROM
``analytics_xxxxxx.events_*``
WHERE
event_name = 'Main CTA'
AND _TABLE_SUFFIX BETWEEN '20230313' AND '20230319'
h
yep! that should work!
We'll just do
SUM(value)
under the hood to get the total per user (or another custom aggregation if you specify one).
b
Thanks! Hmm, my metric looks good, but the experiment isn’t returning any rows…
I now have one experiment using the “Main CTA conversion” which is binomial, and that is showing data. But my second experiment is using “Main CTA count” as its metric and is finding no rows…
h
there should be rows if there are any users in the experiment.
b
I am a numpty, I had the wrong experiment id… 🙂