Controlling the Usage Service via Environment Variables

Link to Controlling the Usage Service via Environment Variables copied to clipboard

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

These four environment variables allow you to control the usage service. You can enable or disable the collection of usage metrics, include test results with usage events, change the URL where results are reported, and change the user's distinct ID.

Name Description
AXE_DISTINCT_ID A uuid identifier that remains the same for the logged in user (unless it is regenerated)
AXE_INCLUDE_TEST_RESULTS Include test results in the applicationProperties object by populating the testResults object
AXE_METRICS_URL The URL of the REST usage endpoint
AXE_TRACK_USAGE Enables usage service reporting (the default is false)
note

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.

In the tables below, the Can Override column indicates whether the value set in the environment variable can override the value that was set in the call to the metrics library. Data Name is the name of the property as it appears in the event object sent to the usage service.

Boolean Environment Variables

These values are expected to be true or false.

Name Data Name Can Override Description
AXE_DEV_INSTANCE devInstance 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_LOGGED_IN loggedIn false Records whether the user is logged in to the application under test.

String Environment Variables

These values are interpreted as strings.

Name Data Name Can Override Description
AXE_APPLICATION application false The application that was used to check for accessibility errors
AXE_DEPARTMENT department true The user's department within the organization (AXE_ORGANIZATION)
AXE_KEYCLOAK_ID keycloakId false The user's Keycloak ID
AXE_ORGANIZATION organization true The user's organization
AXE_SESSION_ID sessionId false A uuid identifying the user's session
AXE_USER_ID userId false A specific user's identity such as name or login ID
AXE_USER_JOB_ROLE userJobRole false The user's job role
AXE_USER_STATUS userStatus false Status information you want to associate with the user

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.