Using ABlyft to target the properties of the user, the browser or the operating system used is very easy and very flexible possible.
A JavaScript object is provided which allows to use these properties.

Introduction

Basic Targeting

For example, to target users who use a desktop browser, the following can be done:

if(User.browser.desktop){ return true; }

If you, for example, want to target on Firefox users using it on macOS:

if(User.browser.firefox && User.browser.mac){
   return true;
}

More advanced Targeting

If you want to specifically target only the cases checked by the quality assurance, it can be helpful to only allow browsers from a certain version to participate in the test. 

//Target on Internet Explorer with Version from 9 and up
if(User.browser.msie && User.browser.version >= 9){
   return true;
}

Documentation

Rendering engine flags

If detected, one of these flags may be set to true:

  • webkit - Chrome 0-27, Android <4.4, iOs, BB, etc.
  • blink - Chrome >=28, Android >=4.4, Opera, etc.
  • gecko - Firefox, etc.
  • msie  - IE <= 11
  • msedge - IE > 11

Safari, Chrome and some other minor browsers will report that they have webkit engines.Firefox and Seamonkey will report that they have gecko engines.

if(User.browser.webkit){
  // do stuff with safari & chrome & opera & android & blackberry & webos & silk
}

Device flags

If detected, one of these flags may be set to true:

  • mobile - All detected mobile OSes are additionally flagged mobile, unless it's a tablet
  • tablet - If a tablet device is detected, the flag tablet is set instead of mobile.
  • desktop - If it is neither a mobile nor a tablet 
//Only target mobile Devices (not Tablets)
if(User.browser.mobile){ return true; }

Browser flags

If detected, one of these flags may be set to true.  The rendering engine flag is shown in []'s:

  • chrome - [webkit|blink]
  • chromium - [webkit|blink]
  • firefox - [gecko]
  • msie
  • msedge
  • safari - [webkit]
  • android - native browser - [webkit|blink]
  • ios - native browser - [webkit]
  • opera - [blink if >=15]
  • samsungBrowser - [blink]
  • phantom - [webkit]
  • blackberry - native browser - [webkit]
  • webos - native browser - [webkit]
  • silk - Amazon Kindle browser  - [webkit]
  • bada - [webkit]
  • tizen - [webkit]
  • seamonkey - [gecko]
  • sailfish - [gecko]
  • ucbrowser — [webkit]
  • qupzilla — [webkit]
  • vivaldi — [blink]
  • sleipnir — [blink]
  • kMeleon — [gecko]
  • whale — [blink]

For all detected browsers the browser version is set in the version field.

OS Flags

If detected, one of these flags may be set to true:

  • mac
  • windows - other than Windows Phone
  • windowsphone
  • linux - other than android, chromeos, webos, tizen, and sailfish
  • chromeos
  • android
  • ios - also sets one of iphone/ipad/ipod
  • blackberry
  • firefoxos
  • webos - may also set touchpad
  • bada
  • tizen
  • sailfish

osname and osversion may also be set:

  • osname - for the OS flags detected above: macOS, Windows, Windows Phone, Linux, Chrome OS, Android, iOS, Blackberry OS, Firefox OS, WebOS, Bada, Tizen, Sailfish OS, and Xbox
  • osversion - for Android, iOS, MacOS, Windows, Windows Phone, WebOS, Bada, and Tizen.  If included in UA string.

iOS is always reported as ios and additionally as iphone/ipad/ipod, whichever one matches best.If WebOS device is an HP TouchPad the flag touchpad is additionally set.

//Only Target on Tablets based on iOS (newer than 9) or Android
if(User.browser.tablet){
   if((User.browser.ios && User.browser.osversion > 9) || User.browser.android){
      return true;
   }
}

More Information

The Targeting is based on bowser.js. You can find the documentation here: https://github.com/lancedikson/bowser/tree/v1.x  
Thanks to Denis Demchenko (lancedikson)!

Did this answer your question?