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.

This API only supports authentication via OAuth2, so we’ll be connecting using API Connector’s built-in OAuth2 integration for Google Analytics. This is a paid feature; please upgrade to access.

PART 1: CONNECT TO THE GOOGLE ANALYTICS MANAGEMENT API

If you haven’t connected API Connector to the Google Analytics Management API before, you’ll first need to initiate the connection as follows:

  1. Open up Google Sheets and click Add-ons > API Connector > Manage Connections.
  2. In the list of available connections, find “Google Analytics Mgmt.” and click Connect.
    google-analytics-mgmt-img1
  3. 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.
    google-analytics-mgmt-img2
  4. You’ll then be returned to your Google Sheet, and can verify that your Google Analytics Mgmt. connection is active in the Connections screen.
    google-analytics-mgmt-img3

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:

https://www.googleapis.com/analytics/v3/management/accounts/

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.

  1. Open up Google Sheets and click Add-ons > API Connector > Open.
  2. In the Create screen, enter the API URL we just created
    google-analytics-mgmt-img4
  3. We don’t need any headers, so just leave that section blank.
  4. Choose ‘Google Analytics Mgmt.’ from the authentication dropdown.
    google-analytics-mgmt-img5
  5. Create a new tab and click ‘Set current’ to use that tab as your data destination.
  6. Name your request and click Run. A moment later you’ll see metadata about your Google Analytics accounts populate your sheet.
    google-analytics-mgmt-img6

PART 4: MORE EXAMPLE API REQUESTS

  • View metadata about all the properties within an account (substitute in the account ID found in the items » id field from the prior request.
    https://www.googleapis.com/analytics/v3/management/accounts/YOUR_ACCOUNT_ID/webproperties/
  • List the views you have access to within a property
    https://www.googleapis.com/analytics/v3/management/accounts/YOUR_ACCOUNT_ID/webproperties/UA-PROPERTY-ID/profiles

For additional GA Management API resources, please check Google’s API documentation: https://developers.google.com/analytics/devguides/config/mgmt/v3/mgmtReference

Leave a Comment