Skip to main content

Advanced Targeting (Pro Plan and Above): Overview

Overview of Promolayer's advanced targeting conditions (Pro plan and above), including regex URL matching, page title, CSS elements, cookies, and JavaScript variables.

Pro plan and above customers can use additional advanced targeting conditions beyond basic URL matching.

How it works

Add one of the conditions below as a target or exclusion rule, in addition to the standard URL match rules described in "Page Targeting (URL): Overview".

Options

Condition

Description

URL matches a regular expression

Show or hide based on a regex pattern matched against the page URL

Page title contains

Show or hide based on a string contained in the page's title

Element matches a CSS selector

Show or hide if an element matching a given selector exists on the page (e.g. an element with the "header" class)

Element has a CSS class

Show or hide if an element has a specified CSS class — see "Show a popup when an element has a specific CSS class" for a walkthrough

Element's CSS property has a value

Show or hide if an element's CSS property matches a specified value

Element has an attribute

Show or hide if an element has a specified attribute

Cookie is present

Show or hide based on whether a specified cookie exists

JavaScript global variable is present

Show or hide based on whether a specified JavaScript global variable exists

Usage examples

URL matches a regular expression

Show it on every product page

No need to list every product URL — show a "free shipping" notice across all product pages.

- Condition: "URL matches a regular expression"

- Value: ^/products/.* (example for product URLs like /products/product-name)

Page title contains

Show it only on sale pages

Even if sale page URLs aren't consistent, show a popup wherever the page title contains "Sale."

- Condition: "Page title contains"

- Value: Sale

Element matches a CSS selector

Show it only on "out of stock" product pages

Automatically detect the out-of-stock badge instead of listing affected products one by one.

- Condition: "Element matches a CSS selector"

- Value: the CSS class used for the badge (see "Show a popup when an element has a specific CSS class" for how to find it)

Element has a CSS class

Show it only when a specific tab is open (JS-only FAQ pages)

On FAQ pages that swap tabs without changing the URL, show a coupon only while a specific tab is active.

- Condition: "Element has a CSS class"

- Value: the CSS class applied to the active tab

Element's CSS property has a value

Avoid overlapping with other popups

Skip showing this popup while another popup or modal is open.

- Condition: "Element's CSS property has a value"

- Value: property name (e.g. display) and value (e.g. block)

Element has an attribute

Use a theme-specific setting to target a page

Some themes track things like stock status using a data attribute instead of a CSS class.

- Condition: "Element has an attribute"

- Value: attribute name and value

Cookie is present

Show it only to visitors from a partner link

If your partner link sets a cookie, show an exclusive offer only to those visitors.

- Condition: "Cookie is present"

- Value: cookie name

JavaScript global variable is present

Use your own site's data, like membership tier

If your membership system stores tier info in a JavaScript variable, target specific members with it.

- Condition: "JavaScript global variable is present"

- Value: variable name and value

Notes

  • These conditions require a Pro plan or above.

  • If you need help setting up a specific condition, please reach out via live chat.

Related articles

  • Page Targeting (URL): Overview

  • Show a popup when an element has a specific CSS class

Did this answer your question?