Created
September 18, 2018 10:14
-
-
Save maxim-uvarov/b29440aa641253afbc4b7fccf4639e24 to your computer and use it in GitHub Desktop.
other
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT | |
REGEXP_EXTRACT(hits.page.pagePath, r'([^?&#]*)')AS landing_Page, | |
trafficSource.medium AS medium, | |
trafficSource.source AS source, | |
device.deviceCategory AS deviceCategory, | |
hits.contentGroup.contentGroup1 as contentGroup1, | |
date, | |
(SELECT x.value FROM UNNEST(hits.customDimensions) x WHERE x.index = 4) as type, | |
COUNT(totals.bounces) AS Bounces, | |
Count(totals.transactions) as transactions, | |
COUNT(totals.hits) AS Entrances | |
FROM | |
(Select * from `somehost.ga_sessions_201808*` | |
Union all | |
Select * from `somehost.ga_sessions_201809*`) AS GA, | |
UNNEST(GA.hits) AS hits | |
WHERE | |
hits.type="PAGE" AND hits.hitNumber=1 and trafficSource.medium = 'organic' | |
GROUP BY | |
landing_Page, medium, source, date, deviceCategory, contentGroup1, type | |
ORDER BY | |
Entrances desc limit 1000 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment