Rich-text Reply

Workaround for New vs Returning Users

JohnH 08-06-14
Accepted Solution

Workaround for New vs Returning Users

Is there a good wat to target new users vs. returning users now that the targeting setting has been removed from Optimizely?

Level 2

adzeds 08-07-14
 

Re: Workaround for New vs Returning Users

I thought that this was part of the new audiences however, upon checking I can see that it is not a condition.

Your alternative could be to drop a cookie when visitors arrive at your site and check for that as an audience to flag if the visitor is new or returning.

May advice would be to check this into the 'Product Ideas' section and ask the to add it as a condition in the Audiences. I will give it a vote up for you as I can see me needing this to.
David Shaw
Level 11
MeganBush 08-07-14
 

Re: Workaround for New vs Returning Users

Hi John, I reached out to Optimizely about this feature earlier this week, and they replied and said that they are currently revamping the feature in order to make it more versatile and less confusing.

 

In the meantime, David is correct, the best/easiest work around would be to set up a new experiment and using the Global Javascript, drop a cookie and use a negative targeting conidition for customers who don't have that cookie.

 

For more thorough targeting, I believe you could use custom javascript targeting to look to the Google Analytics cookie and compare the timestamps for the _utma cookie for your domain. I haven't actually done this, so I'm not sure of the challenges that could arise, its just an option we explored internally.

 

I'll definitely vote up that feature suggestion as well!

Megan Bush
JohnH 08-07-14
 

Re: Workaround for New vs Returning Users

Thanks @adzeds and @MeganBush - please upvote the product suggestion here & add any comments you may have. 

Level 2

Re: Workaround for New vs Returning Users

Thanks @MeganBush for the clarification on this! To build on this a little more I have provided some JavaScript you can place in a custom JavaScript Audience to replicate the old feature. 

 

Click on Audiences at the top and create a new Custom Javascript Option:

Custom Javascript Audience.png

 

Then copy this code into the text box

 

var cookieName = "optimizely_custom", newVisitCookieName = "optimizelyBuckets";       //REQUIRED
var newVisitCookieValue = ""; //OPTIONAL
function setCookie(c_name,value,exdays,c_domain) {
    c_domain = (typeof c_domain === "undefined") ? "" : "domain=" + c_domain + ";";
    var exdate=new Date();
    exdate.setDate(exdate.getDate() + exdays);
    var c_value=escape(value) + ((exdays==null) ? "" : "; expires="+exdate.toUTCString());
    document.cookie=c_name + "=" + c_value + ";" + c_domain + "path=/";
}
var optimizely_match = false;
var cookieMatch = document.cookie.match(cookieName + "=([^;]*)");
if (!cookieMatch) {
var bucketCookieMatch = document.cookie.match(newVisitCookieName + "=([^&]*)");
if (!bucketCookieMatch) {
optimizely_match = true;
setCookie(cookieName, newVisitCookieValue, 60);
}
} else {
optimizely_match = true; 
} 
optimizely_match;

 

Optimizely
charles 08-09-14
 

Re: Workaround for New vs Returning Users

kind of a shot in the dark [1], but would it not be possible to use an http etag header (conditional request) to ascertain if a visitor is new?

[1] i am an http noob, but at first thought this makes sense Smiley Happy
Level 2

Re: Workaround for New vs Returning Users

[ Edited ]

 @charles you can actually use any method you would like to determine new vs returning. One of the reasons we took it out and we are revisitng the option is because New vs Returning means something different to everyone. The code I provided is only one of any number of ways you could determine New vs Returning. 

 

The way we used to determine New vs Returing was based on if the user had come to the page when the snippet was installed. So if a user came to your site and the snippet was installed, any time the user came back to the site in the same browser and same cookies, that user would always be seen as a retuning visitor. So this user would no longer see any new expeirements you create that were for new users. 

 

The best way to accomlish this is to have your own definition of what you consider a new vs returning user then build JavaScript around that definition. Many users then set a cookie of their choosing and then build audiences around that cookie. This way you can control who is a new user and who is a returning user based on your criteria for each expeiement, domain, or campaign. 

 

Does anyone have any suggestions on how they determine New vs Returning users?

Optimizely
Amanda 08-14-14
 

Re: Workaround for New vs Returning Users

Hi everyone! Our Product team has released the New vs returning visitors as a feature in Audiences, although it works slightly different than before. Check out the details in our Support Article here.

 

Let us know if you have any questions or feedback! 

Optimizely
livingstone 01-23-15
 

Re: Workaround for New vs Returning Users

[ Edited ]

To avoid doubt could you confirm whether this javascript audience will contain new users (those who Optimizely have never encountered before) AND those who subsequently return after being noted as "new". In other words, I don't want to include anyone who knows what the site usually look like (exclude returning users who first visited before we create this audience) ... but I still want to keep showing it to those 'new users' who 'return' after we created this new audience... Hopefully that makes sense?

Joel_Balmer 01-23-15
 

Re: Workaround for New vs Returning Users

Hi @LIVINGSTONE,

If you're referring to the above javascript by @BRADTAYLORSF, then this is a 60 day cookie that considers a new visitor if they are seeing your page with the snippet installed for the first time.

The condition you can use as-standard now, that @Amanda mentioned, is the same but is now session based.

As @bradtaylorsf mentions above, if you want new visitors to be considered new if they haven't ever been to your site before, you should define your own version of what's new. This would usually be a cookie, so you can check for this with a cookie audience condition, or a javascript condition, where you can for instance check if some variable exists. NB: This variable must be available before the snippet, unless you are using conditional activation, which you can find more information about here:

https://help.optimizely.com/hc/en-us/articles/200040225#conditional

I hope that helps!
livingstone 01-23-15
 

Re: Workaround for New vs Returning Users

Thanks for the reply @Joel_Balmer.

Something about Optimizely's implementation of 'new users' must be lost on me as I really can't see when it would ever be useful to only show someone an experiment once and once only before reverting back. Surely you need a consistent view to gain consistent behaviour. (If someone sees altered content, they should see that on their return to your site... until you stop the experiment otherwise you're bloating the 'original' case)

Anyway... To implement my own definition of 'new' I could start setting a cookie as you suggest but this would still show the experiment to everyone who's been to our site before that point and I can't wait a month to let that bed in.

What I need is to be able to check for the presence of a cookie that Optimizely is already using (our Optimizely snippet has been in place for other experiments for months) but I'd obviously need to be able to check for the presence of that cookie before Optimizely added it for first time users... Is that even possible? And if so, do you know how?

Or is it possible to get at the 'created' date associated with any cookies that google analytics might use? That would solve the problem too...

Thanks!
Amanda 01-23-15
 

Re: Workaround for New vs Returning Users

[ Edited ]

@livingstone - The best way to accomplish what you're hoping to do is the following

 

1) Set up an audience that targets "new" visitors. This will make sure you include all the people who have never been to your site before. 

2) Set up an OR audience that looks the cookie optimizelyBuckets & the a value that contains experiment ID. This will catch all the people who saw the experiment from audience 1 above. (You can read about the optimizelyBuckets cookie in our support article heresupport article here)

 

Here's more of an explanation: A visitor comes to your site and is included in your experiment based on the New audience. Because they are included in the experiment, they are cookied with this experiment ID. When the visitor returns to your site, they would normally not be included in the experiment because they are no longer new, but your audience #2 accounts for that. It detects that this visitor has already been included in the experiment based on the cookie value and so the experiments runs. The visitor will see the same variation they saw before. 

 

Does this help clear things up? 

 

For example, if your experiment ID was 12345, here is what your audience conditions would look like:

Screen Shot 2015-01-23 at 11.20.23 AM.png

Optimizely
livingstone 01-27-15
 

Re: Workaround for New vs Returning Users

Thanks @Amanda, this is exactly what I needed.