The Usage Service Event Reference
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
applicationPropertiesobject - The
testResultsobject (contained within theapplicationPropertiesobject) whenAXE_INCLUDE_TEST_RESULTSis set totrue
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
actor?: 'human' | 'automation'
teams?: { id: string; name: string }[]
}| Name | Description |
|---|---|
| actor | Whether a person (human) or an automated pipeline (automation) ran the test. Set by the CLI and the Node.js APIs. See actor. |
| 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) |
| teams | The teams running the test, as an array of { id, name } objects. Set by the CLI and the Node.js APIs. See teams. |
| 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.
actor
The CLI and the Node.js APIs set actor to automation when one of these environment variables is set to a value other than false or 0: CI, BUILD_NUMBER, BUILDKITE, CIRCLECI, CODEBUILD_BUILD_ID, GITHUB_ACTIONS, GITLAB_CI, JENKINS_URL, TEAMCITY_VERSION, TF_BUILD, or BITBUCKET_BUILD_NUMBER. Otherwise, actor is human. Set the AXE_ACTOR environment variable to human or automation to override the detection. The @axe-devtools/browser package can't read environment variables when it runs in a browser, so it reports human there.
teams
The teams array records the teams whose members ran the test. The CLI and the Node.js APIs always send it, as an empty array ([]) when no teams are set. You supply the teams yourself, with the AXE_TEAMS environment variable, the CLI's --set-teams option, or your Node.js API's setTeams method. Each team is an object with string id and name properties:
[{ "id": "1", "name": "Web" }]Entries without a string id and name are dropped. A value that can't be read or isn't a JSON array is ignored, and the event is still sent.
applicationProperties
The applicationProperties object contains count information about the test run, as an example below shows:
applicationProperties: {
advancedRules: { enabled: false, value: 'disabled', source: 'unavailable' },
target: 'https://broken-workshop.dequelabs.com/',
targetMedium: 'text/html',
urlCount: 1,
engineVersion: '4.14.0',
failedRuleCount: 2,
failedRuleNames: 'color-contrast,label',
failedItemCount: 5,
criticalIssueCount: 3,
seriousIssueCount: 2,
moderateIssueCount: 0,
minorIssueCount: 0,
needsReviewItemCount: 4,
inapplicableRuleCount: 39,
incompleteRuleCount: 2,
passedRuleCount: 21,
testResults: {}
},| Property | Description |
|---|---|
| advancedRules | Whether advanced rules ran. The CLI and the Node.js APIs never run advanced rules, so this is always { enabled: false, value: 'disabled', source: 'unavailable' }. |
| command | The CLI command that ran the scan, such as spec or bulk-spec. Sent by the CLI only. |
| criticalIssueCount | Number of failing elements with critical impact |
| 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 |
| minorIssueCount | Number of failing elements with minor impact |
| moderateIssueCount | Number of failing elements with moderate impact |
| needsReviewItemCount | Number of elements that need review |
| incompleteRuleCount | Number of rules that were incomplete |
| passedRuleCount | Number of rules that passed |
| seriousIssueCount | Number of failing elements with serious impact |
| target | URL tested |
| targetMedium | Mime type of target. Named target_medium before version 4.14.0. |
| testResults | The testResults object, see the next section for more information |
| urlCount | Number of distinct URLs analyzed. A CLI spec page whose actions navigate and analyze again reports more than 1. |
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, which is supported by the CLI and the Node.js APIs only.
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.
