Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges


Mutually Exclusive Return Vsistor


Level 3


I am working on re-targeting campaign.

New Visitor to the campaign X : Will see Experience A

Return Visitor to the campaign X : Will see Experience B or C

I am facing challenge with making making B & C mutually exclusive..

Profile script codes are as follows any help would be appreciated:

To identify if the user is new or returning:

if (page.url == "XY"){


return true;



return false;


To make Experience B and C Mutually exclusive :

if (!user.get('HomePageReturnprofileTest') == true) {

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

if (ran_number <= 49) {

return 'GroupB';

} else {

return 'GroupC';



It only seems to be working for two experience i.e new v/s returning visitor. As soon as i add third experience to the XT campaign. The campaign stops working. 


1 Accepted Solution


Correct answer by
Level 3


This approach worked !!!

Thanks a lot

View solution in original post

0 Replies


Employee Advisor

Hi YogitaBist,

If I'm following you correctly, you may not need a profile script for this. It looks like you want to test Experience B against Experince C for return visitors. And if they are a new visitor show only Experience A . I'd maybe treat this as 2 activities.

  1. For new visitors (we have an out-of-the-box profile for new visitors so don't have to write a profile script for this--just use 'new visitor' under the 'visitor profile' in the Audience creation drop down list). This activity has only one experience, Experience A.
  2. For returning visitors (could also use our out-of-the-box profile for return visitors) they qualify for a AB test (Experience B and C). Target will automatically mutually exclude the visitors between the 2 experiences in an AB test. So you should not need a profile script to assign random groups.

Let me know if I've missed the boat completely though.


Level 3

ryanr8 yes you got it, absolutely right

Though !

#1 When i created An activity in target for Experience B & C [using out-of-the-box profile for return visitors], it didn't work.

I have been trying doing the above activity using XT campaign


1) New and returning visitor need to be part of the same activity [Reason #1 didn't work]

2) A/B set up does not gives the option of having two different audiences for recipes in a single activity but XT campaign does

I have not been able to randomize Experience B and Experience C in an XT campaign..

Is there any option to do the above using an XT campaign ?

XT campaign set up

New Visitor : Experience A

Return Visitor : Experience B or C


Employee Advisor

Okay, if you need both new and return visitors under the same activity for some reason you can use an XT activity to achieve this. Here's how I'd set it up:

1. Create a profile script to randomly assign visitors a number between 1-100 (this will be reusable for future tests too). In my example name it randVisitorNum. Only assign a number to a visitor if it hasn't already been assigned (you don't want the visitor's number to change each page view). Here's what the script should look like:

if (!user.get('randVisitorNum')) {

  return String(Math.floor(Math.random()*100+1));


2. Then create an audience for people from 1-50 and a second audience for people from 51-100. Like so:


3. Setup your XT activity. With a the "new visitor" audience on Exp A. Then use a "combined audience" for Exp B (return visitor + mutually exclusive Audience A (1-50)), and similar for Exp C.

That should get you want you are trying to achieve. Let me know how it works.


Correct answer by
Level 3


This approach worked !!!

Thanks a lot