Learn
Learn

How to load data from Google Analytics to Snowflake: The definitive guide

How to load data from Google Analytics to Snowflake: The definitive guide

September 20, 2023
September 20, 2023
How to load data from Google Analytics to Snowflake: The definitive guide
While you can move data from Google Analytics to Snowflake manually or with custom scripts, an automated data movement platform like Fivetran saves time, reduces errors, and scales easily.

Wouldn’t it be great if you could combine your website and marketing data with other sources, like your CRM, ERP and email marketing campaigns?

Unfortunately, Google Analytics doesn’t let you import more data, but you can transfer everything to a data platform like Snowflake and analyze it there.

The tricky thing is getting data from GA to Snowflake.

In this guide, you’ll learn several ways to load Google Analytics raw data to Snowflake, which is best and how to automate the process with Fivetran.

Why load Google Analytics data to Snowflake?

While Google Analytics 4 is decent, if you’re serious about analyzing and retaining data, you’ll want to move data into a data platform like Snowflake for several reasons:

  • Advanced analytics: Snowflake’s performance, scalability and SQL capabilities enable deeper, faster queries on user data than GA’s built-in dashboards.
  • Cross-platform consolidation: Snowflake lets you combine GA data with CRM, e-commerce and ad platforms to support comprehensive business analytics.
  • Data retention: Unlike GA’s limited retention (26 months), Snowflake stores raw data indefinitely, empowering long-term, seasonality and cohort analysis.
  • Machine learning algorithms: Data scientists can run predictive models and custom ML on consolidated behavioral data in Snowflake

Once it’s in Snowflake, you can combine your marketing data with other sources to create a single customer view, run multi-touch attribution campaigns or prevent churn.

How to load data from Google Analytics 4 to Snowflake

There are 3 ways to load data from GA4 to Snowflake:

1. Manually importing the data using Snowflake’s bulk upload feature.
• Slow, but not an overly complex/technical process.

2. Combining custom ETL scripts with other semi-automated methods
• Faster than the manual option, but highly technical

3. Automating data integration using dedicated platforms like Fivetran
• Quick and painless due to automations and pre-built connectors.

This table summarizes the benefits of each if you want to jump ahead to your preferred method.

Method How it works When to use it
Manual import Manually import local files into Snowflake. Small projects or one-off experiments
Custom ETL scripts Create a custom script to extract, transform and load data from GA to Snowflake Developers who need a free, custom solution
Fivetran Use Fivetran’s Google Analytics and Snowflake connectors to automate the process. Anyone who wants a streamlined and automated way to load data from GA to Snowflake

Not sure which is best? We’ll cover each of the methods in more detail below.

Prefer a no-code solution?

Fivetran’s prebuilt connectors for Google Analytics and Snowflake can handle authentication, schema mapping, and syncs automatically.

Try it out free for 14 days ->

Manual import: The low-code, time-intensive method

It’s possible to transfer data between these platforms by exporting data to CSV files and uploading them manually to Snowflake.

Here is a step-by-step process you can follow:

Step 1: Export reports from Google Analytics

Because exports are tied to reporting views in Google Analytics, it’s important to make sure to select or build the 1that can capture the data you need.

For example, downloading the “User acquisition report” will let you add traffic acquisition data to Snowflake. The engagement report, on the other hand, captures page views.

Here’s what you need to do:

  • Open Google Analytics
  • Select the report you wish to export
  • Click the “Share this report
  • Select “Download File
  • Click “Download as CSV
  • Save the file to your computer

Step 2: Prepare the file

Now you’ll want to clean the data ready for Snowflake:

  • Open the file in Excel or Google Sheets
  • Clean the data by:
    • removing redundant columns
    • resolving missing values
    • flattening data (if needed)
  • Save the cleaned file

Step 3: Upload the file to Snowflake

Loading local files like CSVs and JSON files to Snowflake requires 2 separate actions, as shown below:

First, upload your data to a Snowflake stage using the PUT command.

Second, load the stage files into your Snowflake database table using the COPY INTO command.

That’s it. You’ve manually uploaded data from GA to Snowflake.

The good news is you don’t have to repeat this process for every report. You can do this in bulk for multiple reports at once.

What are the pros and cons of manual data upload?

Manually loading data from Google Analytics to Snowflake may be suitable for a one-off project, but it’s not a long-term solution.

Here are the pros and cons of this method:

Pros Cons

A simple solution for small data sets

No coding skills necessary (but familiarity with Snowflake is essential)

Resource-intensive and time-consuming as data scales

Error prone and requires repeated manual intervention

Manual upload makes sense if you want to create a proof of concept or run a test. But it doesn’t work at scale and it isn’t suitable for non-technical users.

Custom ETL scripts: The semi-automated, code-heavy method

If you’d rather manually download and upload CSV files to Snowflake, a custom ETL script can automate the process.

Google’s Data API offers programmatic access to Google Analytics report data, meaning you can build a custom data pipeline with the API.

This is a highly technical method that requires you to write a significant amount of custom code. It’s not possible to show you what the code might look like — that will depend on your reports and GA account — but here are the steps you’ll need to follow:

Step 1: Set up Google Analytics API Access

Set up API access to Google Analytics by creating a project in the Google Cloud Console. This triggers the Google Analytics Data APIs and generates the appropriate credentials (such as OAuth2 tokens or service account keys) to allow secure authentication and data retrieval.

Step 2: Define your requirements

Next, determine which Google Analytics data points you want to extract. It’s important to decide how frequently the data should be refreshed (for example, daily, hourly, or in real time) and to design the target schema and tables that will be used in Snowflake.

Step 3: Write the script

Write a script in Python or a similar language to extract raw data from Google Analytics. It will require transformation to fit Snowflake’s tabular format. This can include:

  • Flattening nested JSON fields
  • Normalizing date formats
  • Filtering out unwanted fields
  • Applying business logic

It’s important to handle API failures, connection timeouts and data inconsistencies. Your script should log all operations for auditability and alert on failures for quick troubleshooting.

Step 4: Schedule and automate

Automate your ETL pipeline using schedulers and workflow orchestrators like Apache Airflow or cron jobs to enable it to run hourly, daily or weekly.

Step 5: Maintain and optimize

You’ll need to regularly update the pipeline to handle Google Analytics API changes, schema adjustments in Snowflake, and your evolving requirements.

What are the pros and cons of custom ETL scripts?

A custom ETL script might be a suitable choice for highly proficient programmers, but it’s certainly not for everyone.


Here are the pros and cons of this method:

Pros Cons

Custom ETL scripts are highly customizable, letting you extract the exact data you want

It’s completely free.

Data loads automatically as long as the script remains operational.

Requires extensive maintenance and technical proficiency.

Rate limits may restrict volume and frequency.

Sending login credentials in scripts increases security risk.

If you know how to code and want a free way to migrate Google Analytics data from Snowflake, then a custom ETL script could work.

Otherwise, you’ll want to look at 1of the automated methods below.

Fivetran: The fast, automated method

Fivetran’s data user-friendly and intuitive data integration tool makes it easy to load data from a connector source like Google Analytics to data cloud platforms like Snowflake.

You can see how the platform works in this video:

Fivetran comes with pre-built connectors for hundreds of sources and data warehouses, including Google Analytics and Snowflake.

Connecting the 2 simply requires setting up Google Analytics as a source and Snowflake as a destination.

Here’s how:

Step 1: Set up Google Analytics as a source

You’ll need to start by connecting Google Analytics as a data source.

Read our in-depth guide here, or watch the video below to see what the process looks like:

Step 2: Connect Snowflake as a destination

Next, set up Snowflake as the destination using the Snowflake connector.

Again, we have a detailed guide on exactly how to do this, or you can watch the video below to see what the process looks like:

That’s it. Fivetran will now continuously extract data from Google Analytics and load it into your target destination in Snowflake.

The platform handles incremental updates, schema changes, and most issues automatically, so your data stays fresh and reliable.

What are the pros and cons of using Fivetran?

Using Fivetran means your team can spend more time analyzing data and less time trying to get it from 1 platform to another.

But that’s not the only benefit. Here are the pros and cons of using Fivetran:

Pros Cons

Data ingestion without the need for manual scripts

Automated workflows with incremental updates reduce manual effort

Change data capture (CDC)

Near-real-time monitoring and alerts that flag errors as soon as they arise

Limited free plan.

It doesn’t work with Universal Analytics

Fivetran is ideal for any organization that wants to seamlessly and automatically replicate Google Analytics data into its Snowflake data warehouse with minimal effort and maintenance. It’s fast, easy and cost-effective.

Bonus: Pre-migration readiness checklist

  • Confirm admin access to:
    • GA4 property
    • Data stream
    • Snowflake account
  • Decide whether to migrate:
  • Raw event-level data
  • Aggregated reports
  • Both
  • Identify third-party dependencies that could break

(e.g.,BigQuery, Looker Studio, etc.)

  • Confirm your GA4 property ID is correct
  • Confirm your stream ID is correct
  • Back up existing:
    • Reports
    • Dashboards
    • Schema mappings
  • Notify stakeholders of potential downtime or data gaps
  • Document expected:
    • Data refresh frequency
    • Latency tolerance

Automate your GA4-to-Snowflake pipeline with Fivetran

Loading data from Google Analytics to Snowflake lets you consolidate marketing data with information from other business data and perform advanced analytics and custom reporting.

But writing a custom ETL script or doing it by hand are incredibly time-intensive processes. They’re far from automated, either.

Fivetran fixes that by letting you automatically, reliably and securely move data from 700+ sources, including Google Analytics and Snowflake.

[CTA_MODULE]

Start your 14-day free trial with Fivetran today!
Get started now
Topics
Share

Related posts

No items found.
No items found.
GCP vs AWS: A strategic cloud comparison for data teams
Blog

GCP vs AWS: A strategic cloud comparison for data teams

Read post
How to load data from google sheets to snowflake: ultimate guide 
Blog

How to load data from google sheets to snowflake: ultimate guide 

Read post

Start for free

Join the thousands of companies using Fivetran to centralize and transform their data.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.