OnClick Triggering

OnClick Triggering

Trigger your offer when a visitor clicks on a specific part of your page - a button, box, link, or banner.

OnClick Triggering is an OptiMonk trigger that fires a campaign the moment a visitor clicks on a specific element anywhere on your page — a button, a link, a banner, an image, a box, or any other clickable HTML element. Unlike time-based or behavior-based triggers that fire after a visitor has been on a page for a certain period, OnClick fires in direct response to an explicit visitor action — making the timing of the campaign precisely correlated with a deliberate click signal rather than an inferred behavioral one. The trigger is configured by specifying a CSS selector or element ID that identifies the target element on your page. When a visitor clicks the matched element, OptiMonk intercepts that click and fires the campaign immediately. Common use cases include attaching an upsell popup to an "Add to cart" button, firing a discount offer when a visitor clicks on a specific promotional banner, showing additional product information when a visitor clicks a "Learn more" link, or presenting a lead capture form when a visitor clicks a free trial or sign-up CTA that you want to gate behind an email opt-in.

Key benefits

  • Campaigns fire at the moment of maximum declared intent. A visitor who clicks a specific button or link has made an explicit, deliberate action — this is a stronger intent signal than time-on-page or scroll depth, which are passive behavioral proxies. OnClick Triggering places your campaign at the exact moment the visitor has actively demonstrated interest in a specific outcome, making the message immediately relevant to what they just tried to do.
  • Turn any page element into a campaign entry point. OnClick Triggering decouples campaign delivery from page load timing and allows any element on your site to become a trigger point — without requiring a developer to add new functionality. A promotional banner that currently leads nowhere can trigger a popup with the full offer. A "See pricing" link can open an email capture gate. An "Add to cart" button can fire an upsell recommendation. The trigger connects OptiMonk's campaign system to your existing page elements at the click level.
  • Works on any device and any element type. OnClick Triggering responds to both mouse clicks on desktop and finger taps on mobile, since both are interpreted as click events by the browser. It can be applied to buttons, links, images, divs, banners, icons, or any other HTML element that is identifiable by a CSS selector or ID — giving you the flexibility to trigger campaigns from virtually any interactive point on your page.

How it works

Step 1
Open the campaign trigger settings and add the OnClick trigger

In your OptiMonk campaign, click Edit settings and scroll to the Settings summary. Click "Add more triggers" to view all available trigger types. Click the Plus icon next to "On click" to add it to the campaign.

Step 2
Identify the element you want to use as the trigger

In your browser's developer tools (right-click on the element on your page → Inspect), find the CSS selector, class name, or element ID of the button, link, or element you want to use as the trigger. Common examples include a button with the ID "add-to-cart" (selector: #add-to-cart), a link with a specific class (selector: .promo-banner), or any element identifiable by its HTML attributes. Copy the selector.

Step 3
Enter the selector in the OnClick trigger settings and publish

Paste the CSS selector or element ID into the OnClick trigger configuration field in OptiMonk. Select the device target — PC only, mobile only, or both. Save the trigger and publish the campaign. From this point, whenever a visitor clicks the specified element, OptiMonk fires the campaign immediately — regardless of how long the visitor has been on the page or how far they have scrolled.

Frequently asked questions

What is OnClick Triggering in OptiMonk?+

OnClick Triggering is a campaign trigger that fires a popup or other OptiMonk campaign the moment a visitor clicks on a specific element on your page — a button, link, banner, image, or any other clickable HTML element. It is configured by specifying the CSS selector or element ID of the target element, and fires in direct response to the visitor's click rather than based on time or scroll behavior.

What types of elements can I use as an OnClick trigger?+

Any HTML element that is identifiable by a CSS selector or ID can be used as an OnClick trigger — including buttons, links (<a> tags), images, divs, banners, icons, and custom UI components. As long as the element has a consistent and unique enough selector to identify it on the page, it can serve as the trigger point for an OptiMonk campaign.

How do I find the CSS selector of the element I want to use?+

The most reliable method is using your browser's developer tools. Right-click on the target element on your page, select "Inspect" (in Chrome or Firefox), and examine the highlighted HTML to identify its ID attribute (e.g., #my-button) or class name (e.g., .add-to-cart-btn). You can also right-click the element in the Elements panel of developer tools and select "Copy → Copy selector" to get an auto-generated CSS selector. Test the selector in the browser console with document.querySelector('your-selector') to confirm it matches the correct element before entering it in OptiMonk.

Does OnClick Triggering work on mobile devices?+

Yes. OnClick Triggering responds to both mouse clicks on desktop and touch taps on mobile, since both are handled as click events by the browser. The trigger can be configured to fire on desktop only, mobile only, or both using the device selector in the trigger settings.

Can I combine OnClick Triggering with targeting conditions?+

Yes. OnClick Triggering is the trigger — the moment the campaign fires — while targeting conditions define who the campaign fires for. You can combine OnClick with any OptiMonk targeting condition: for example, fire the campaign when a visitor clicks the "Add to cart" button AND has a cart value above $50, or when a visitor clicks a promotional banner AND is a returning visitor. The targeting conditions are evaluated at the moment of the click, and the campaign displays only if both the click event and all targeting conditions are satisfied simultaneously.

Ready to try it?

Try OptiMonk for free

Launch your first campaign, learn what works, then scale what converts.

triggering