Pages

Tuesday, 1 September 2015

Google Analytics Query

Documentation
Element for querying the Google Analytics Core Reporting API.
Example
<google-analytics-query
  ids="ga:1174"
  metrics="ga:sessions"
  dimensions="ga:country"
  sort="-ga:sessions"
  maxResults="5">
</google-analytics-query>
Properties
data
Objectdefault: {} notify
    The data attribute is the response from a query to the Google Analytics Core Reporting API. This value will be updated as subsequent requests are made.
    dimensions
    Stringdefault: ''
      The dimensions attribute is a list of comma-separated dimensions for your Analytics data, such as ga:browser,ga:city.
      See the Core Reporting API parameter reference for more details.
      endDate
      Stringdefault: 'yesterday'
        The endDate attribute is the end date for fetching Analytics data. Requests can specify an end date formatted as YYYY-MM-DD, or as a relative date (e.g., today, yesterday, or NdaysAgo where N is a positive integer).
        See the Core Reporting API parameter reference for more details.
        fields
        Stringdefault: ''
          The fields attribute is a selector specifying a subset of fields to include in the response.
          See the Core Reporting API parameter reference for more details.
          filters
          Stringdefault: ''
            The filters attribute is dimension or metric filters that restrict the data returned for your request.
            See the Core Reporting API parameter reference for more details.
            ids
            Stringdefault: ''
              The ids attribute is the unique table ID of the form ga:XXXX, where XXXX is the Analytics view (profile) ID for which the query will retrieve the data.
              See the Core Reporting API parameter reference for more details.
              Note: you can find out the ids value for any of your Google Analytics account using the Google Analytics query explorer.
              loading
              Booleandefault: false notify
                true if data is getting loaded
                maxResults
                Numberdefault: 0
                  The maxResults attribute is the maximum number of rows to include in the response.
                  See the Core Reporting API parameter reference for more details.
                  metrics
                  Stringdefault: ''
                    The metrics attribute is a list of comma-separated metrics, such as ga:sessions,ga:bounces.
                    See the Core Reporting API parameter reference for more details.
                    output
                    Stringdefault: ''
                      The output attribute sets the desired output type for the Analytics data returned in the response. Acceptable values are json and dataTable.
                      See the Core Reporting API parameter reference for more details.
                      samplingLevel
                      Stringdefault: ''
                        The samplingLevel attribute sets the desired sampling level. Allowed Values: DEFAULTFASTERHIGHER_PRECISION.
                        See the Core Reporting API parameter reference for more details.
                        segment
                        Stringdefault: ''
                          The segment attribute segments the data returned for your request.
                          See the Core Reporting API parameter reference for more details.
                          setupReady
                          Boolean
                            True if setup is ready
                            sort
                            Stringdefault: ''
                              The sort attribute is a list of comma-separated dimensions and metrics indicating the sorting order and sorting direction for the returned data.
                              See the Core Reporting API parameter reference for more details.
                              startDate
                              Stringdefault: '7daysAgo'
                                The startDate attribute is the start date for fetching Analytics data. Requests can specify a start date formatted as YYYY-MM-DD, or as a relative date (e.g., today, yesterday, or NdaysAgo where N is a positive integer).
                                See the Core Reporting API parameter reference for more details.
                                startIndex
                                Numberdefault: 0
                                  The startIndex attribute sets the first row of data to retrieve, starting at 1. Use this parameter as a pagination mechanism along with the max-results parameter.
                                  See the Core Reporting API parameter reference for more details.
                                  Methods
                                  getData()
                                    Query the Google Analytics Core Reporting API.
                                    getDataResponseHandler()
                                      handleResponse(response)
                                        The callback for the query run in getData. This is a separate function so subclasses can alter how the response is handled.
                                        setData(data)
                                          setData sets data fetched by getData. Use it if you override getData response processing
                                          Events
                                          analytics-query-error
                                            Fired when an error occurs while running a query.
                                            analytics-query-success
                                              Fired when a query is successfully run and data has been stored.