Sometimes you have information available the browser (IP addresses, cookies, local storage, user behavior) that's useful for segmenting visitors or campaign targeting. 

FunnelEnvy's "Browser Info" condition allows you to define rules that are executed in the browser. The following rules can be created through the user interface:

  • Brower / OS - Useful if targeting a particular browser and / or OS combination
  • Cookie - Targeting based on the name and value of a browser cookie.
  • Device Category - Mobile, Tablet or Desktop targeting
  • IP Address - Typically used for targeting / excluding visitors by IP address (for example internal company devices).
  • Custom Javascript Function - Javascript function that returns true or false. Used for determining segments based on arbitrary browser executed Javascript.
  • Javascript Variable - Targeting based on the name and value of a Javascript variable (must bet set before the FunnelEnvy script executes)
  • Referrer - The referring website present in the browser's HTTP header
  • Visitor - New or returning visitors
  • Language - Targeting by browser language

Creating a Browser Info Condition

Browser Info conditions are created the same was as other FunnelEnvy conditions. Navigate to Audiences -> Conditions -> New Condition and select "Browser Info" as the provider.

Click on "Create Condition" and you'll be presented with the standard rule builder interface with the options presented:

Examples

Segmenting Users Based on IP Address

A common requirement is to exclude internal traffic and devices from a campaign. The "IP Address" rule in the Browser Info audience can be used for that, assuming that internal IP addresses are known.

IP Addresses can be matched using equality and regex predicate conditions:

Custom Javascript Functions

Developers with Javascript knowledge can use the "Function is Evaluated" to execute Custom Javascript functions in the browser. If the function returns a Javascript "truthy" result the condition will evaluate to true and the visitor will be included in the condition.

Note: For performance reasons custom Javascript functions in Browser Info conditions are executed and evaluated synchronously. Be aware that asynchronous operations are currently not supported and will not be evaluated as part of the condition.

To create a custom javascript rule select "Function Is Evaluated" from the rule builder and click on the "Edit" text in the rule value.

This will open a Javascript editor window in which you can create and save your custom function.

Once created Browser Info conditions may be used within audiences similar to any other condition.

Example: Evaluating a Cookie Value 

Note: this is presented as an example. Cookie targeting can be done directly in the user interface with the Cookie rule.

function checkCookie() {

  var getCookie = function (name) {
      var value = "; " + document.cookie;
      var parts = value.split("; " + name + "=");
      if (parts.length == 2) return parts.pop().split(";").shift();
  };

  //returns true if value of cookie_name matches "expected_cookie_value"
  return getCookie("cookie_name") === "expected_cookie_value";
 
}

Did this answer your question?