Split Targeting Rules supports matching Regex (Regular Expression) to serve specific treatment, Regex is a powerful tool to filter a wide spectrum of population with one line of text.
Its recommended to test your Regex on an external tool to verify it will work correctly, here is one suggested site
Below are few useful examples
Target Specific App major version
If you wish to target users with App version greater than or equal to 4.5 to get the "on" treatment, this regex could be used for matching the "appVersion" attribute:
([5-9]\.[0-9]|[4]\.[5-9]).*
Example of passing the appVersion attribute for Javascript SDK:
var attributes = {appVersion: "4.567.33"};
Target all population of specific domain of user emails
For this example, to serve "on" treatment for all employees of split.io, we can use the Regex below for "email" attribute:
@split\.io$
Example of passing the email attribute for Javascript SDK:
var attributes = {email: "bilal@split.io"};
Target Users on Chrome version 20 and later
This example we are serving our "on" treatment to Chrome users only, however we want to only use Chrome versions 20 and later for compatibility reasons. The attribute passed is "userAgent":
Chrome\/[2-9][0-9]\.
Example for Javascript SDK:
var attributes = {userAgent: "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.93 Safari/537.36"};
Target English speaking Users World Wide
An experiment is designed for English speaking users in any country, by detecting the default language setting in the browser, the attribute passed is "navigatorLanguage"
en-.
Example for Javascript SDK:
var attributes = {navigatorLanguage: navigator.language};
Target specific URL
To target an experiment that applies only to users that land on a specific URL, the extracted URL can be passed as an attribute to the targeting rule:
http:\/\/mysite\.com\/my_url
Example for Javascript SDK:
var attributes = {url: window.location.href};
Comments
0 comments
Please sign in to leave a comment.