I've just launched my first experiment. Basically ...
# ask-questions
s
I've just launched my first experiment. Basically trying to test different sizes for our CTA button. The page is on /, but when you click on the button it goes to /newpage. We are using google analytics... I see I can choose page_view as a metric goal, but I don't quite understand how "page_view" works (page view appears to be a binomial)... Is it easy to create a metric where it is count of pageview=newpage? Or do I need to create a new metric in the app and send an event to GA?
f
Should be pretty easy to do that
the page view event in GA should have the actual page
so you can make a new metric for that particular page
s
Okay, I'll try to see how to do that
i'll try with this query builder
f
let me know if you need help with the query
s
Copy code
SELECT
  user_id,
  user_pseudo_id as anonymous_id,
  TIMESTAMP_MICROS(event_timestamp) as timestamp
FROM
  `pathology-699c4`.`analytics_341966914`.`events_*`
WHERE
  event_name = 'page_view'  
  AND event_params.key = 'page_location'
  AND event_params.value='<https://pathology.gg/tutorial>'
  AND _TABLE_SUFFIX BETWEEN '{{startYear}}{{startMonth}}{{startDay}}' AND '{{endYear}}{{endMonth}}{{endDay}}'
Is this hypothetically correct?
Cannot access field key on a value with type ARRAY<STRUCT<key STRING, value STRUCT<string_value STRING, int_value INT64, float_value FLOAT64, ...>>> at [11:24]
f
mostly - BigQuery does this weird storing JSON values thing, so if you’re referencing event_params.key, you have to expand the JSON
Copy code
UNNEST(event_params) AS page_view_params
then you can do where
page_view_params.key = "whatever"
(the UNNEST will go in the from section)
s
yeah i figured... getting another syntax error though
Copy code
SELECT
  user_id,
  user_pseudo_id as anonymous_id,
  TIMESTAMP_MICROS(event_timestamp) as timestamp,
  UNNEST(event_params) AS page_view_params
FROM
  `pathology-699c4`.`analytics_341966914`.`events_*`
WHERE
  event_name = 'page_view'  
  AND event_params.key = 'page_location'
  AND event_params.value='<https://pathology.gg/tutorial>'
  AND _TABLE_SUFFIX BETWEEN '{{startYear}}{{startMonth}}{{startDay}}' AND '{{endYear}}{{endMonth}}{{endDay}}'
Syntax error: Expected ")" but got keyword UNNEST at [5:7]
f
UNNEST goes in the from section
s
Ohhh my bad
lol
f
and event_params.key/value will need to change too the aliased name
page_view_params.key/value
s
Copy code
SELECT
  user_id,
  user_pseudo_id as anonymous_id,
  TIMESTAMP_MICROS(event_timestamp) as timestamp
FROM
  `pathology-699c4`.`analytics_341966914`.`events_*`,
  UNNEST(event_params) AS page_view_params
WHERE
  event_name = 'page_view'
  AND page_view_params.key = 'page_location'
  AND page_view_params.value = '<https://pathology.gg/tutorial>'
  AND _TABLE_SUFFIX BETWEEN '{{startYear}}{{startMonth}}{{startDay}}' AND '{{endYear}}{{endMonth}}{{endDay}}'
okay finally got it
Copy code
SELECT
  user_id,
  user_pseudo_id as anonymous_id,
  TIMESTAMP_MICROS(event_timestamp) as timestamp
FROM
  `pathology-699c4`.`analytics_341966914`.`events_*`,
  UNNEST(event_params) AS page_view_params
WHERE
  event_name = 'page_view'
  AND page_view_params.key = 'page_location'
  AND page_view_params.value.string_value = '<https://pathology.gg/tutorial>'
  AND _TABLE_SUFFIX BETWEEN '{{startYear}}{{startMonth}}{{startDay}}' AND '{{endYear}}{{endMonth}}{{endDay}}'
f
cool
s
hmm no results though 😕
maybe i have something off here... will debug further
f
you can run it, without the date placeholders, in your bigQuery console to figure out whats up
s
yeah i'm changing the page_view = to a LIKE
okay this is great... gonna create a bunch for different pages...
is there a way to generate a collection of metrics?
So I can add a collection rather than metrics one by one?
f
There are some ways to do this with variables
but the set is quite limited atm - what did you have in mind?
s
For example, I may have a collection of metrics for our multiplayer modes, single player, etc...
Maybe performance metrics
So it would be nice to be able to group metrics this way so when reviewing experiments it is a bit easier to filter
f
You might want to use dimensions or segments for doing that level of definitions
👀 1