Rich-text Reply

Retrieving Date an Optimizely Account Was Created

seanemmel_ba 11-11-15

Retrieving Date an Optimizely Account Was Created

I'm wondering if there is a way client side (i.e. through JavaScript within Optimizely, like a custom JavaScript audience condition) to retrieve the information about when a user received an Optimizely endUserId cookie. I figure this information is stored on Optly's servers, but does anyone know if there is a way to determine this date from the front end? I know that the endUserId cookie contains a random number and a time stamp, so I'm wondering if there's a way to parse this time stamp using JavaScript.

 

Ultimately, we are trying to create an experiment that uses Audience Conditions to bucket a user into or out of an experiment, following this logic:

 

1) User must be a new visitor to the site (which is where Optly's default "New/Returning Visitor" condition could potentially come into play)

 

2) User must NOT be logged in (we can determine this from a data layer variable on the site)

 

3) Here's the tricky part: IF a user registers, but then LOGS OUT, we want to keep the user bucketed into the experiment for the next 7 days (namely, a LOGGED OUT visitor will be IN the experiment IF the visitor created an account within the past 7 days)

 

Some combination of cookies/values can be used in the audience JS to determine some of these things, but I'm at a loss as to how to determine ALL of these things--namely, a visitor would satisfy ALL the conditions above--and then get bucketed back into the experiment. 

 

The experience revolves around promo messaging. All new visitors that have not created an account should see messaging indicating a monetary credit (the monetary credit discount is built into the site logic already). This messaging indicates that you can get this credit IF you create an account. The incentive here is for users to create an account to receive this credit and thus drive conversion of purchasing products. Once the user creates an account, the credit will be there (again, the actual credit discount exists in the site logic). The user should now NO LONGER see the credit messaging. HOWEVER, if the user logs out, but returns back within 7 days of registering (STILL LOGGED OUT), the messaging should persist, indicating to log back in to receive your credit.

 

I may have phrased this poorly and can certainly expand if need. Anyone around here know of a reliable way to set this up? I probably should mention that we only have access to Optimizely and can NOT modify the on-site code in any way.

 

Thanks to anyone/everyone for any insight!

-- Sean
UI Developer @ Blue Acorn

optimizely developer certification
tedroddy 11-12-15
 

Re: Retrieving Date an Optimizely Account Was Created

Hi Sean,

The buckets cookie contains a JSON object with key:value pairs where the key is the experiment ID and the value is the variation ID. This JSON object is and stored as a URI component string. There is no timestamp. The cookie's expiration date may be the time you're looking for, but a cookie's time stamp is not exposed to document.cookie, so there is no way to get the expiration date using Javascript.

However, if you were to write a script and include this in your Experiment Javascript, I believe you can get the same type of functionality. This script would need to write a cookie containing a timestamp of creation. It could look for this cookie and NOT write it if it already exists. You would then have a cookie that you could use to determine the time a person first saw an experiment.

Do you think that could work for your needs?

Best,
Ted
Best,
Ted
Optimizely

Re: Retrieving Date an Optimizely Account Was Created

Hey Ted,

 

Thanks for the reply. I know that the endUserId cookie contains a timestamp in it, at least based on info indicated here: http://screencast.com/t/fMxvLWpDzu

 

However, I figured this wouldn't be accessible client-side. My suggestion was to do exactly what you have mentioned--namely, check for the presence of a cookie (that I would've created), and if it's not there, create it with a timestamp and give it a value of 'true' to indicate a new user. Then, after X days, change the cookie value to 'false'. The drawback here though is that the moment we would start the test, ALL visitors bucketed into the experiment would be considered "new" and have that experience, where, in reality, we really only want to target truly new visitors to the site (literally never been there before).

 

In any case, without additional information / help from the client, we simply can't achieve what we're trying to do. Therefore, we've made a separate recommendation and are going to follow tha route. In any case, I wanted to leave this post up here on the off chance someone could bring to light that there is a way to extract time info from the endUserId cookie... but it sounds like this is not possible.

 

Thanks again for the reply! Much appreciated.

-- Sean
UI Developer @ Blue Acorn

optimizely developer certification
JDahlinANF 11-12-15
 

Re: Retrieving Date an Optimizely Account Was Created

[ Edited ]

Can you identify any cookies that are created after page-load that you could use to identify someone who has not yet had a page load on your site?

 

For example, we use Sitecatalyst.  SiteCatalyst creates a persistent cookie (s_vi) which will not exist when the Optimizely code runs when a first time visitor enters the site.  You can look for the absence of this cookie as criteria for entering an experiment.  With this mechanism you can address your "only new visitors" criteria.

 

For keeping users in an experiment for only 7 days, you'd need to use a persistent cookie or a combination of session cookie and localStorage (if your site has http and https, localStorage is separate between each protocol.  You can bridge this gap by using a session cookie to set the value in the localStorage).  

 

On day 1, only users new since day 1 would be eligible... users that have been around 1-6 days prior are not grandfathered into the experiment.

Re: Retrieving Date an Optimizely Account Was Created

[ Edited ]

Nap0leon, thanks for the response and informative info re: SiteCatalyst. Unfortunately the client uses things built mostly in-house / custom (but we are unable to request dev work done on our behalf due to timeline issues and other things). As far as your other solution goes, that's essentially the approach I was going to take (see my reply to Ted). Unfortunately, it's this part that is not acceptable:

 

"users that have been around 1-6 days prior are not grandfathered into the experiment"

 

In any case, we're taking a different approach with this test, but I left this post on here in case anyone else had more information regarding Optly endUserId cookie timestamp (or something to that effect). Thanks again!

-- Sean
UI Developer @ Blue Acorn

optimizely developer certification