Use profile scripts to test mutually exclusive activities

You can use profile attributes in Adobe Target to set up tests that compare two or more activities but do not let the same visitors participate in each activity.

Testing mutually exclusive activities prevents a visitor in one activity from affecting the test results for the other activities. When a visitor participates in multiple activities, it can be difficult to determine whether positive or negative lift resulted from the visitor’s experience with one activity, or if interactions between multiple activities affected the results of one or more of the activities.

For example, you can test two areas of your ecommerce system. You might want to test making your “Add to Cart” button red instead of blue. You might also test a new checkout process that reduces the number of steps from five to two. If both activities have the same success event (a completed purchase), it can be difficult to determine whether the red button improves conversions, or whether those same conversions were also increased because of the improved checkout process. By separating the tests into mutually exclusive activities, you can independently test each change.

Be aware of the following information when using one of the following profile scripts:

  • The profile script must run before the activity launches and the script must remain unchanged for the duration of the activity.
  • This technique reduces the amount of traffic in the activity, which might require the activity to run longer. You must account for this fact when you estimate the duration of the activity.

Setting up two activities

To sort visitors into groups that each see a different activity, you must create a profile attribute. A profile attribute can sort a visitor into one of two or more groups. To set up a profile attribute called “twogroups,” create the following script:

if (!user.get('twogroups')) {
    var ran_number = Math.floor(Math.random() * 100);
    if (ran_number <= 49) {
        return 'GroupA';
    } else {
        return 'GroupB';
    }
}
  • if (!user.get('twogroups')) determines whether the twogroups profile attribute is set for the current visitor. If they do, no further action is required.

  • var ran_number=Math.floor(Math.random() *100) declares a new variable called ran_number, sets its value to a random decimal between 0 and 1, then multiplies it by 100 and rounds it down to create a range of 100 (0-100), useful for specifying a percentage of visitors who see the activity.

  • if (ran_number <= 49) begins a routine that determines which group the visitor belongs to. If the number returned is 0-49, the visitor is assigned to GroupA. If the number is 50-100, the visitor is assigned to GroupB. The group determines which activity the visitor sees.

After you create the profile attribute, set up the first activity to target the desired population by requiring that the user profile parameter user.twogroups matches the value specified for GroupA.

NOTE
Choose an mbox early on the page. This code determines whether a visitor experiences the activity. As long as an mbox is encountered first by the browser, it can be used to set this value.

Set up the second campaign so the user profile parameter user.twogroups matches the value specified for GroupB.

Setting up three or more activities

Setting up three or more mutually exclusive activities is similar to setting up two, but you must change the profile attribute JavaScript to create a separate group for each activity and determine who sees each one. The random number generation is different, depending on whether you create an odd or even number of groups.

For example, to create four groups, use the following JavaScript:

if (!user.get('fourgroups')) {
    var ran_number = Math.floor​(Math.random() * 100);
    if (ran_number <= 24) {
        return 'GroupA';
    } else if (ran_number <= 49) {
        return 'GroupB';
    } else if (ran_number <= 74) {
        return 'GroupC';
    } else {
        return 'GroupD';
    }
}

In this example, the math used to generate the random number that assigns a visitor to a group is the same as it is with only two groups. A random decimal is generated, then rounded down to create an integer.

If you create an odd number of groups, or any number that 100 does not divide evenly into, you should not round the decimal down to an integer. Not rounding the decimal enables you to specify non-integer ranges. You do this by changing this line:

var ran_number=Math.floor(Math.random()*100);

to:

var ran_number=Math.random()*100;

For example, to place visitors in three equal groups, use the following code:

if (!user.get('threegroups')) {
    var ran_number = Math.random() * 100;
    if (ran_number <= 32.33) {
        return 'GroupA';
    } else if (ran_number <= 65.66) {
        return 'GroupB';
    } else {
        return 'GroupC';
    }
}
AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: Use profile attributes in Adobe Target to set up tests that compare two or more activities but do not let the same visitors participate in each activity.

Intents:

  • Understand why testing mutually exclusive activities prevents a visitor in one activity from affecting the test results for the other activities.
  • Set up a profile attribute that sorts visitors into two groups, and target one activity at each group.
  • Set up a profile attribute for three or more mutually exclusive activities.
  • Choose how the random number is generated depending on the number of groups.

Glossary:

  • Mutually exclusive activities (product-specific): activities compared in a test that do not let the same visitors participate in each activity.
  • Profile attribute (product-specific): an attribute that can sort a visitor into one of two or more groups.

Guardrails:

  • The profile script must run before the activity launches, and the script must remain unchanged for the duration of the activity.
  • Testing mutually exclusive activities with this technique reduces the amount of traffic in the activity, which might require the activity to run longer. You must account for this fact when you estimate the duration of the activity.

Terminology:

  • Canonical name: Adobe Target

FAQ:

  • Why test mutually exclusive activities? When a visitor participates in multiple activities, it can be difficult to determine whether positive or negative lift resulted from the visitor’s experience with one activity, or whether interactions between multiple activities affected the results of one or more of the activities.
  • How do I sort visitors into groups that each see a different activity? You must create a profile attribute, which can sort a visitor into one of two or more groups.
  • How do I target an activity at a group when I set up two activities? Set up the first activity to target the desired population by requiring that the user profile parameter user.twogroups matches the value specified for GroupA. Set up the second campaign so that the user profile parameter user.twogroups matches the value specified for GroupB.
  • Which mbox do I use to set the profile attribute value? Choose an mbox early on the page. This code determines whether a visitor experiences the activity. As long as an mbox is encountered first by the browser, it can be used to set this value.
  • What changes when I set up three or more activities? You must change the profile attribute JavaScript to create a separate group for each activity and determine who sees each one. The random number generation is different, depending on whether you create an odd or even number of groups.
  • When should I not round the decimal down to an integer? If you create an odd number of groups, or any number that 100 does not divide evenly into, you should not round the decimal down to an integer. Not rounding the decimal enables you to specify non-integer ranges.

Examples:

  • Ecommerce system with two areas to test: making the “Add to Cart” button red instead of blue, and a new checkout process that reduces the number of steps from five to two. If both activities have the same success event (a completed purchase), it can be difficult to determine whether the red button improves conversions, or whether those same conversions were also increased because of the improved checkout process. Separating the tests into mutually exclusive activities enables you to test each change independently.
  • Profile attribute called “twogroups”: a script that returns GroupA or GroupB to sort visitors into two groups, one for each activity.
  • Profile attribute called “fourgroups”: a script that returns GroupA, GroupB, GroupC or GroupD, given on the page as the JavaScript to use to create four groups.

Personas:

  • marketer: Can create a profile attribute called twogroups that sorts visitors into two groups. Can set up the first activity so that user.twogroups matches the value specified for GroupA, and the second activity so that it matches GroupB. Where: “Setting up two activities”.
  • developer: Can change the profile attribute JavaScript to create a separate group for each activity, for example fourgroups returning GroupA, GroupB, GroupC or GroupD from Math.floor(Math.random() * 100). For an odd number of groups, or any number that 100 does not divide evenly into, should use Math.random() * 100 without rounding. Where: “Setting up three or more activities”.

Onboarding:

  • Level: Intermediate, Experienced
  • First minimal step: Create a profile attribute script, for example one called twogroups, that sorts visitors into GroupA or GroupB.
recommendation-more-help
target-help-main