1. Home
  2. Knowledge Base
  3. Importing Data
  4. [Online] – How To Add Data From Google Analytics
  1. Home
  2. Knowledge Base
  3. Google Analytics [UA + GA4]
  4. [Online] – How To Add Data From Google Analytics

How To Add Data From Google Analytics (UA and GA4, API + BigQuery)

To  add data from Universal Analytics using the Google Analytics Reporting API, or to get data from GA4 using the Google Analytics Data API, follow the instructions as outlined below.  

To get data from the GA4 BigQuery Event Export, follow the more detailed instructions found here, which include connecting Analytics Canvas to your GA4 BigQuery project. 

To begin, drag and drop a Google Analytics block on to your Canvas.

Image

Next select from one of three options: 

  1. GA4 BigQuery event data import 
  2. GA4 Data API import
  3. Universal Analytics API Import (available until June 30th, 2024) 
Image

If you select an API for data import, you will automatically be prompted to add a Google account if you do not already have one authorized.  

 

Image

Authorize the connector, ensuring that you select all 3 checkboxes to provide READ access to your data, and upon completion, you will be able to query from any Google Analytics account that the authorized Google account has access to.  

Image

Using the GA4 Data API with Analytics Canvas

Having permitted an account that has access to GA4 properties, you will now see the query wizard.  The first step is to select one or more properties from one or more Google accounts. 

If you work with a number of GA4 properties, you can work with groups of accounts by uploading a list of Property IDs from a CSV file rather than selecting them each time.  To use this feature, click "Upload File" and follow the instructions. 

When you have finished adding properties, click "Next Step: Query Edit"

Image

Having selected the properties to query over, it is now time to define the query.  Google limits your query to 9 dimensions and 10 metrics.  

However, not all dimensions and metric combinations are valid.  Click the Validate Query button prior to proceeding to determine if your query is valid before you complete the block configuration.

⚠️

Google Analytics 4 API calls are limited to 9 dimensions and 10 metrics per query. There is no way to include 'all' dimensions and metrics in your query. Your reports will require multiple queries, which can all be made in the same workflows. 

Image

Use the Custom Dimensions and Metrics tab to enhance your query with any of your custom fields.  The Additional columns tab contains meta data that can be included as data in your tables. 

Once your query is configured with at least 1 metric, click "Next Step: Date Range"

Image

At this final step you will provide a name for your Table and define the date range.

You can select from a fixed date range that will deliver data from a defined time period, OR you can select the "Start date to now" option.

When you choose the 'Start date to now' option, data will be loaded and retained within your subscription from that start date forward.

This approach aligns with the recommended way to extract GA4 (Google Analytics 4) data from the API as it prevents you from asking for the same data more than once.

Due to the token system in place, each API request consumes tokens from a fixed token pool for the property. By storing the historical data that will no longer change, you can save significant query processing costs, enabling you to work within the token limit.

🔗

If you are having issues with loading data due to the GA4 API token limits, refer to this article in our knowledge-base.

Image

When you are ready, click "Next Step: Submit". The data will then be loaded onto the Canvas.  You can then work with the data just like any other data block.  

Image

Learn about the standard block controls in this article on our knowledge base. 

Create a new table from the Universal Analytics Reporting API

Data from Universal Analytics will be available until June 30th, 2024 for both Standard and 360 accounts.  To get data from UA, select the "New UA Reporting API Table".  You can then select from one or more Views from one or more Google Analytics accounts using one or more Google accounts.

Image

Start by selecting the Google Account and include all views you’d like in the query.  If you want to add data from another account, authorize or select another authorized account, then add the views from it. 

Image
Image

You can search for Views by ViewID or by View Name. If you have a list of ViewIDs, you can upload them by selecting the "upload file" button.  Ensure that they are in a CSV file with one row per ViewID and no header.

When you have selected your views, click "Next Step"

Image

Select from the list of available dimensions and metrics.  As this is connected to the Google Analytics Metadata API, you will always see the most recent list of available dimensions and metrics.

You can use the Web UI Label to get the same labels as the ones found in the Google Analytics web interface. However, the data will be labelled according to the API when it is landed on the Canvas. In case you need to rename it, you can use the Calculate block.

The limit of 9 dimensions and 10 metrics is imposed by the Google Analytics API.

In the segments tab, which is next to "Dimensions and Metrics," you can select from one or more segments from both the Standard ones (Google provided) and ones that the authorized account has access to with their Google account.

When you have made your selections, click "Next Step"

Image

In this final step, you will name your table as it will appear in the list of Google Analytics tables, and provide a start-date from which to load your data.

    • Reload the last X days: To account for data reprocessing in Google Analytics, which can occur to adjust for late arriving hits or to remove invalid traffic, Canvas will remove then replace the last X days of data before loading it back in. We recommend a 5 day reload period.
    • Include the current day: If selected, will always load data up to and including the current day when the data is refreshed.

When you have made your selections, click "Next Step" to submit the query and begin loading the data.

Image

When the block first lands on a Canvas, you can arrange it or add new blocks to the Canvas, but you cannot connect this block to another block until the first preview of the data has loaded.

To learn more about the standard block controls, see this article.

Using the GA4 BigQuery Export with Analytics Canvas

Analytics Canvas connects to the GA4 BigQuery export in 2 ways: 

  1. Through the Google Analytics Connector by selecting the "New GA4 BigQuery Table" option.
  2. Through the BigQuery SQL Connector.  

Follow the links above to learn how to retrieve data from the GA4 BigQuery Export using Analytics Canvas. 

Image

Using the GA4 BigQuery SQL connector, select a property, then select your dimensions and metrics to develop your custom query. 

Image

Re-using your GA tables within your subscription

When you define and run a Google Analytics data input onto any given Canvas, that the resulting table is stored in your Analytics Canvas account indefinitely (until you delete it).

When any user of your account adds a new Google Analytics input onto a Canvas, they will be able to choose from any existing query that has already been defined and run.  This further saves on data processing and query charges. 

Image
Was this article helpful?

Related Tutorials/Video