Target a webpage in a web experience
You can target a webpage as well as the conditions under which a web experience runs on your organization's website.
To target a webpage in a web experience:
-
On the experience builder, click the Page Targeting tile.
Additional fields display.
-
The All Pages option is selected by default. This runs the web experience on every page of your organization's website. Alternatively, to target specific pages for the experience to run, click the Specific Pages option.
-
Click Add conditions.
-
In the Page Targeting pane, in the operator drop-down list, click one of the following operators:
Operator
Description
Contains
This operator executes the experience if the guest's URL contains the characters you specify in the text field.
Does not contain
This operator executes the experience if the URL does not contain the characters specified in the text field.
Does not end with
This operator executes the experience if the guest's URL doesn't end with the string you specify in the text field.
Does not equal
This operator executes the experience if the guest's URL does not match the string you specify in the text field.
Does not match Regex (Ignore Case)
This operator executes the experience if the Uniform Resource Identifier (URI) of the guest's current page isn't formatted in the specified Regular Expression (RegEx) pattern. This is useful if you want to use more than one contains conditions because you can match different data with just one Regular Expression. Enter the RegEx characters in the adjacent field. For more details on how to write RegEx characters, see the https://www.regular-expressions.info site.
Does not match Regex
Select this operator if you want the experience to execute if the Uniform Resource Identifier (URI) of the guest's current page isn't formatted and matches the exact case in the specified Regular Expression (RegEx) pattern. This is useful if you want to use more than one contains conditions because you can match different data with just one Regular Expression. Enter the RegEx characters in the text field. For more details on how to write RegEx characters, see the https://www.regular-expressions.info site.
TipThis operator is case sensitive. If you want to use RegEx and disregard the case, select the Does not match Regex (Ignore Case) operator.
Does not start with
This operator executes the experience if the guest's URL doesn't start with the string you specify in the text field. We often recommend using this operator rather than the Does not equal operator, because many URLs are appended with query parameters such as utm_source=email_campaign, making it difficult to know all the exact URLs to enter in the text field.
Ends with
This operator executes the experience if the guest's URL ends with the string you specify in the text field.
Equals
This operator executes the experience if the guest's URL is an exact match to the string you specify in the text field. If you use the Equals operator, the experience only runs if if the string is an exact match to the URL. This might not work as intended in preview mode or in production if the URL has query parameters or Urchin Tracking Module (UTM) parameters appended to it. If you use the Equals operator, when you preview the experience you must remove any query parameters that are not included in the text field you complete in Step 3. We often recommend using the Starts with operator for these reasons.
Matches Regex (Ignore Case)
This operator executes the experience if the Uniform Resource Identifier (URI) of the guest's current page is formatted in the specified Regular Expression (RegEx) pattern. This is useful if you want to use more than one contains conditions because you can match different data with just one Regular Expression. Enter the RegEx characters in the adjacent field. For more details on how to write RegEx characters, see the https://www.regular-expressions.info site.
Matches Regex
Select this operator if you want the experience to execute if the Uniform Resource Identifier (URI) of the guest's current page is formatted and matches the exact case in the specified Regular Expression (RegEx) pattern. This is useful if you want to use more than one contains conditions because you can match different data with just one Regular Expression. Enter the RegEx characters in the adjacent field. For more details on how to write RegEx characters, see the https://www.regular-expressions.info site.
TipThis operator is case sensitive. If you want to use RegEx and disregard the case, select the Matches Regex (Ignore Case) operator.
Starts with
This operator executes the experience if the guest's URL starts with the string you specify in the text field. We often recommend using this operator rather than the Equals operator, because many URLs are appended with query parameters such as utm_source=email_campaign, making it difficult to know all the exact URLs to enter in the text field.
-
In the text field, enter the string or characters required. This is not a URL. Depending on the operator you selected, you must enter the required string or characters, such as the partial page path, as shown in the following image:
-
To add additional target conditions to pages, click Add page.
-
To have Client-Side JavaScript (CSJS) executed on the browser to determine whether to execute the experience, click Add script.
The Advanced targeting pane displays.
-
Enter the Client-Side JavaScript (CSJS).
This can include truthy values. A truthy value is a value that translates to true when evaluated in a Boolean context.
ImportantAfter you define the targeting conditions, you must call the
targetingPassed()
function. You can use this function to run the experience on virtual page loads, even though the page is not physically loaded in the browser, as shown here:RequestResponse(function () { targetingPassed(); var pushState = history.pushState; history.pushState = function() { pushState.apply(history, arguments); targetingPassed(); }; })();
-
Click Save.
You return to the Page Targeting pane.
-
Click Save to close the pane.