Pages

Tuesday, 1 September 2015

Google Analytics Chart

Documentation
Element for displaying the results of a Google Analytics query in a Google Chart.
Example
<google-analytics-chart
  type="column"
  ids="ga:1174"
  metrics="ga:sessions"
  dimensions="ga:country"
  sort="-ga:sessions"
  maxResults="5">
</google-analytics-chart>
Properties
data
Objectdefault: ''
    dimensions
    Stringdefault: ''
      endDate
      Stringdefault: ''
        filters
        Stringdefault: ''
          height
          Numberdefault: 320
            Sets the height of the chart on the page.
            ids
            Stringdefault: ''
              loading
              Booleandefault: false notify
                True if the chart is currently loading data.
                maxResults
                Numberdefault: ''
                  metrics
                  Stringdefault: ''
                    options
                    Objectdefault: null
                      Sets the options for the chart.
                      Example:
                      {
                        title: "Chart title goes here",
                        hAxis: {title: "Categories"},
                        vAxis: {title: "Values", minValue: 0, maxValue: 2},
                        legend: "none"
                      };
                      See Google Visualization API reference (Chart Gallery) for the options available to each chart type.
                      rendered
                      Booleandefault: false notify
                        True after the chart has been rendered for the first time.
                        samplingLevel
                        Stringdefault: ''
                          segment
                          Stringdefault: ''
                            setupReady
                            Boolean
                              True if setup is ready
                              sort
                              Stringdefault: ''
                                startDate
                                String
                                  google-analytics-query passthrough properties See google-analytics-query for documentation startDate, endDate, data, ids, metrics, dimensions, sort, filters, segment, samplingLevel, startIndex, maxResults
                                  startIndex
                                  Numberdefault: ''
                                    type
                                    Stringdefault: 'area'
                                      Sets the type of the chart.
                                      Should be one of:
                                      • area, bar, column, line, pie, geo.
                                      width
                                      Numberdefault: 480
                                        Sets the width of the chart on the page.
                                        Methods
                                        handleResponse(response)
                                        default:''
                                          setupReadyChanged(newVal, oldVal)

                                          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: DEFAULT, FASTER, HIGHER_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.