Rich-text Reply

Running an experiment for visitors with certain desktop window sizes

tscala 12-19-14

Running an experiment for visitors with certain desktop window sizes

Hello Optiverse,

 

I am attempting to set up an Audience to run an experiment for visitors with specific window sizes, for different Responsive Web Design (RWD) desktop views. I read in this Optiverse post (https://help.optimizely.com/hc/en-us/articles/201876450-Audience-conditions-descriptions-and-example...) about using custom JavaScript, though I would prefer to target the browser window width or viewport, instead of the screen size, or device/monitor width. The experiment I want to run would test large and small desktop monitors, not mobile or tablet devices.

 

Following the Optiverse post, I previewed audiences using screen.width < 1280 with window.innerWidth < 1280 on different monitors, both in Optimizely’s preview mode, and using the URL pattern [experiment URL]?optimizely_x[experiment ID]=1, the screen.width method worked as expected, but window.innerWidth did not. Does anyone have a suggestion on how to target an audience to a specific browser window size on a desktop monitor?

Level 2

JDahlinANF 12-19-14
 

Re: Running an experiment for visitors with certain desktop window sizes

Using ?optimizely_xNNNNNNN forces the variation code to run on that specific page, regardless of audience restrictions, URL targeting, or anything else.

Re: Running an experiment for visitors with certain desktop window sizes

Hi @tscala,

 

I created an audience with a custom JS condition of

window.innerWidth < 1280;

 and pushed an experiment live using this audience.  I am using a 15" MacBook Pro.  When I had Google Chrome set to my full screen width, I checked my window.innerWidth in the browser console and the value was 1309.  As expected, I was not included in my experiment.

 

I then shrunk my browser window to the left corner of my screen and checked my window.innerWidth in the browser console again.  I got a value of 806.  I refreshed the page, and I was included in the experiment.

 

Optimizely does not reload or recheck audience conditions if only the browser window size is changed.  You have to refresh the page and reload the Optimizely snippet so the audience check is made again.

 

Could you provide the experiment ID to our Support team by filing a case here?  We'll be happy to dig more deeply with you.  Thanks.

 

Harrison Krat
Solutions Architect | Optimizely, Inc.
harrison@optimizely.com