Keymetrics
  • 29 Mar 2024
  • 2 Minutes to read
  • Contributors
  • Dark
    Light
  • PDF

Keymetrics

  • Dark
    Light
  • PDF

Article summary

/keymetrics/{Profile ID} returns the specified profile's key metrics for the time period specified. Key metrics are: Page Views, Visits, Visitors (this is the sum of daily visits, which doesn't account for overlap between days, so it doesn't usually match Analytics Visitors), Average Time on Site, Average Visitors per Day, Page Views per Visit, and New Visitors.

Method: GET

URI: /keymetrics/{Profile ID}/

Note: Add any optional parameters to the end of the URI. If you change the order of URI or required parameters, or place optional parameters before them, the call will not work.

Version number

The version number you will use is dependant upon the version of Analytics you have installed. Analytics versions 9.5 and below, use v2_0. Analytics versions 9.5.1 and above will use v2_1.

Example Request
https://myDomain.com/{version}/ReportService/keymetrics/Cq8UQ4R8SB8/?start_period=2021m02d01&end_period=2021m02d02

Example Response

"data":{
      "02/01/2021-02/02/2021":{
         "Attributes":null,
         "measures":{
            "Page Views":1793.0,
            "Visits":715.0,
            "Visitors":668.0,
            "Bounce Rate":70.35,
            "Avg. Time on Site":527.93,
            "Avg. Visitors per Day":334.0,
            "Page Views per Visit":2.51,
            "New Visitors":541.0
         },
         "SubRows":{
            "02/01/2021":{
               "Attributes":null,
               "measures":{
                  "Page Views":960.0,
                  "Visits":378.0,
                  "Visitors":357.0,
                  "Bounce Rate":71.96,
                  "Avg. Time on Site":528.11,
                  "Avg. Visitors per Day":357.0,
                  "Page Views per Visit":2.54,
                  "New Visitors":292.0
               },
               "SubRows":null
            },
            "02/02/2021":{
               "Attributes":null,
               "measures":{
                  "Page Views":833.0,
                  "Visits":337.0,
                  "Visitors":311.0,
                  "Bounce Rate":68.55,
                  "Avg. Time on Site":527.75,
                  "Avg. Visitors per Day":311.0,
                  "Page Views per Visit":2.47,
                  "New Visitors":249.0
               },
               "SubRows":null
            }
         }
      }
   }

Parameters:

End period

Use the end_period parameter to specify the ending day of a date range. You must also supply the start_period.

end_period = ending day of date range

Example: specifying January 1, 2024 to January 30, 2024

start_period=2024m01d01&end_period=2024m01d30

Example: specifying the past 7 days (from yesterday)

start_period=current_day-7&end_period=current_day-1

Note: Several time period macros are available: CURRENT_DAY, CURRENT_MONTH and CURRENT_YEAR. Instead of a specific start and end date, you can identify relative time periods.

Format

format = return data format

Data formatParameter and value
JSONformat=json
XMLformat=xml
XML2 ("XPath-friendly" XML for dynamic applications)format=xml2
HTMLformat=html (use this when importing data into Excel)
CSVformat=csv (returned as a download)
RSSformat=rss (use to specify an RSS 2.0 syndication feed)
ATOMformat=atom (use to specify an ATOM 1.0 syndication feed)

For report data requests, all formats are supported. For "list" requests, only XML and JSON formats are supported.

Start period

Use the start_period parameter to specify the beginning day of a date range. You must also supply the end_period.

start_period = first day of date range

Example: specifying January 1, 2024 to January 30, 2024

start_period=2024m01d01&end_period=2024m01d30

Example: specifying the past 7 days (from yesterday)

start_period=current_day-7&end_period=current_day-1

Note: Several time period macros are available: CURRENT_DAY, CURRENT_MONTH and CURRENT_YEAR. Instead of a specific start and end date, you can identify relative time periods.

Suppress error codes

Set the suppress_error_codes parameter to true if you do not want to be notified of error conditions for a request (the default is false).

suppress_error_codes = {true|false}
Example: Suppress errors for a request
suppress_error_codes=true


Was this article helpful?

What's Next