A newer version of the Google Analytics Tool is available from the Alteryx Analytics Gallery.
The Google Analytics 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 two tabs to configure, Authentication and Search.
Specify the following Google Analytics credentials:
Disable for Testing: When checked, you can test your query without making a call to the Analytics API.
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.
Metrics (max 10): The aggregated statistics for user activity to your site, such as clicks or pageviews.
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:
Dimensions (max 7): Breaks down metrics by common criteria.
Segments (max 1): Segments the data returned for your request.
Filter: An expression that acts like a filter; restricting the data returned for your request.
ga:timeOnPage==10 OR ga:timeOnPage!=10
ga:country==United States;ga:browser==Firefox
There are several things you need in order to use the Google Analytics macro:
A Google account. This can be obtained by creating a gmail account.
Authorized Access to an existing Google Analytics account. See your web administrator to gain approval.
Register your application by creating a new project using the Google developer's console.
Before we move on make sure your Client ID and Client Secret are readily available (weâll be using them soon)
Browse to Googleâs OAuth Playground (https://developers.google.com/oauthplayground)
Click the button near the upper-right corner of your monitor
Check the box Use your own OAuth credentials and make sure Access type is set to Offline.
Paste in your Client ID in OAuth Client ID.
Paste in your Client Secret in OAuth Client Secret.
Click Close.
In the sidebar on the left, scroll down to the Google Analytics API v3 under Step 1: Select & authorize APIs
Click the little grey triangle on the left and select
Hit Authorize APIs to be directed to another page.
When prompted, hit Accept to be redirected back to the OAuth 2.0 Playground.
Once youâve been redirected back to the OAuth 2.0 Playground hit the Exchange authorization code for tokens button.
Your Refresh Token will be contained in a JSON object towards the bottom of the Request / Response section.
Keep a copy of your Refresh Token, Client ID, and Client Secret somewhere safe but easily accessible.
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. Anyone using these queries should set the Date Range, Max Results, and Start Index in a manner suitable to their own needs.
Visitors and Pageviews Over Time
To return the total visitors and pageviews for the specified time period, select the Metrics:
This query doesn't require any dimensions.
Revenue Generating Campaigns
To return campaign and site usage data for campaigns that led to more than one purchase through your site, select the Metrics:
Select the Dimensions:
The Google developer guide provides more general queries.
Browser and Operating System
To return a breakdown of visits by the Operating System, web browser, and browser version used, select the Metrics:
Select the Dimensions:
The Google developer guide provides more visitor queries.
Referring Sites
To return a list of domains and how many visits each referred to your site, select the Metrics:
Select the Dimensions:
Select Filter, then select Dimension. Under Filter=, enter ga:medium==referral.
The Google developer guide provides more traffic source queries.
Top Exit Pages
To return your most common exit pages, select the Metrics:
Select the Dimensions:
The Google developer guide provides more content queries.
©2018 Alteryx, Inc., all rights reserved. Allocate®, Alteryx®, Guzzler®, and Solocast® are registered trademarks of Alteryx, Inc.