OWOX Data Marts — the new open-source analytics platform. Learn more at docs.owox.com

7. Geo

NEW documentation: This article covers setup for OWOX BI. For the latest guides on setting up FREE connectors and Data Marts, visit the new OWOX Data Marts documentation.

Use the SQL code below and change {{projectId}} and {{datasetName}} to your own.

#Geo object
WITH 
  #Set the date range for the calculation
    dates as 
      ( 
        SELECT
          '20220901' AS date_start,
          '20220930' AS date_end,
      )

SELECT
  CAST(FARM_FINGERPRINT(CONCAT(
    IFNULL(geoNetwork.country,""),
    IFNULL(geoNetwork.region,""),
    IFNULL(geoNetwork.city,""))) as STRING) as geoHash,
  geoNetwork.country,
  geoNetwork.region,
  geoNetwork.city
FROM
  dates as d, `{{projectId}}.{{datasetName}}.ga_sessions_*` 
WHERE 
  _TABLE_SUFFIX BETWEEN d.date_start and d.date_end
GROUP BY 1,2,3,4

 

You will get the data in the table 'geo' with the schema below:

Field name Type  
geoHash STRING  
country STRING  
region STRING  
city STRING  

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.