Export Hit Level Google Analytics Data to PostgreSQL
What is Google Analytics?
Google Analytics (GA) is a free tool provided by Google to capture visitor insights from your website. It can track the source of the visitor, pages visited and other activities. If you have setup your GA script on your website, then it sends information to Google Analytics.
What is PostgreSQL?
PostgreSQL is a powerful, open-source object-relational database system that uses and extends the SQL language combined with many features that safely store and scale the most complicated data workloads.
How to Export Hit Level Google Analytics Data?
Exporting raw hit-level data out of Google Analytics is very tricky because Google Analytics only makes aggregated data available from the API. Effectively, we end up downloading a Google Analytics report with each request. While we could find out the number of visitors in a particular segment on a particular day on our website and fetch a variety of metrics for those users (such as source/medium, browser, or session duration), we couldn’t get at the underlying, user-level data to follow an individual user’s journey.
Even the Premium version of Google Analytics also known as Google Analytics 360 does not give you the option to export Google Analytics Data to PostgreSQL database, You can try building your own solution but then you should be an expert in Google Analytics API, Transforming data received in JSON from Google Analytics to SQL Statements and then execute these SQL statements in your PostgreSQL database, and this is just the beginning, you must keep in mind that technologies like Google Analytics are evolving and you might find what was working yesterday might not work today. Trust me we have been following this space closely.
And so far we have just scratched the surface on how you can extract raw data from Google Analytics. It gets even more complicated when you integrate data from different marketing sources with Google Analytics. So instead of building and maintain your own solution or paying $150,000 for Google Analytics 360.
Enter Electrik.AI !!!
Electrik.AI’s Google Analytics Hit Level Data Extractor, exports raw un-sampled hit-level data from Google Analytics to PostgreSQL in just three easy steps.
Step 1: Setup your Google Analytics Account.
Step 2: Setup your PostgreSQL Database.
Step 3: Create a data flow to Export Hit Level Google Analytics data to PostgreSQL.
Your Google Analytics hit level data for each day will be exported to PostgreSQL Database after 24 hours.
Here is a sample of hit-level data exported from Google Analytics by Electrik.AI’s Google Analytics Hit-Level Data Extractor.
Session Id: 496802989.156996
Visitor Id: VIDbdf938fe-8e1f-597e-89aa-775a80d2aae6
Event Date: 10/2/2019
Event Timestamp: 2019-10-02T07:11:19.476+10:00
Event Date in UTC: 10/1/2019
Property Id: UA-34208182-1
View Id: 63209589
Hit Order: 1
Hit Type: pageview
Pageview Order: 1
Browser Size: 1900×980
Channel grouping: Direct
Data Source: web
Landing Pagepath: /
Network Domain: optusnet.com.au
Network Location: optus internet pty ltd
Page Title: Automate ETL Testing
Previous Pagepath: (entrance)
Region: New South Wales
Screen Resolution: 1920×1080
Session Duration: 472
Source Medium: (direct) / (none)
Time on Page: 34
User Type: New Visitor
You can view a list of all dimensions/metrics extracted from Google Analytics here.