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. Currently there are two rules that can be created:

  • 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 cookie, local storage or behavioral action.

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 two options, "Function is Evaluated" and IP Address".

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

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?