Tracking MVT Details in p13n_generated and API Response

Overview

This document describes how to include Multivariate Test (MVT) data as part of the p13n_generated.js response or recsForPlacements API response to identify the test treatment running on the page and other details of the test. The response will include details about the test and treatment to which you have been assigned, along with the placements included, enabling you to pass these details to your own analytics system.

Enabling MVT Details in p13n_generated Response

In Omnichannel Personalization, MVT details can be added to the p13n_generated response by enabling it in Site Configuration RR.

Changes made in Site Configurations RR have consequences. Contact your Algonomy Support team or CSM to enable mvtDetailed in p13n_generated response. By default, this configuration is disabled.

Once mvtDetailed is enabled, a new variable ‘mvtDetailed’ will be added to the p13n_generated response. It is an array containing test objects such as testId, testName, testType, treatmentId, treatmentName, control, and eligibility. The test details for all tests that are currently live will be included in the array.

Example JSON Response

Here’s an example JSON response with mvtDetailed included in the p13n_generated response.

Copy
"mvtDetailed":
[{
"eligible": true,
“testType”: “PLACEMENT”,
"testId": 55814,
"control": true,
"treatmentId": 60382,
"treatmentName": "Control”,
“testName”: “Fallback strategies”
}]

Response Object

The response object contains Test Objects corresponding to each placement requested in the p13n_generated response.

Field

Description

control

True or False. Defines whether the user is assigned to the control.

eligible

True or False. Defines the eligibility of the user for an MVT test.

testId

The unique ID of the MVT that is running.

testName

The name of the MVT.

testType

The type of the MVT.

treatmentId

The unique ID of the treatment.

treatmentName

The name of the treatment.

Adding MVT Details in recsForPlacements API Response

For the recsForPlacements API, including MVT data in the API response is done by passing a parameter to the API request URL. For more information about recsForPlacements API, see recsForPlacements.

The following are the two parameters that can be passed into the recsForPlacements API requests to include details of the MVT that is currently running.

Parameter Name

Required or Optional

Description

includeMVTData

Optional

True or False. The default is False. If True, it includes details about any multivariate test (MVT) that is running.

Example: includeMVTData=true

Example JSON Response:

Copy
"mvt": [
  { 
"testId": 12953,
  "control": false, 
"treatmentId": 15707,
  "treatmentName":
 "T2 - recs OFF” 
}], 

includeMVTDetailedData

Optional

True or False. The default is False. If True, it includes details about any multivariate test (MVT) that is running. The “eligible” string parameter will define whether the user is eligible for an MVT test or not.

Example: includeMVTDetailedData=true

Example JSON Response:

Copy
"mvtDetailed": [
  { 
"eligible": true,
  "testId":
 12953,
  "control": false, 
  "treatmentId":
 15707, 
"treatmentName": "T2 - recs OFF” 
}
  ]

When set to True, for Placement Type of tests, the response will include a new section "mvtTreatments” providing MVT details that a placement is associated with.

Example JSON Response:

Copy
"placements":[
{
"mvtTreatments": [
{
"testType": "Placement”,
"testId": 55564,
"control": true,
"treatmentId": 60129,
"treatmentName": "swap_each_other"
}
]

Note: Only the treatments a placement is participating in will be provided as part of the response. If the Placement test includes multiple placements, then all the placements will include the “mvtTreatment” as part of the response. If multiple Placement tests are occurring for the same placement, then you will find multiple treatments in the response.