AB test use case script does not assume the same percentage of cases. | Community
Skip to main content
Level 2
June 24, 2021
Solved

AB test use case script does not assume the same percentage of cases.

  • June 24, 2021
  • 3 replies
  • 3436 views

Hello. I'm beginner.

The following AB test use case script does not assume the same percentage of cases.

 

https://experienceleague.adobe.com/docs/campaign-classic/using/sending-messages/a-b-testing/use-case/a-b-testing-uc-script.html?lang=en

 

Is there a way to control it in the the same percentage of cases?

For example, if the same percentage of cases, deliver A as the winner.

Thanks.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Manoj_Kumar

Hello @tokuchan 

 

To add this scenario you can have multiple query def statements for the specific delivery.

 

For this you will have to add @id='YOUR_DELIVERY ID' in the where condition.

Once you have the queries for two deliveries you can compare the result if the result if same then you can select Delivery A else let the winner delivery be the final delivery

 

Here is an example for the first delivery.

var deliveryA = xtk.queryDef.create( <queryDef schema="nms:delivery" operation="get"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id]"/> <node expr="[@workflow-id]"/> <node expr="[indicators/@estimatedRecipientOpenRatio]" alias="openRatio/> </select> <where> <condition expr={"@FCP=0 and [@workflow-id]= " + instance.id +" and @id="+DELIVERY_PRIMARY_KEY_HERE}/> </where> </queryDef>).ExecuteQuery()

Similarly you can create the query for delivery B and then compare the openRatio to decide your final delivery.

 

Thanks,

Manoj

3 replies

Manoj_Kumar
Community Advisor
Manoj_KumarCommunity AdvisorAccepted solution
Community Advisor
June 24, 2021

Hello @tokuchan 

 

To add this scenario you can have multiple query def statements for the specific delivery.

 

For this you will have to add @id='YOUR_DELIVERY ID' in the where condition.

Once you have the queries for two deliveries you can compare the result if the result if same then you can select Delivery A else let the winner delivery be the final delivery

 

Here is an example for the first delivery.

var deliveryA = xtk.queryDef.create( <queryDef schema="nms:delivery" operation="get"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id]"/> <node expr="[@workflow-id]"/> <node expr="[indicators/@estimatedRecipientOpenRatio]" alias="openRatio/> </select> <where> <condition expr={"@FCP=0 and [@workflow-id]= " + instance.id +" and @id="+DELIVERY_PRIMARY_KEY_HERE}/> </where> </queryDef>).ExecuteQuery()

Similarly you can create the query for delivery B and then compare the openRatio to decide your final delivery.

 

Thanks,

Manoj

Manoj     Find me on LinkedIn
tokuchanAuthor
Level 2
June 25, 2021
Hello @_manoj_kumar_, Thank you for your reply. How can I find out "DELIVERY_PRIMARY_KEY"? Also, I use "Recurring-delivery" instead of "Email" to get the winner. Is there anything different? Thank you.
tokuchanAuthor
Level 2
June 29, 2021

Hello @_Manoj_Kumar,  Thank you for reply.

I tried the following script in another workflow.

 

 

 

 

 

 

//deliveryA var deliveryA = xtk.queryDef.create ( <queryDef schema="nms:delivery" operation="select"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id] "/> <node expr=" (@workflow-id]"/> <node expr="[indicators/@reactivity]" alias="openRatio"/> </select> <where> <condition expr={"@id=" + DELIVERY_ID }/> </where> </queryDef>) var responceA = deliveryA.ExecuteQuery (); for each (var variable in responceA) { vars.winidA = variable.@id vars.winlabelA = variable.@label vars.openRatioA = variable.openRatio logInfo ("vars.winidA = [" + vars.winidA + "]"); logInfo ("vars.winlabelA = [" + vars.winlabelA + "1"); logInfo ("vars.openRatioA = [" + vars.openRatioA + "]"); } //deliveryB var deliveryB = xtk. queryDef.create ( <queryDef schema="nms:delivery" operation="select"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id]"/> <node expr=" [@workflow-id]"/> <node expr=" [indicators/@reactivity]" alias="openRatio"/> </select> <where> <condition expr={"@id=" + DELIVERY_ID }/> </where> </queryDef>) var responceB = deliveryB.ExecuteQuery (); for each (var variable in responceB) { vars.winidB = variable.@id vars.winlabelB = variable.@label vars.openRatioB = variable.openRatio logInfo ("vars.winidB = [" + vars.winidB + "]"); logInfo ("vars.winlabelB = [" + vars.winlabelB + "]"); logInfo ("vars.openRatioB = [" + vars.openRatioB + "]"); } //Compare open rates if (vars. openRatioA == vars.openRatioB) { var winner = deliveryA; vars.winner = "deliveryA"; } else if (vars.openRatioA > vars.openRatioB) { var winner = deliveryA; vars.winner = "deliveryA"; } else if (vars.openRatioA < vars.openRatioB) { var winner = deliveryB; vars.winner = "deliveryB"; //Confirm winner logInfo ("var winner = [" + winner + "]"); logInfo ("vars.winner = (" + vars.winner + "]");

 

 

 

I was able to get the open rate and compare it.

The winner was 1 and the loser was 0.

 

But, when I incorporated it into the Mail delivery workflow and added logic to duplicate the winner, I got an "Invalid XML Name" error.

 

 

 

//Confirmation of acquisition of deliveryId logInfo ("instance.vars.deliveryAid - [" + instance.vars.deliveryAid + "]"); logInfo ("instance.vars.deliveryBid = [" + instance.vars.deliveryBid + "]"); //deliveryA var deliveryA = xtk.queryDef.create ( <queryDef schema="nms:delivery" operation="select"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id]"/> <node expr="(@workflow-id] "/> <node expr="[indicators/@reactivity]" alias="openRatio"/> </select> <where> <condition expr={"@FCP=0 and [@workflow-id]=" + instance.id +"and @1716897=" + instance.vars.deliveryAid }/> </where> </queryDef>) var responceA = deliveryA.ExecuteQuery() for each (var variable in responceA) { vars.winidA = variable.@id vars.winlabelA = variable.elabel vars.openRatioA = variable.openRatio logInfo ("vars.winidA = [" + vars.winidA + "]"); logInfo ("vars.winlabelA = [" + vars.winlabelA + "]"); logInfo ("vars.openRaticA = [" + vars.openRatioA + "]"); } //deliveryB var deliveryB xtk.queryDef.create ( <queryDef schema="nms:delivery" operation="select"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id]"/> <node expr="[@workflow-id]"/> <node expr="[indicators/@reactivity]" alias="openRatio"/> </select> <where> <condition expr={"@FCF=0 and [@workflow-id]= " + instance.id +"and @1716897= + instance.vars.deliveryBid }/> </where> </queryDef>) var responceB = deliveryB.ExecuteQuery() for each (var variable in responceB) { vars.winidB = variable.@id vars.winlabelB = variable.@label vars.openRatioB = variable.openRatio logInfo ("vars.winidB = [" + vars.winidB + "]"); logInfo ("vars.winlabelB = [" + vars.winlabelB + "]"); logInfo ("vars.openRatioB = [" + vars.openRatioB + "]"); //Compare open rates if (vars.openRatioA = vars.openRatioB) { var winner = deliveryA; vars.winner = "deliveryA"; } else if (vars.openRatioA > vars.openRatioB) { var winner = deliveryA; vars.winner = "deliveryA"; } else if (vars.openRatioA < vars.openRatiOB) { var winner = deliveryB; vars.winner = "deliveryB"; } //Confirm winner logInfo ("var winner = [" + winner + "]"); logInfo ("vazs.winner = [" + vars.winner + "]"); //Below, the sample script var delivery = nms.delivery.create () delivery.Duplicate ("nms delivery|" + winner.@id) delivery.label = winner.@label + " final" delivery.operation_id = winner.@["operation-id"] delivery.wrorkflow_id = winner.@ ["workflow-id"] delivery.scheduling.validationMode = "manual" delivery.scheduling.delayed = 0 delivery.save () vars.deliveryId = delivery.id //Output new delivery ID logInfo ("vars.deliveryId = [" + vars.deliveryId + "]");

 

 

 

I'm not engineer...

I'm not familiar with javascript.

I don't know the cause.

Where is the mistake?

I'd really appreciate it if you could give me your advice.

Thank you.

tokuchanAuthor
Level 2
June 30, 2021

Hello @_manoj_kumar_,  I made some corrections.
But, I get an "Invalid XML Name" error.

 

 

//Confirmation of acquisition of deliveryId logInfo ("instance.vars.deliveryAid = [" + instance.vars.deliveryAid + "]"); logInfo ("instance.vars.deliveryBid = [" + instance.vars.deliveryBid + "]"); var deliveryAid = instance.vars.deliveryAid; var deliveryBid = instance.vars.deliveryBid; //deliveryA var deliveryA = xtk. queryDef.create ( <queryDef schema="nms :delivery" operation="get"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id] "/> <node expr="[@workflow-id]"/> <node expr="[indicators/@reactivity]" alias="openRatio"/> </select> <where> <condition expr-{"@id=" + deliveryAid }/> </where> </queryDef>).ExecuteQuery () for each (var variable in deliveryA) { var winidA = variable.@id var winlabelA = variable.@label var openRatioA = variable.openRatio logInfo ("var winidA = [" + winidA + "]"); logInfo ("var winlabelA = [" + winlabelA + "]"); logInfo ("var openRatioA = [" + openRatioA + "]"); } //deliveryB var deliveryB = xtk.queryDef.create ( <queryDef schema="nms:delivery" operation="get"> <select> <node expr="@id"/> <node expr="@label"/> <node expr="[@operation-id] "/> <node expr="[@workflow-id]"/> <node expr="[indicators/@reactivity]" alias="openRatio"/> </select> <where> <condition expr={"@id=" + deliveryBid }/> </where> </queryDef>).ExecuteQuery () for each (var variable in deliveryB) { var winidB = variable.@id var winlabelB = variable.@label var openRatioB variable.openRatio logInfo ("var winidB = [" + winidB + "]"); logInfo ("var winlabelB = [" + winlabelB + "]"); logInfo ("var openRatioB = [" + openRatioB + "]"); } //Compare open rates if (openRatioA == openRatioB) { var winner = "deliveryA"; } else if (openRatioA > openRatioB) { var winner = "deliveryA"; } else if (openRatioA < openRatioB) { var winner = "deliveryB"; } //Confirm winner logInfo ("var winner = [" + winner + "]"); //Below, the sample script var delivery = nms.delivery.create () delivery.Duplicate ("nms:delivery " + winner.@id) delivery.label = winner.@label + " final" delivery.operation_id = winner.@["operation-id"] delivery.wrorkflow_id = winner.@ ["workflow-id"] delivery.scheduling.validationMode = "manual" delivery.scheduling.delayed = 0 delivery.save () vars.deliveryId = delivery.id //Output new delivery ID logInfo ("vars.deliveryId = [" + vars.deliveryId + "]");

 


It seems that the delivery object cannot be duplicated.
cannot put @ FCP = 0, [@ workflow-id], [operation-id] in <where> </ where>.

I'd really appreciate it if you could give me your advice.
Thank you.

Manoj_Kumar
Community Advisor
Community Advisor
June 30, 2021
Your If else code should be if (openRatioA == openRatioB) { var winner = deliveryA; } else if (openRatioA > openRatioB) { var winner = deliveryA; } else if (openRatioA < openRatioB) { var winner = deliveryB; }
Manoj     Find me on LinkedIn