Google Analytics
Overview
- Read-type Snap
- Works in Ultra Tasks
Prerequisites
None.
Limitations and known issues
None.
Snap views
View | Description | Examples of upstream and downstream Snaps |
---|---|---|
Input | This Snap has at most one document input view. | |
Output | This Snap has exactly one document output view. | |
Error |
Error handling is a generic way to handle errors without losing data or failing the Snap execution. You can handle the errors that the Snap might encounter when running the pipeline by choosing one of the following options from the When errors occur list under the Views tab. The available options are:
Learn more about Error handling in Pipelines. |
Snap settings
- Suggestion icon (): Indicates a list that is dynamically populated based on the configuration.
- Expression icon (): Indicates whether the value is an expression (if enabled) or a static value (if disabled). Learn more about Using Expressions in SnapLogic.
- Add icon (): Indicates that you can add fields in the field set.
- Remove icon (): Indicates that you can remove fields from the field set.
Field / Field set | Type | Description |
---|---|---|
Label | String | Required. Specify a unique name for the Snap. Modify this to be more appropriate, especially if there are more than one of the same Snap in the pipeline. |
Account id | String/Expression/Suggestion |
Required.
Specify the Google Analytics Core Reporting API ids parameter.
The account ID can be found on the Google Account Settings page.
Default value: N/A Example: 91459 :-: GR |
Table id | String/Expression/Suggestion |
Required.
Specify 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 the Google Analytics definition of ids for details.
Default value: N/A Example: qa:7430123 :-: All Web Site Data |
Maximum results | Integer |
Required.
Specify the maximum number of rows to include in the response.
See the Google Analytics definition of max-results for more information.
Default value: 1000 Example: 850 |
Start index | Integer |
Required.
Specify the 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.
Default value: 1 Example: 7 |
Automatic pagination | Checkbox |
Required.
Select this option to fetch all the records as a result of the query being executed by invoking pagination automatically.
Default status: Selected Example: Deselected |
Start date | Integer/Expression |
Required.
Specify the Google Analytics Core Reporting API start-date parameter.
The first date of the date range for which you are requesting the data.
See the Google Analytics definition of start-date for more information.
Note: Currently, the only supported format is YYYY-MM-DD as a string.
Default value: N/A Example: (expression toggle on) Date.now().minusDays(8).toLocaleDateString('{"format":"yyyy-MM-dd"}') |
End date | Integer/Expression |
Required.
Specify theGoogle Analytics Core Reporting API end-date parameter.
The last date of the date range for which you are requesting the data.
See the Google Analytics definition of end-date for more information.
Note: Currently, the only supported format is YYYY-MM-DD as a string.
Default value: N/A Example: (expression toggle on) Date.now().minusDays(1).toLocaleDateString('{"format":"yyyy-MM-dd"}') |
Metrics | String/Expression |
Required. Google Analytics Core Reporting API metrics parameter.
Specify 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.
See the Google Analytics definition of Metric for more information.
Default value: N/A Example: ga:visits,ga:bounces |
Dimensions | String/Expression |
Required.
Specify the Google Analytics Core Reporting API dimensions parameter.
A list of comma-separated dimensions for your Analytics data.
See the Google Analytics definition of Dimensions for more information.
Default value: N/A Example: ga:browser,ga:city |
Sort expression | String |
Required.
Specify the 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 the Google Analytics definition of sort for more information.
Default value: N/A Example: ga:country,ga:browser |
Filter expression | String |
Required.
Specify the Google Analytics Core Reporting API filters parameter.
The dimension or metric filters that restrict the data returned for your request.
See the Google Analytics definition of filters for more information.
Default value: N/A Example: ga:pageviews>1000 |
Segment | String |
Required.
Specify the Google Analytics Core Reporting API segment parameter.
A subset of visits based on either an expression or a filter.
See the Google Analytics definition of segment for more information.
Default value: N/A Example: gaid::-10 |
Sampling level | Checkbox |
Required.
Specify the Google Analytics Core Reporting API SamplingLevel parameter.
The number of sessions (specified as levels) required for returning results of a request.
See the Google Analytics definition of Sampling Level for more information.
Default value: DEFAULT Example: FASTER |
Fields | String |
Required.
Specify the Google Analytics Core Reporting API fields parameter.
A subset of fields to include in the response.
See the Google Analytics definition of fields for more information.
Default value: N/A Example: columnHeaders(name,dataType) |
Snap execution | Dropdown list | Select one of the three modes in which the Snap executes.
Available options are:
|
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 sngine 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 runs 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
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.