Import Google Analytics Management Data to Google Sheets
In this guide, we’ll walk through how to pull data from the Google Analytics Management API directly into Google Sheets, using the API Connector add-on for Sheets. The Google Analytics Management API enables programmatic access to Google Analytics configuration data, such as lists of all the accounts, properties, and views that you have access to.
- Before You Begin
- Part 1: Connect to the Google Analytics Management API
- Part 2: Create your Google Analytics Management API Request
- Part 3: Pull Google Analytics Management API Data into Sheets
- Part 4: More Example API Requests
BEFORE YOU BEGIN
Click here to install the API Connector add-on from the Google Marketplace.
PART 1: CONNECT TO THE GOOGLE ANALYTICS MANAGEMENT API
- Open up Google Sheets and click Add-ons > API Connector > Manage Connections.
- In the list of available connections, find “Google Analytics” and click Connect.
- You will be directed to google.com and asked to allow API Connector to view your Google Analytics user permissions and your Google Analytics data. Click Allow.
- You’ll then be returned to your Google Sheet, and can verify that your Google Analytics connection is active in the Connections screen.
PART 2: CREATE YOUR GOOGLE ANALYTICS MANAGEMENT API REQUEST
For our first request, we’ll get a list of all the Google Analytics accounts you have access to.
- Base URL: https://www.googleapis.com/analytics/v3/management
- Endpoint: /accounts/
Putting it all together, we get the full API Request URL:
PART 3: PULL GOOGLE ANALYTICS MANAGEMENT API DATA INTO SHEETS
We can now enter our values into API Connector and import your account configuration data into Google Sheets.
- Open up Google Sheets and click Add-ons > API Connector > Open.
- In the Create screen, enter the API URL we just created
- We don’t need any headers, so just leave that section blank.
- Choose ‘Google Analytics’ from the authentication dropdown.
- Create a new tab and click ‘Set current’ to use that tab as your data destination.
- Name your request and click Run. A moment later you’ll see metadata about your Google Analytics accounts populate your sheet.
- View metadata about all the properties within an account (substitute in the account ID found in the
items » idfield from the prior request.
- List the views you have access to within a property
For additional GA Management API resources, please check Google’s API documentation: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference