A/B Test Inbound

This example shows how to perform an action on incoming requests based on the result of a randomly generated number. A/B tests could also be performed on properties such as the request.user.

A/B tests can also be combined with other policies by passing data to downstream policies. For example, you could save a value in ContextData based on the results of the A/B test and use that value in a later policy to modify the request.

Configuration#

{
  "name": "ab-test-inbound",
  "policyType": "custom-code-inbound",
  "handler": {
    "export": "default",
    "module": "$import(./modules/ab-test-inbound)"
  }
}

Options#

  • name the name of your policy instance. This is used as a reference in your routes.
  • policyType the identifier of the policy. This is used by the Zuplo UI. Value should be ab-test-inbound.
  • handler/export The name of the exported type. Value should be default.
  • handler/module the module containing the policy. Value should be $import(./modules/YOUR_MODULE).

Was this article helpful?

Do you have any questions?Contact us
Check out ourproduct changelog