Google Analytics
On this Page
This page is no longer maintained (Jul 12, 2023). For the most current information, go to Google Analytics Snap Pack.
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: |
| |||||||
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.
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.
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. Example: ga: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:
|
Basic Use Cases
Query Site Usage by Source
Prerequisites:
- Account id and Table id
- Start date and End date for your query
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 returns the following results:
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 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 returns 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 returns 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 returns the following results:
With this query, you might find that the home page is always the top result and it returns 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.
Related Content
Snap Pack History
Have feedback? Email documentation@snaplogic.com | Ask a question in the SnapLogic Community
© 2017-2024 SnapLogic, Inc.