Google Analytics Tool

A newer version of the Google Analytics Tool is available from the Alteryx Analytics Gallery.

The Google Analytics (“GA”) tool returns statistics derived from the data collected by a Google Analytics tracking code.  You use the Core Reporting API to query for dimensions and metrics in order to build customized reports.

There are several things you need in order to use the Google Analytics macro:

  1. A Google Account (e.g., Gmail)

  2. Authorized Access to an existing Google Analytics account

  3. Client ID, Client Secret, and Refresh Token

Item 1 can be completed on your own, but depending on your role Item 2 may require the approval and assistance of your Web Administrator.  This help file assumes you have a valid Google Account and access to an existing Analytics account; Instructions to complete Item 3 (i.e., obtaining the Client ID, Client Secret, and Refresh Token) can be found here

Common Queries can be found here.

Configuration Properties

There are two tabs to configure, Authentication and Search.

Authentication

  1. Specify the following Google Analytics credentials:

    1. Client ID:  The client ID obtained from the Google Developers Console.

    2. Client Secret:  The client secret obtained from the Google Developers Console.

    3. Refresh Token:  The refresh token returned from the authorization code exchange on the OAuth 2.0 Playground.

  2. Disable for Testing: When checked, you can test your query without making a call to the Analytics API.

Instructions for acquiring the credentials above can be found here.

Search

There are two sections of search parameters, Required and Optional.

  1. Complete the Required parameters:

    1. Profile (View) ID:  The unique table ID for which your query will retrieve the data. Ask your Web Admin for the list of Profile IDs available to you, or get them here.

    2. Metrics (max 10):  The aggregated statistics for user activity to your site, such as clicks or pageviews.

    3. Date Range:  All Analytics data requests must specify a date range. Date format must be yyyy-mm-dd (e.g., 2014-01-01). Choose from the following options:

  2. Complete the configuration by specifying any of the Optional parameters described below:

back to top

Getting Started with Google Analytics

There are several things you need in order to use the Google Analytics macro:

  1. A Google Account (e.g., Gmail)

  2. Authorized Access to an existing Google Analytics account

  3. Client ID, Client Secret, and Refresh Token

Item 1 can be completed on your own, but depending on your role Item 2 may require the approval and assistance of your Web Administrator.  This help file assumes you have a valid Google Account and access to an existing Analytics account; therefore, the following section only explains the steps to complete Item 3 (i.e., obtaining the Client ID, Client Secret, and Refresh Token).

Obtaining the Client ID, Client Secret, and Refresh Token:

  1. Register your Application

  2. Generate your Client ID and Client Secret

    1. In the sidebar on the left, select Credentials

    2. Under OAuth select, Create New Client ID

    3. From the Create Client ID pop-up window...

  3. Acquire your Refresh Token

Keep a copy of your Refresh Token, Client ID, and Client Secret somewhere safe but easily accessible.

back to top

Common Queries

According to Google, these are several of the most common queries made to the Analytics API.

These examples are meant to highlight the Metrics, Dimensions, and Filter parameters –anybody using these queries should set the Date Range, Max Results, and Start Index in a manner suitable to their own needs.

General

Visitors and Pageviews Over Time: This query returns the total visitors and pageviews for the specified time period.

This query doesn't require any dimensions.

Revenue Generating Campaigns: This query returns campaign and site usage data for campaigns that led to more than one purchase through your site.

 

To see more General queries go to: https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries#general

 

Visitors

Browser and Operating System: This query returns a breakdown of visits by the Operating System, web browser, and browser version used.

   

To see more Visitors queries go to: https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries#visitors

 

Traffic Sources

Referring Sites: This query returns a list of domains and how many visits each referred to your site.

To see more Traffic Sources queries go to: https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries#traffic-sources

Content

Top Exit Pages: This query returns your most common exit pages.

 

To see more Content queries go to: https://developers.google.com/analytics/devguides/reporting/core/v3/common-queries#content

back to top