Supported Operators

About Supported Operators

SAS Customer Intelligence 360 supports string operators, numeric operators, CSS selectors, and regular expressions in parts of the user interface.

Take note of the following guidelines when you use these operators:

  • Separate events with a comma (,). Separate other types of multiple values with a semicolon (;). The comma or semicolon is equivalent to or.
  • The operators are case insensitive. For example, if you enter Starts with: operator or starts with: operator, the text Starts with: operator is displayed.

String Operators

You can use the string data type in spot attributes, event attributes, segments, customer data, and imported lists.

String Operators

Operator

Description

Example

Typed values

Matches the listed values.

marketing

marketing; creatives; coupon

Starts with

Matches anything that starts with the values listed after the colon. If you enter Begins with, the text is displayed as Starts with.

Starts with: marketing

Starts with: marketing; creatives; coupon

Ends with

Matches anything that ends with the values listed after the colon.

Ends with: marketing

Ends with: marketing; creatives; coupon

Contains

Matches anything that contains the values listed after the colon.

Contains: marketing

Contains: marketing; creatives; coupon

Excludes

Excludes the items after the vertical bar (|).

Excludes|marketing

Excludes|marketing; creatives; coupon

Numeric Operators

Numeric Operators

Operator

Description

Example

to

-

Expresses a range. The hyphen (-) is displayed as to.

1 to 5

1 to 5; 20 to 40

>

Greater than.

>34

>3 to 7

<

Less than.

<-6

5 to <10

Exclude

Excludes the listed values.

Exclude|1; 2; 3; 4

Exclude|1 to 5

CSS Selector Paths

Overview of CSS Selector Paths

In SAS Customer Intelligence 360, page elements are identified by CSS selector paths (also called selectors or selector patterns). A selector path identifies elements on the page based on their position in the hierarchy in the Document Object Model (or DOM) and other attributes such as name, ID, and classes. Selectors paths can be useful when you need to specify a specific element or set of elements on a page.

The basic structure of a selector path is this: element_level1 > element_level2 > element_level3, where each element is at a different level of the document hierarchy.

Here are some basic guidelines and operators for selectors paths:

  • Paths can be absolute (where they specify the entire document tree to your desired element) or relative (where they specify only the surrounding elements).
    • html > body > div > p is an absolute selector, because it starts at the root of the document (the <html> element). So a <p> element is selected only if it occurs in this exact position of the document hierarchy.
    • div > p is a relative selector. This selector path selects any <p> element that is inside a <div> element, regardless of where the <div> element is.
  • The . operator selects an element based on its class attribute. For example, the selector div > p.normalFont selects only <p> elements that are inside a <div> element and have a class attribute equal to normalFont.
  • The # operator selects an element based on its ID attribute. For example, the selector div > p#firstOne selects only <p> elements that are inside a <div> element and have an ID equal to firstOne.
  • The [] operators specify additional conditions that must be met (similar to an AND condition or a set intersection). For example:
    • The selector p > a[target] selects only <a> elements that have a target attribute and are children of a <p> element.
    • The selector p > a[target=_blank] selects the same <a> element as the previous example, but the target attribute must be equal to _blank.
    • :nth-child() is a pseudo-class selector that can match elements based on a position relative to their siblings. For example, #pageContent > div.my-scope > p:nth-child(5) selects a <p> element that is the fifth child of a <div.my-scope> element.

For more operators and examples, see CSS Selector Reference (external link).

Also, SAS Customer Intelligence 360 uses selector paths that are similar to paths that are generated by Google Chrome. So, you can use Google Chrome to get examples of selector paths. For more information, see Get Started With Viewing And Changing The DOM (external).

Using Selector Paths in SAS Customer Intelligence 360

You can use selector paths in SAS Customer Intelligence 360 for a variety of features, such as selecting elements for event triggers or selecting spots for a task. In most items that enable you to specify a selector path, you can click Select page elements to browse a page and select an element. The selector path is then generated for you.

Note: In many cases, selector paths that are generated by a browser might be too specific to trigger a common event (such as a click event that appears on multiple pages). To generalize the selector path, you can manually edit the generated selector to customize which elements are included. When you manually edit the selector in the browser, the page highlights all elements that match your new selector path.

When you define the click event in the user interface, you can use two methods to work with selector paths and the Target: selectorPath option:

  • String comparison. When you use the operators CONTAINS, STARTS WITH, ENDS WITH, and REGEX, SAS Customer Intelligence 360 captures the complete CSS selector path for the click, starting with the first element under the <body> element. The system transforms this path into a static string that is sent as an attribute with the event. Based on the match criteria, the static string is then compared to the value that you set for the Target: selectorPath field.

    However, SAS Customer Intelligence 360 might be unable to match the selector path that you define in the UI if your site adds or removes elements dynamically (including attributes or classes) or uses custom attributes in the DOM. For example, the captured selector path might not include a dynamic class value or a custom attribute that you need.

  • CSS selector syntax. When you use the EQUALS operator, you can use CSS selector syntax (external) to compare selector paths. This method is more flexible, because it enables you to use CSS wildcard patterns and match custom attributes in the DOM.

    For example, assume you want to record when someone clicks a donate button, and you need to search for the custom attribute named data-tracking-attr. This attribute is not part of the standard selector path, so it is not captured in the static string that is generated by the system.

    In this example, the value of the data-tracking-attr attribute must start with “Donate”, so you could set the Target: selectorPath field to this value:

    [data-track-attr^="Donate]

Here are some best practices to follow when you create or modify CSS selector paths:

  • To match a single (or exact) element, match it based on an ID attribute or name attribute when possible. If you can control how elements on your site are defined, assign IDs and name attributes to elements where they are useful (such as forms).
  • Make the selectors as relative as possible. Page elements and document structures can change dynamically (especially when you use responsive design), so selector paths should not rely on specific levels of the DOM or attributes that might not be populated.

    For example, you might have an Add to Cart button on your page like this example:

    <div class="productDisplay" id="product100130230223">
      <button class="button-addtocart" id="product100130230223">Add To Cart</button>
    </div>

    The ID values of each element might be hardcoded or dynamically populated based on the products that are displayed. If you use a web browser to highlight this element in the DOM, the selector path would include the product-specific information.

    To make the selector path more general, remove the product-specific attributes and use a combination of the DOM and attributes that are common: div[class="productDisplay"] > button[class="button-addtocart"]

  • When you define a click event in the UI that is based on a custom attribute that is higher in the DOM, use the Target: selectorPath with the EQUALS operator to take advantage of CSS selector syntax.

    For example, assume you have this HTML snippet on your page, and you need to use the data-id attribute:

    <a href="http://somelink.com/productsPage" data-id="productLink">
      <span class="buttonStyle">
        <button class="anotherSpan">Products</span>
      </span>
    </a>

    You could then use Target: selectorPath with the EQUALS operator to set this selector path:

    [data-id="productLink"] > span > button
  • When you select an element for spot placement, make sure that you select the element (such as a <div>) that is the parent of the actual spot’s content. If you use the page browser and select an existing spot, you might inadvertently select an element in the spot itself, rather than the container element that should be matched.

Regular Expressions

Regular expressions (abbreviated as regex or regexp) are sequences of characters that are used to match patterns in text. Regular expressions are typically used to find complex patterns that a basic search cannot find. For more background information, see Regular expression on Wikipedia.

This table contains some examples of regular expressions:

Examples of Regular Expressions

Description

Example

Match a domain or host name that has valid characters only and top-level domains that are specified in the expression.

^[a-zA-Z0-9\-\.]+\.(com|org|net|mil|edu|COM
|ORG|NET|MIL|EDU)$

Match any internet URL.

((mailto\:|(news|(ht|f)tp(s?))\://){1}\S+)

Match double-digit numbers that range from 10 to 99.

[1-9][0-9]

Follow these guidelines when using regular expressions:

  • To match page URLs, regular expressions should match case-sensitive patterns. For example, the regular expression [a-zA-Z0-9-_]*\.html evaluates differently based on the URL:
    • The expression matches this URL:
      https://www.sas.com/en_us/insights/articles/business-intelligence/a-brave-new-world-of-analytics.html
    • The expression does not match this URL (based on the case of the HTML extension):
      https://www.sas.com/en_us/insights/articles/analytics/what-is-omnichannel-analytics.hTML
    Note: Make sure to use a backslash (\) to escape characters when necessary.
  • To match attribute names (such as query parameters, cookie names, or JavaScript variable names), regular expressions should match case-sensitive patterns.
  • To match attribute values, regular expressions should match lowercase patterns only. SAS Customer Intelligence 360 converts all values for attributes and variables to lowercase before making comparisons. For example, use the regular expression .*prod[b][k]+.* instead of the case-sensitive expression .*prod[B][K]+.*.
  • If the regular expression contains special characters, use a backslash (\) in front of the special character as an escape character. For example, if you need to match the regular expression \a\d{2}.* (where “\” is the special character), the escaped version is \\a\\d{2}.*. The first “\” is the escape character, and the second “\” is the special character.
Last updated: August 11, 2026