Google Analytics

On this Page

Snap type:

Read


Description:

This Snap provides access to Google Analytics data. See the Google Analytics Core Reporting API Reference Guide at https://developers.google.com/analytics/devguides/reporting/core/v3/reference for more information on the query parameters available. You can use the Google Analytics Query Explorer to help find your IDs. 


Prerequisites:

[None]


Support and limitations:

Works in Ultra Task Pipelines.

Account: 

This Snap uses account references created on the Accounts page of SnapLogic Manager to handle access to this endpoint. See Configuring Google Analytics Accounts for information on setting up this type of account.

Views:
InputThis Snap has at most one document input view.
OutputThis Snap has exactly one document output view.
Error

This Snap has at most one document error view and produces zero or more documents in the view.

Note: The Google Analytics API gets some of the data with some Malformed format. When you use the Analytics Snap with Metrics and Dimensions, attach an Error view so that the Malformed data goes to the Error view with the message, Query Execution Failed. All of the good data is then passed through normally.
Go to https://ga-dev-tools.appspot.com/explorer/ to see the number of Dimensions and Metrics that are supported.
 

Settings

Label


Required. The name for the Snap. You can modify this to be more specific, especially if you have more than one of the same Snap in your pipeline.

Account ID



Required. Google Analytics Core Reporting API ids parameter.

The account ID can be found on the Google Account Settings Page: https://www.google.com/analytics/web/?hl=en&pli=1#management/Settings/a39614376w71278742p73504462/%3Fm.page%3DAccountSettings/ 


Table ID


Required. The unique table ID in the format: ga:XXXX, where XXXX is the View ID for which the query will retrieve the data. The View ID is found on the View Settings page under Admin in Google Analytics.

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#ids for details.

Maximum results


The maximum number of rows to include in the response.

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#maxResults for more information.


Start index


Required. Google Analytics Core Reporting API start-index parameter.

The first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the Maximum results parameter.


Automatic pagination


Select this option to fetch all the records as a result of the query being executed by invoking pagination automatically.

Default value: Selected


Start date


Required. Google Analytics Core Reporting API start-date parameter.

The first date of the date range for which you are requesting the data. 

Currently, the only supported format is YYYY-MM-DD as a string.


See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#startDate for more information.

Example: (expression toggle on) Date.now().minusDays(8).toLocaleDateString('{"format":"yyyy-MM-dd"}')


End date


Required. Google Analytics Core Reporting API end-date parameter.

The last date of the date range for which you are requesting the data. 

Currently, the only supported format is YYYY-MM-DD as a string.


See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#endDate for more information.

Example: (expression toggle on) Date.now().minusDays(1).toLocaleDateString('{"format":"yyyy-MM-dd"}')


Metrics


Required. Google Analytics Core Reporting API metrics parameter.

A list of comma-separated metrics. You can see the metrics property under http://ga-dev-tools.appspot.com/explorer/ to gain an understanding of supported metrics.

Examplega:visits,ga:bounces

See https://developers.google.com/analytics/devguides/reporting/core/dimsmets for more information.


Dimensions


Google Analytics Core Reporting API dimensions parameter.

A list of comma-separated dimensions for your Analytics data. 

Example: ga:browser,ga:city

See https://developers.google.com/analytics/devguides/reporting/core/dimsmets for more information.


Sort expression


Google Analytics Core Reporting API sort parameter.

A list of comma-separated dimensions and metrics that indicate the sorting order and the sorting direction for the returned data.

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#sort for more information. 


Filter expression


Google Analytics Core Reporting API filters parameter.

The dimension or metric filters that restrict the data returned for your request. 

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#filters for more information.


Segment


Google Analytics Core Reporting API segment parameter.

A subset of visits based on either an expression or a filter.

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#segment for more information.


Sampling level

 

Google Analytics Core Reporting API SamplingLevel parameter.

The number of sessions (specified as levels) required for returning results of a request.

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#samplingLevel for more information.


Fields

 

Google Analytics Core Reporting API fields parameter.

Specify a subset of fields to include in the response.

See https://developers.google.com/analytics/devguides/reporting/core/v3/reference#fields for more information.


Snap Execution

Select one of the three modes in which the Snap executes. Available options are:

  • Validate & Execute: Performs limited execution of the Snap, and generates a data preview during Pipeline validation. Subsequently, performs full execution of the Snap (unlimited records) during Pipeline runtime.
  • Execute only: Performs full execution of the Snap during Pipeline execution without generating preview data.
  • Disabled: Disables the Snap and all Snaps that are downstream from it.

Examples


For all examples below, supply your Account id and Table id, then the appropriate Start date and End date for your query.

Unless otherwise noted, these pipelines follow this layout.


The Structure Snap is used just to relabel the columns (such as ga:sessions to Sessions) to make the data more user friendly. It is then sent to an Email Sender Snap configured with Email type as HTML Table.


Query Site Usage by Source


 Metrics ga:sessions,ga:pageviews,ga:sessionDuration,ga:exits
 Dimensions ga:source,ga:medium
 Sort expression -ga:sessions


Resulting Email

This query runs against this documentation site for a specific week returned the following results:

 

 

 Query Sessions by Search Engine Keywords

 Metrics ga:sessions
 Dimensions ga:keyword
 Sort expression -ga:sessions
 

Resulting Email

This query runs against this documentation site for a specific week returned the following results:

 

 Query Mobile Sessions

 Metrics ga:sessions,ga:pageviews,ga:sessionDuration
 Dimensions ga:mobileDeviceInfo,ga:source
 Sort expression -ga:sessions
 

Resulting Email

This query run against this documentation site for a specific week returned the following results:

 

Query Most Frequently Visited Pages

 Metrics ga:visits
 Dimensions ga:pageTitle,ga:pagePath
 Sort expression -ga:visits 

Resulting Email

This query run against this documentation site for a specific week returned the following results:

 

With this query, you may find that your home page is always the top result and it will return all pages visited in that period.

To skip the the first result (pagePath of /home), set Filter expression to: ga:pagePath!=/home

To restrict the list to the top ten pages and to skip the first result, add a Head Snap with Number of documents set to 10.


See Also

Snap Pack History

 Click to view/expand
ReleaseSnap Pack VersionDateTypeUpdates

4.27

main12833

 

Stable

Upgraded with the latest SnapLogic Platform release.
4.26main11181 StableUpgraded with the latest SnapLogic Platform release.
4.25main9554 StableUpgraded with the latest SnapLogic Platform release.
4.24main8556 StableUpgraded with the latest SnapLogic Platform release.
4.23423patches8397  Latest

Fixes an authorization issue in the Snap Pack by migrating to a verified Google OAuth application.

4.23main7430 StableUpgraded with the latest SnapLogic Platform release.
4.22422patches6781 Latest

Fixes the Google Analytics Snap Pack by authorizing the Google OAuth2 account.

4.22main6403 StableUpgraded with the latest SnapLogic Platform release.
4.21snapsmrc542 StableUpgraded with the latest SnapLogic Platform release.
4.20snapsmrc535 StableUpgraded with the latest SnapLogic Platform release.
4.19snaprsmrc528

 

StableUpgraded with the latest SnapLogic Platform release.
4.18snapsmrc523 StableUpgraded with the latest SnapLogic Platform release.
4.17ALL7402 Latest

Pushed automatic rebuild of the latest version of each Snap Pack to SnapLogic UAT and Elastic servers.

4.17snapsmrc515 Latest

Added the Snap Execution field to all Standard-mode Snaps. In some Snaps, this field replaces the existing Execute during preview check box.

4.16snapsmrc508 StableUpgraded with the latest SnapLogic Platform release.
4.15snapsmrc500 StableUpgraded with the latest SnapLogic Platform release.
4.14snapsmrc490 StableUpgraded with the latest SnapLogic Platform release.
4.13

snapsmrc486

 StableUpgraded with the latest SnapLogic Platform release.
4.12

snapsmrc480

 StableUpgraded with the latest SnapLogic Platform release.
4.11snapsmrc465 StableUpgraded with the latest SnapLogic Platform release.
4.10

snapsmrc414

 StableUpgraded with the latest SnapLogic Platform release.
4.9snapsmrc405

 

StableUpgraded with the latest SnapLogic Platform release.
4.8

snapsmrc398

 StableUpgraded with the latest SnapLogic Platform release.
4.7

snapsmrc382

 StableUpgraded with the latest SnapLogic Platform release.
4.6

rcmsf233

 Latest
  • Enhanced the Google Analytics Snap to enabling sampling level.
  • Resolved an issue in Google Analytics tooltip about an HTML link.
4.5.1

analytics1577

 Latest
  • Automatic pagination added.
4.5

rcmsf231

 StableUpgraded with the latest SnapLogic Platform release.
4.3.2NA
Stable

Resolved an exception when no results were found when trying to recreate Google's Site Search - Search Terms example.

December 20, 2014

NA
StableUpgraded with the latest SnapLogic Platform release.

November 2014

NA
Stable

Google Analytics support for passing Start Date, End Date, Metrics and Dimensions as Parameters.

December 2013

NA
Latest

Initial release of Google Analytics Snap Pack.