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.

1. Access New > Metric

Provide the basic information required for creating a new Metric:

  1. 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]
  2. Select the Measurement Interval that applies to your element
  3. Give the Metric a unique Name
  4. Assign a Category
  5. Click [Next: define details] to proceed with data collection

2. Provide Data Collection Settings

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:

  1. Select the Data Source for this Metric
  2. Set the Data Collection Trigger that will initiate data fetching
  3. Specify the View that allows access to Reports in a Google Analytics account
  4. Input an MIQL Plugin Command listing all the data you would like to fetch from Google Analytics (manually or using the Visual Editor)
  5. 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.
  6. Collect Data 
  7. Enable and Publish your Metric

Note! 

  1. Entire field names that contain special characters, aggregation and commas must be enclosed in quotes (single or double). 
  2. 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. 

2.1. Example using the Visual Editor

The Google Analytics Query Builder allows constructing commands without the need to learn the plugin syntax and avoiding typos/mistakes:

  1. Click [Visual Editor] to select this option
  2. On the pop-up, add the fields by using the corresponding buttons: [+Dimension], [+Metric], [+Derived field], [+Count]
  3. Specify the Start Date and End Date for data collection and optionally Limit the number of rows that will be displayed on Save
  4. Determine which Segments of data you want to fetch from Google Analytics
  5. On the Advanced tab, [+ Advanced filter]
    • Add as many Advanced Filters as needed

Save your settings. Plugin command validation will start automatically.

3. Metric will be displayed in Viewer