The Usage Service Event Reference

Link to The Usage Service Event Reference copied to clipboard

Information about the properties of version 2 of the usage service event

This article contains reference information about

  • The event data that is sent to the usage service (version 2 of the event object, EventV2)
  • Its contained applicationProperties object
  • The testResults object (contained within the applicationProperties object) when AXE_INCLUDE_TEST_RESULTS is set to true

Version 2 Event

The following TypeScript interface defines a version 2 event:

interface EventV2 {
  version: 'v2'
  productName: string
  productComponent: string
  productComponentVersion: string
  event: string
  dateTime: Date
  keycloakId?: string
  distinctId: string
  userId?: string
  organization?: string
  department?: string
  application?: string
  devInstance?: boolean
  sessionId?: string
  userStatus?: string
  loggedIn?: boolean
  applicationProperties?: Record<string, any>
  userJobRole?: string
}
Name Description
application The application that created this event
applicationProperties applicationProperties defined below
dateTime Date and time (to the millisecond) in ISO-8601 format, UTC timezone
department The user's department within the organization
devInstance Whether this usage is considered a developer's instance and probably should be filtered out
distinctId The user's distinct uuid
event Event type as a string, usually "analyze" or "uri: analyze" values
keycloakId The Keycloak ID of the user
loggedIn Whether the user is logged in
organization The user's organization
productComponent Set by the APIs to indicate different integrations such as Playwright
productComponentVersion A string indicating the product component's version
productName Set by the APIs to indicate the integration you're using
sessionId A uuid identifying the session (to allow grouping events)
userId The user's ID
userJobRole The user's job role
userStatus The user's status
version A string specifying the version of the event, always 'v2'

distinctId

The distinctId value is a uuid that is set per user whenever the metrics are recorded. It should be stable across time because it is set upon first run of the CLI or code that uses the APIs. It is stored in the .deque/distinct_id file in each user's home directory.

applicationProperties

The applicationProperties object contains count information about the test run, as an example below shows:

  applicationProperties: {
    target: 'https://broken-workshop.dequelabs.com/',
    target_medium: 'text/html',
    engineVersion: '4.5.2',
    failedRuleCount: 2,
    failedRuleNames: 'color-contrast,label',
    failedItemCount: 5,
    inapplicableRuleCount: 39,
    incompleteRuleCount: 2,
    passedRuleCount: 21,
    testResults: {}
  },
Property Description
engineVersion The version of axe-core used for testing
failedItemCount Total number of accessibility errors found on the webpage
failedRuleCount Number of rules that failed on the page
failedRuleNames Comma-separated string of names of rules that failed
inapplicableRuleCount Number of rules that weren't applied
incompleteRuleCount Number of rules that were incomplete
passedRuleCount Number of rules that passed
target_medium Mime type of target
target URL tested
testResults The testResults object, see the next section for more information

testResults

The testResults object is defined as an axeResults object (defined by axe-core). It is only set when you have set the AXE_INCLUDE_TEST_RESULTS environment variable to true.

interface AxeResults extends EnvironmentData {
  toolOptions: RunOptions;
  passes: Result[];
  violations: Result[];
  incomplete: Result[];
  inapplicable: Result[];
}

The following shows an example of a testResults object:

{
  testEngine: {
    name: "axe-core",
    version: "4.4.1"
  },
  testRunner: {
    name: "axe"
  },
  testEnvironment: {
    userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML,like Gecko) Version/16.0 Safari/605.1.15",
    windowWidth: 1280,
    windowHeight: 720
  },
  timestamp: "2023-02-02T20:09:04.785Z",
  url: "https://broken-workshop.dequelabs.com/",
  toolOptions: {
    reporter: "v1"
  },
  inapplicable: [],
  passes: [],
  incomplete: [],
  violations: []
}

For brevity, the inapplicable, passes, incomplete, and violations arrays, which normally contain Result objects, were not included.

You can see the TypeScript definitions for these objects in the axe-core GitHub repo.

See Also

For tutorials demonstrating how to use the usage service, see Getting Started with the Usage Service and the APIs and Getting Started with the Usage Service and the CLI.

For general information on the usage service, see The axe DevTools for Web Usage Service.