Kill Your Google Analytics Data Silo for Better Customer Analytics

Kill Your Google Analytics Data Silo for Better Customer Analytics

Google Analytics: Yet Another Data Silo?

For digital marketers, Google Analytics needs no introduction. It’s the most popular analytics tool and often the first to be introduced to a company’s martech stack.

Google Analytics is a powerful tool by its own right. It makes it easy to get started on basic metrics. Advanced users can customize user segments and run multi-touch and multi-device attribution analysis. Finally, it is completely free until you decide to go enterprise (See this blog for the comparison among different analytics tools).

But here is Google Analytics’ limitation: it does not hold all data that you need to do your analysis. In other words, it’s yet another data silo you need to pull your data from.

While we marketers rely heavily on Google Analytics to make decisions, it is hardly the only data source. Here are examples of other data sources:

  • Ad performance data: Many companies advertise on multiple platforms: Google AdWords, Twitter Ads, Facebook and Instagram Ads, Bing Ads and so on. Doing analysis across these platforms is time-consuming, error-prone and exhausting.
  • Mobile and web product usage data: Many SaaS and E-Commerce marketers fail to measure the real ROI of their customer acquisition campaigns because they fail to incorporate product usage data into their analysis. Product usage data is often buried deep in databases and log files and is not exactly accessible for marketers (and hence not captured in Google Analytics or similar analytics tools).

Treasure Data as a Marketing Analyst’s Data Hub

Treasure Data provides a solid foundation to collect data coming from multiple data sources. Our 300+ connectors help both developers and marketers collect data into a single view, allowing your team to create an end-to-end customer profile view.

In the rest of this blog, I will show you how to import any report into Treasure Data in an automated fashion. The only things you need are Google and Treasure Data accounts, as well as a willingness to configure our pre-built script.

Importing Google Analytics Reports into Treasure Data: Step-by-Step

Get all necessary parameters. You need the following parameters:

Get Treasure Data blogs, news, use cases, and platform capabilities.

Thank you for subscribing to our blog!

  1. Google Analytics Profile ID
  2. Treasure Data API key
  3. Standalone Google Script Service with Analytics API enabled.

To get the Google Analytics Profile ID, go to the “Admin” tab and select the Account/Property/View combination that you want to report on. Then, check the URL of the page. The URL should look like:<ACCOUNT_ID>w<WEB_PROPERTY_ID>p<PROFILE_ID>/
What you need is <PROFILE_ID> here.

Next, you need to get Treasure Data’s API key. After signing up for the service, follow the instructions here to get the API key.

Finally, you need to get an instance of Google Script.

1. Make sure that you are logged in with your Google account with access to your Google Analytics.

2. Visit and enabled the Analytics API from here.

3. Visit and create a new standalone Google AppScript

4. Copy and paste this script into Google Script Editor.

5. The first several lines of the script needs to be configured by updating the values in the INPUT JSON. The definitions of the INPUT fields are as follows:

  • groupBy: The array of dimensions to group by the report. The full list of available dimension names is here. To save you some typing, the leading “ga:” can be omitted.
  • metrics: The array of measures/metrics to report. The full list of available metrics names is here. Again, no need to have the “ga:” prefix.
  • sortBy: The array of dimensions and metrics to sort by.
  • profileId: This is the Google Analytics Profile ID that you retrieved earlier.
  • databaseName: The name of the Treasure Data database.
  • tableName: The name of the Treasure Data table.
  • tdAPIKey: The Treasure Data API key that you retrieved earlier.

6. Select the “main” function from the dropdown and import data into Treasure Data: IMAGE

7. Check that the report was successfully imported into Treasure Data. It may take up to one minute for the data to become available.

And there’s your Google Analytics report data! Thanks to Google Analytics’ Core Reporting API, myriad reports can be imported into Treasure Data. See this page to learn more about customizing your reports.

8. Optionally, you can use Google Script’s Trigger function to automate the process. To do this, go to “Resources” -> “Current project’s triggers” -> “Add a new trigger”.

Now, this import will happen every night between 1am and 2am.

What’s Next?

Here at Treasure Data, we believe that teams can make better decisions quickly when they can access their data faster at scale, regardless of their roles. We have a growing list of CDP integrations that bring together all kinds of data into one place. If you and your team feel limited by your ability to access and analyze data, we’d love to chat with you. Also, you can learn more about CDPs and customer data integrations here.

Kiyoto Tamura
Kiyoto Tamura
Kiyoto began his career in quantitative finance before making a transition into the startup world. A math nerd turned software engineer turned developer marketer, he enjoys postmodern literature, statistics, and a good cup of coffee.