Try pre-set campaigns and get your first conversions within 15 minutes.
Mailocator / Filters 2025-12-17 13:04:33

Launching a campaign based on a JavaScript expression

This filter allows you to run a campaign only when the specified JavaScript expression returns true. This allows you to use any logic, custom variables, application status, or specific data from the page that is not available through other filters. This is the most flexible targeting method in Mailocator, suitable for advanced scenarios, SPA applications, and custom integrations.

What is it for?

The JavaScript expression gives you full control over when the campaign should run. It can be based on anything available on the page: from the shopping cart status, the presence of a specific element, the result of a custom function, to internal application variables.

Best practice

Use this filter when you need to evaluate custom logic that is not covered by other filters. Typical examples include:

the presence of a specific DOM element (e.g., a third-party widget),

the content of a custom JS application variable (e.g., user status, cart status),

information available only to internal APIs,

detection of properties that change dynamically in SPAs, where URL filters are not sufficient.

Keep the expression as simple as possible and always test it in the browser console..