Skip to main content
Targeting controls who sees a pop-up or embedded block, where on the site it appears, and under what conditions. Use it to make sure the right offer reaches the right visitor — and never appears for someone it shouldn’t. You can combine conditions from several categories. A form only displays when all of its targeting rules are satisfied.

Audience targeting

Show or hide the form based on who the visitor is.
  • Customer segment. Target a specific customer segment — for example, “subscribers who haven’t opened an email in 30 days” or “VIP customers.”
  • A/B test variant. Show the form to one variant in an experiment, so you can compare conversion against a control group.
  • Cart contents. Trigger based on what’s in the visitor’s cart — total value, specific products, number of items, or whether the cart is empty.
Segment targeting is evaluated when the page loads. If a visitor’s segment changes during the session (for example, they add an item that puts them into a “high-value cart” segment), call PopMechanic.update() to re-check segment membership and re-evaluate which forms should show.

Page targeting

Limit the form to specific pages of your site.
  • Page type — homepage, product page, category page, cart, checkout, or any custom type your site reports.
  • Specific URL — show the form only on a single page or set of pages.
  • Product or category page — target by product ID, category ID, or product attribute.
  • Element on the page — require a specific CSS selector to be present, so the form only appears when a particular element exists.
When matching by URL, use the contains operator rather than starts with. The protocol (http:// vs https://) and the www prefix can vary between visits, and contains matches both. For example, use contains "/products/sneakers" instead of starts with "https://www.example.com/products/sneakers".

Contextual conditions

Match the visitor’s current context, not their profile.
  • Geography (by IP). Limit the form to visitors in a specific country, state, or city — for example, only show a free-shipping pop-up to visitors in New York and California.
  • Time and date. Show the form only during certain hours, days of the week, or date ranges (useful for flash sales).
  • Device type. Target desktop, tablet, or phone separately.
  • Traffic source. Show the form based on the referrer — for example, only for visitors arriving from a specific ad campaign.
  • Visit count. Trigger based on whether it’s the visitor’s first session or their N-th return.

Interaction history

Adjust display based on how the visitor has interacted with this or other forms in the past.
  • When a specific form was last shown.
  • When a specific form was last closed.
  • When a specific form was last submitted.
Use this to avoid showing the same pop-up twice, or to chain forms — for example, show a follow-up survey only to visitors who submitted the lead-capture form last week.
Form interaction history is stored in the visitor’s browser local storage and is tied to a specific site. If the visitor clears their browser data or switches devices, their history resets.

CSS selectors for embedded blocks

Embedded blocks need a CSS selector to know where on the page to render. To find the right selector:
1

Open your site in the browser

Navigate to the page where you want the embedded block to appear.
2

Inspect the target location

Right-click the area where the block should go and choose Inspect.
3

Copy the selector

In the developer tools, right-click the element and choose Copy → Copy selector.
4

Paste it into the form's targeting settings

Paste the selector into the embedded block’s placement field.

Examples of common targeting setups

  • Abandoned cart pop-up. Cart is non-empty + visitor has been inactive for 30 seconds + form hasn’t been shown in the last 7 days.
  • Promotion announcement. Show on the homepage to all visitors, once per session, only during the promotion’s date range.
  • Product recommendations embedded block. Product page + visitor is in the “frequent shopper” segment + cart total is under $50.
  • Welcome offer for new visitors. First-session visitors + on the homepage + exit intent triggered.
Product-based targeting requires that your site sends cart contents and viewed-product data to Maestra. If this integration isn’t set up yet, see the website personalization integration guide before configuring product targeting.