How to collect data from Google Analytics
This article will show you how to create a Metric using a Google Analytics report as a data source. It assumes that you have already established connectivity to your Google Analytics server. The process for creating a Dataset is similar.
The example shown below is for the Metric.
Provide the basic information required for creating a new Metric:
- Specify this Metric's Measure
- If you do not see the measure that you want to use, scroll to the bottom of the drop-down list and create a new one by clicking [Add New Measure]
- Select the Measurement Interval that applies to your element
- Give the Metric a unique Name
- Assign a Category
- Click [Next: define details] to proceed with data collection
As of Release 5.4.1, it is possible to include in the query the "contains" setting that can be specified in the Plugin Command field as a Filter or added via the Visual Editor > Advanced tab.
When employing this option, Users can retrieve values as specified by the "contains" operator.
On the Data tab in the Metric Editor:
- Select the Data Source for this Metric
- Set the Data Collection Trigger that will initiate data fetching
- Specify the View that allows access to Reports in a Google Analytics account
- Input an MIQL Plugin Command listing all the data you would like to fetch from Google Analytics (manually or using the Visual Editor)
Validate your Plugin Command
- If your statement is valid, the statement box will be green; if there are any errors, the box will be colored in red and errors will be explained in the field below.
- Collect Data
- Enable and Publish your Metric
- Entire field names that contain special characters, aggregation and commas must be enclosed in quotes (single or double).
- It is acceptable to enclose all fields and values in quotes.
[…] + Notation is used to signify that the MIQL parts of a statement are optional/can be repeated.
The Google Analytics Query Builder allows constructing commands without the need to learn the plugin syntax and avoiding typos/mistakes:
- Click [Visual Editor] to select this option
- On the pop-up, add the fields by using the corresponding buttons: [+Dimension], [+Metric], [+Derived field], [+Count]
- Learn more about Dimensions & Metrics available through the Core Reporting API in Google Analytics
- All added fields and their types will be displayed above
- Specify the Start Date and End Date for data collection and optionally Limit the number of rows that will be displayed on Save
- Determine which Segments of data you want to fetch from Google Analytics
- For more information, refer to Google Analytics Segments
- On the Advanced tab, [+ Advanced filter]
- Add as many Advanced Filters as needed
Save your settings. Plugin command validation will start automatically.