Create Targets for Web Experiences

Once you create a target in Target Builder, you cannot edit it. For assistance viewing the backend settings for a target, submit a support ticket using the Monetate Technical Support portal (support.monetate.com).

Based on a Cookie

Before you build a target based on a cookie on your site, you must understand a few potential limitations of working with cookies.

The cookie you use for the target must have a domain attribute set to something other than the default hostOnly value. When the hostOnly value is in place, only servers within the your company's domain can request and read the cookie value. So long as the hostOnly value remains, the cookie target you build cannot function since cookie target evaluations are made by monetate.net servers.

To ensure the cookie target you build works correctly, you must ensure the script writing the cookie sets the domain attribute to remove the hostOnly flag so that monetate.net servers can evaluate the cookie for targeting purposes.

Furthermore, Monetate cannot read cookies set with httpOnly permission. This permission type only allows requests from the server that wrote the cookie, which then blocks the platform's target evaluation requests originating from monetate.net.

This permission is set with the domain and httpOnly parameters when the cookie is created.

Follow these steps to create a custom target based on a cookie.

  1. Click COMPONENTS in the top navigation bar and then select Targets.
  2. Click CREATE TARGET to launch Target Builder.
  3. Click one of the target options on the Cookietab:
    • Cookie Existence: Create a target based on the presence of a specific cookie. For example, you can target based on the presence of a cookie that signifies when a user is logged in.
    • Cookie Value (number): Create a target based on when a cookie value is greater than, less than, or equal to a certain numeric value. For example, you can target when the cookie for rewards points is greater than or equal to 500 so that you can offer that visitor a coupon.
    • Cookie Value (text): Create a target based on when a cookie contains a certain text value. For example, you can target based on a user-level cookie when the cookie value equals platinum.

      Text-based cookies are case-sensitive. For example, a comparison of TEXT and text does not return a match.

    The Cookie tab in Target Builder

  4. On the Details tab, begin typing into Cookie Name the name of the cookie you want to use, and then select one of the suggested cookies that is present on your site.

    Example of predictive text of existing cookies that appear for the 'Cookie Name' field on the Details tab in Target Builder

  5. If you selected Cookie Value (text) or Cookie Value (number) in step 3, then select an operator from Cookie Value, and then type the appropriate text or number to complete the value. If you input the value correctly, the preview bar at the bottom of Target Builder displays Target matched to the right of Enable Logging.

    Callout of the 'Cookie Value' operator selector and text field and of the 'Target matched' message in Target Builder

  6. If necessary, click Conditions to add URL-based conditions to the target if you only want it to work on certain pages.

    Using a site-level cookie eliminates the need for conditions. See Adding Conditions in this documentation for more information about condition options.

    The Conditions tab for a cookie-based target in Target Builder

  7. Give the target a title and description, and then enter a subcategory, if necessary. Click CREATE & EXIT.

    The final panel of Target Builder for a cookie-based target, with the Target Title field, Description field, and the 'CREATE & EXIT' button

Based on an HTML Element

Follow these steps to create a custom target based on an HTML element.

  1. Click COMPONENTS in the top navigation bar and then select Targets.
  2. Click CREATE TARGET to launch Target Builder.
  3. Click the HTML Element tab, and then select one of the target options:
    • Element Existence: Create a target based on the presence of a specific HTML element. For example, you can target based on the presence of a shopping cart error message when a site visitor tries to checkout with nothing in the cart.
    • Element Content (text): Create a target based on when an HTML element contains a certain text value. For example, you can target based on any HTML element that contains the word jacket.
    • Element Content (number): Create a target based on when an HTML element value is greater than, less than, or equal to a certain numeric value. For example, you can target when the HTML element for price is greater than or equal to a certain amount.

    The HTML Element tab in Target Builder

  4. Use the element selector to highlight and then select a DOM element on your site, and then click the forward arrow.

    If the Target Builder screen blocks your ability to select an element that appears at the top of your site, you can click the thumbtack icon to move Target Builder to the bottom of the browser window, or click the minimize icon to reduce Target Builder to just a navigation bar at the top or bottom of the browser window. Moving or minimizing the Target Builder interface does not end the DOM element selection process.

    Target Builder's Element Selector panel for an HTML Element-type target

  5. If you selected Element Content (text) or Element Content (number) in step 3, then select an operator from Element Content, and then type the appropriate text or number to complete the value. Leave the text field empty to match against an HTML element that exists but has no content.

    If you input the value correctly, the preview bar at the bottom of Target Builder displays Target matched to the right of Enable Logging.

    Callout of the 'Element Content' selector and text field on the Details tab in Target Builder for an 'HTML Element Content (text)' target

  6. If necessary, click Conditions to add URL-based conditions to the target if you only want it to work on a specific page type, URL, page category, or landing page or at a specific time. See Adding Conditions in this documentation for more information about condition options.

    The Conditions tab in Target Builder when building a target based on an HTML element

  7. Give the target a title and description, and then enter a subcategory, if necessary. Click CREATE & EXIT.

    The final panel of Target Builder for a target based on an HTML element, with the Target Title field, Description field, and the 'CREATE & EXIT' button

Based on a JavaScript Variable

Though JavaScript variables are mostly site-specific, you can create specific targets supplied by a browser.

Here are a few use cases for in-browser JavaScript targets:

  • navigator.userAgent — Target in-store kiosks or browsers not available in the WHO settings via the user agent string, such as Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10136
  • document.referrer — Target users from a particular URL within your site, such as the cart page, such as http://example.com/cart/
  • document.title — Target users who see a webpage with specific title text that appears in the browser

Follow these steps to create a custom target based on a JavaScript variable.

  1. Click COMPONENTS in the top navigation bar and then select Targets.
  2. Click CREATE TARGET to launch Target Builder.
  3. Click the JavaScript Variable tab, and then select one of the target options:
    • Variable Existence: Create a target based on the presence of a specific variable. For example, you can target based on the presence of a variable on your site that contains user history to determine if the site visitor has been to your site previously.
    • Variable Value (text): Create a target based on when a variable contains a certain text value. For example, you can target based on a variable that contains information on previously purchased products that contain the text value jacket.
    • Variable Value (number): Create a target based on when a variable value is greater than, less than, or equal to a certain numeric value. For example, you can target when a variable for an item's stock level is less than or equal to zero.

    The JavaScript Variable tab in Target Builder

  4. On the Details tab, begin typing into Variable Name the name of the variable you want to use, and then select one of the suggested variables that is present on your site.

    The 'Variable Name' field on the Details tab for a target based on a JavaScript variable in Target Builder, with predictive text of JavaScript variable names

  5. If you selected Variable Value (text) or Variable Value (number) in step 3, then select an operator from Variable Value, and then type the appropriate text or number to complete the value.

    If you input the value correctly, the preview bar at the bottom of Target Builder displays Target matched to the right of Enable Logging.

    Callout of the Variable Value selector and field on the Details tab for a target based on a JavaScript text variable in Target Builder

  6. If necessary, click Conditions to add URL-based conditions to the target if you only want to limit the target to a specific page type, URL, page category, or landing page or to a specific time.

    Using a site-level variable eliminates the need for conditions. See Adding Conditions in this documentation for more information about condition options.

    The Conditions tab in Target Builder

  7. Give the target a title and description, and then enter a subcategory, if necessary. Click CREATE & EXIT.

    The final panel of Target Builder for a target based on a JavaScript variable, with the Target Title field, Description field, and the 'CREATE & EXIT' button

Based on a Query Parameter

An experience based on a query parameter target is triggered only when the parameter is present in the URL. For example, if a customer arrives on your site with the query parameter present but then navigates to another page of the site, the experience may not fire. If you want the experience to persist for an entire session, use instead the Initial URL query string option in the Landing target type category.

Follow these steps to create a custom target based on a query parameter.

  1. Click COMPONENTS in the top navigation bar and then select Targets.
  2. Click CREATE TARGET to launch Target Builder.
  3. Click the Query Parameter tab, and then select one of the target options:
    • Query Parameter Existence: Create a target based on the presence of a specific query parameter. For example, you can target based on the existence of a query parameter from an email click-through that targets all users who arrived on your site from a link in an email.
    • Query Parameter Value (text): Create a target based on when a query parameter contains a certain text value. For example, you can target all users who arrive on your site from its Facebook page based on the source query parameter name with the value that equals Facebook.
    • Query Parameter Value (number): Create a target based on when a query parameter value is greater than, less than, or equal to a certain numeric value. For example, you can target the query parameter membership_level with a value greater than 1 and thus target all users who have a paid membership level, when level 1 signifies a free membership.

    The Query Parameter tab in Target Builder

  4. On the Details tab, type the parameter name into Query Parameter Name.

    The Query Parameter Name field is not predictive because the parameters are not found on your site.

    The 'Query Parameter Name' field on the Details tab for a 'Query Parameter Existence' target

  5. If you selected Query Parameter Value (text) or Query Parameter Value (number) in step 3, then select an operator from Query Parameter Value, and then type the appropriate text or number to complete the value.

    Do not include the equals sign (=) or the question mark (?) or the ampersand (&) between the parameters in either Query Parameter Name or Query Parameter Value.

    For example, if the URL contains the parameter ?source=email, enter source into Query Parameter Name and email into Query Parameter Value.

    Callout of the 'Query Parameter Value' selector and text field on the Details tab of Target Builder

  6. If necessary, click Conditions to add URL-based conditions to the target if you only want to limit the target to a specific page type, URL, page category, or landing page or to a specific time. See Adding Conditions in this documentation for more information about condition options.

    The Conditions tab in Target Builder

  7. Give the target a title and description, and then enter a subcategory, if necessary. Click CREATE & EXIT.

    The final panel of Target Builder for a target based on a query parameter, with the Target Title field, Description field, and the 'CREATE & EXIT' button

Based on JavaScript Code

A target you build with this option runs the specified JavaScript code that you enter, and then if the code returns a truthy value, it counts the target as having matched. The code you supply must therefore include return variable; or some other instruction to return the value.

Follow these steps to create a custom target based on JavaScript code.

  1. Click COMPONENTS in the top navigation bar and then select Targets.
  2. Click CREATE TARGET to launch Target Builder.
  3. Click the JavaScript Code tab, and then click Code returns true value.

    The JavaScript Code tab in Target Builder

  4. Input into JavaScript code the code that you want the target to run in search of a truthy value.

    The code you supply must include return variable; or some other instruction to return the value for the target to evaluate as a match or not.

    Callout of the 'JavaScript code' field on the Details tab

  5. Input into Timeout the total time in milliseconds you want the JavaScript code to spend trying to obtain a returned value if there's no immediate match.

    You cannot leave this field blank. Monetate recommends a timeout of 3 seconds, so you'd type 3000 into Timeout.

    Callout of the Timeout field on the Details tab of Target Builder for a target based on a JavaScript code

  6. Input into Interval how long in milliseconds each attempt to obtain a returned value should be.

    You cannot leave this field blank. Monetate recommends an interval of a half-second, so you'd type 500 into Interval.

    Callout of the Interval field on the Details tab of Target Builder for a target based on a JavaScript code

  7. If necessary, click Conditions to add URL-based conditions to the target if you only want it to work on a specific page type, URL, page category, or landing page or at a specific time. See Adding Conditions in this documentation for more information about condition options.

    The Conditions tab in Target Builder

  8. Give the target a title and description, and then enter a subcategory, if necessary. Click CREATE & EXIT.

    The final panel of Target Builder for a target based on JavaScript code, with the Target Title field, Description field, and the 'CREATE & EXIT' button

Adding Conditions

Conditions are used to specify the prerequisites for a user to be placed into a target group. You can use them as a further level of granularity to determine your target audience.

Condition Definition
Path starts with Targets users on every page that has a path that starts with the specified value
Path ends with Targets users on every page that has a path that ends with the specified value
Path regular expression Targets users on every page that matches the path of the specified regular expression
URL exact match Targets users only on a page that exactly matches the specified URL
URL regular expression Targets users on every page that matches the specified regular expression
URL with query string regular expression Targets users on every page that matches the query string of the specified regular expression

Previewing a Target

Custom targets are cached on Monetate's server so that they load on a page fast enough for the platform to act on them. As a result, a custom target may not work for up to 20 minutes after you active an experience using it.