Why use this trigger?
The JavaScript-trigger method gives you the highest level of control over when a campaign appears. Instead of relying on predefined behaviors like scrolls, clicks, or page visits, you can fire a campaign exactly at the moment your own application logic decides it’s appropriate. By calling a simple command such as mailocator.do('triggerID:1698'), you can activate a campaign after custom events, AJAX operations, form interactions, API responses, or any other dynamic action on your site. This makes the JavaScript trigger ideal for advanced integrations, complex user flows, and personalized engagement scenarios.
Where it works best?
Use this trigger when your website or application has logic that goes beyond standard browser interactions:
After a successful form submission or partial completion — trigger guidance or next-step instructions.
When an internal validation or API response occurs — show a message tied to application state.
Within custom checkout steps or multi-step wizards — activate campaigns at specific milestones.
In single-page applications (SPA) — trigger campaigns on virtual route-change events.
After custom analytics or tracking events — integrate with your own event system or dataLayer logic.
What does it solve?
The JavaScript trigger allows you to connect Mailocator directly to your business logic. Instead of depending solely on visible user actions, you can trigger campaigns based on conditions like data processing, user status, eligibility, or backend responses. This results in highly accurate, context-specific timing that improves relevance and conversion without compromising UX.
Best practice tip:
Keep the trigger call lightweight and only fire it when the internal condition truly matters — such as a confirmed form event, validated step, or meaningful user milestone. Document your trigger IDs clearly so developers can easily integrate them into the appropriate parts of your application.