How To Add Data From Google Analytics
To add data from Universal Analytics through the Google Analytics Reporting API, or to get data from GA4 using the Google Analytics Data API, follow the instructions as outlined below.
The example below uses UA, however the steps are the same / similar when using GA4.
1. Drag and drop a Google Analytics block on to your Canvas
2. You will automatically be prompted to add a Google account if you do not already have one authorized.
3. Authorize the connector and upon completion, you will be able to query from any Google Analytics account that the authorized Google account has access to. In the query editor, you can authorize and select from multiple Google accounts.
If you have already made queries and have existing tables available to use, when you first add the block to a Canvas, you will be able to select an existing table or create a new one.
4. Click “New GA Table” to create a new Google Analytics query for use within your Analytics Canvas Cloud account. Note that for GA4, you would simply select "New GA4 Table" instead of "New GA Table". GA4 tables are denoted by the "4" on top of the GA icon.
5. Once authorized, select one or more views from one or more Google Analytics accounts that your Google account can access. To add data from another Google Account, click "Add a new Google Analytics Credential".
You can select data from multiple Google accounts in the same query!
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.
6. 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"
7. 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"
8. 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.
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.