Skip to main content
RichRelevance

Integration: A/B Treatments

When you’re running your own A/B test, it’s important that the Algonomy system knows what treatment a user is in. Setting the A/B treatment allows the Algonomy code to stay the same across both treatments. It also gives Algonomy, the ability to verify proper split, verify users are not swapping treatments, and monitor the test as it progresses.

The treatment is typically set to “a” or “b.” Algonomy needs to know what treatment will be showing Personalization Cloud recs. We configure the non-Personalization Cloud display side to not return or display Personalization Cloud recs.

JavaScript Integration

How To Make This Code Work For You

  1. Create the integration code on each of the pages on your site, following the HTML integration and JSON integration guides.
  2. Add this function to your integration code:
Function Requirement
R3_COMMON.setMVTForcedTreatment(‘A_OR_B’); Replace A_OR_B with identifiers for the treatment the current user is in. You need to work with your Algonomy team to choose treatment names. (Usually they’re simply A and B.)

Sample Code

Call setMVTForcedTreatment() in the Primary Code Block.

JSON

<!-- Place this code inside the <body> element as close to the top as possible -->
<script charset="utf-8" type="text/javascript">
  var R3_COMMON = new r3_common();
  R3_COMMON.setApiKey('abcd5432e1');
  R3_COMMON.setBaseUrl(window.location.protocol+'//integration.richrelevance.com/rrserver/');
  R3_COMMON.setClickthruServer(window.location.protocol+"//"+window.location.host);
  R3_COMMON.setSessionId('6B4D397B');
  R3_COMMON.setUserId('10987');  // if exists, set it; if not, set it as session ID
  
  // here's an example requesting recommendations for 1 page area
  R3_COMMON.addPlacementType('home_page.rr1');
 
  var R3_HOME = new r3_home();
 
  R3_COMMON.setMVTForcedTreatment(‘A’);
 
  rr_flush_onload();
  
  r3();
</script>

APIs

External A/B treatments are not supported via API.

  • Was this article helpful?