I am working with the GoogleAnalytics data in the BigQuery. I want to output 2 columns: specific event actions (hits) and custom dimension (session based). All that, using Standard SQL. I cannot figure out how to do it correctly. Documentation does not help either. Please help me. This is what I am trying:
SELECT
(SELECT MAX(IF(index=80, value, NULL)) FROM UNNEST(customDimensions)) AS is_app,
(SELECT hits.eventInfo.eventAction) AS ea
FROM
`table-big-query.105229861.ga_sessions_201711*`, UNNEST(hits) hits
WHERE
totals.visits = 1
AND _TABLE_SUFFIX BETWEEN '21' and '21'
AND EXISTS(SELECT 1 FROM UNNEST(hits) hits
WHERE hits.eventInfo.eventCategory = 'SomeEventCategory'
)