Controlling the Usage Service via Environment Variables
Information about using environment variables to control the usage service or to change the event that is reported to the usage service
This article contains information about how to control the usage service via environment variables. You can:
- Control how the usage service operates.
- Modify the event that is sent to the usage service.
Controlling the Usage Service via Environment Variables
Four environment variables allow you to control the usage service. You can disable the collection of usage metrics, change the URL where results are reported, change the user's distinct ID, and include the full axe-core results in each event.
Usage reporting is enabled by default in the CLI and the Axe DevTools APIs. To stop usage events from being sent, set AXE_TRACK_USAGE to false, or call your API's enableTracking method with false.
If your client is unable to contact the usage service, it will retry by replacing https with http in the URL (set using the AXE_METRICS_URL environment variable).
Changing the Reported Event Using Environment Variables
With the environment variables below, you can change the event that is reported to the usage service. For instance, you can change the department or organization properties on each event to associate API or CLI usage to a specific department or organization.
The Can Override column indicates whether the value set in the environment variable can override a value that was already set programmatically via the metrics library. A dash (—) in the Can Override column indicates that the concept does not apply to that variable.
Environment Variables
| Name | Type | Can Override | Description |
|---|---|---|---|
AXE_DISTINCT_ID |
String | — | A UUID identifier that remains the same for the logged-in user (unless it is regenerated). In Ruby, this variable is named DEQUE_DISTINCT_ID. |
AXE_INCLUDE_TEST_RESULTS |
Boolean | — | Set to true to include the full axe-core results in the testResults object of each event (default is false). Supported by the CLI and the Node.js APIs only. |
AXE_METRICS_URL |
String | — | The URL of the REST usage endpoint (default is https://usage.deque.com) |
AXE_TRACK_USAGE |
Boolean | — | Set to false to disable usage service reporting. Reporting is enabled by default. |
AXE_APPLICATION |
String | false | The application that was used to check for accessibility errors |
AXE_DEV_INSTANCE |
Boolean | true | Indicates whether this event is from a software developer's actions. Useful for marking and later removing events logged during development or testing. |
AXE_DEPARTMENT |
String | true | The user's department within the organization |
AXE_KEYCLOAK_ID |
String | false | The user's Keycloak ID |
AXE_LOGGED_IN |
Boolean | false | Records whether the user is logged in to the application under test |
AXE_ORGANIZATION |
String | true | The user's organization. To have your usage appear in Axe Reports, set this to your organization's ID (contact Deque to obtain it). |
AXE_SESSION_ID |
String | false | A UUID identifying the user's session |
AXE_USER_ID |
String | false | A specific user's identity such as an email address, name, or login ID. Axe Reports counts unique users from this value. |
AXE_USER_JOB_ROLE |
String | false | The user's job role |
AXE_USER_STATUS |
String | false | Status information you want to associate with the user |
Differences Between Languages
Most of these environment variables behave identically across the CLI and every Axe DevTools API. The exceptions are:
AXE_INCLUDE_TEST_RESULTSis read by the CLI and the Node.js APIs only. Setting it has no effect on the Java, Python, C#, or Ruby APIs.AXE_DISTINCT_IDis namedDEQUE_DISTINCT_IDin the Ruby API.AXE_METRICS_URLmay not fall back to its default in the Java and Ruby APIs. If your usage events don't reach Deque, set the variable explicitly tohttps://usage.deque.com.
See Also
For tutorials demonstrating how to use these environment variables, 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.
