Try pre-set campaigns and get your first conversions within 15 minutes.
Mailocator / Custom HTML and JavaScript 2025-02-17 18:38:01

Running the external script after displaying the window object

To call the user function when the object is displayed (popup, notification, ...), add the ML-OBJECT attribute to the ML-OBJECT element with a javascript code parameter.

You can use this call to trigger gamification, for example, to spin a wheel before the user clicks the "Try my luck" button.

Running the function

This is an example of running the update_window_content user function, which you can insert in Settings > JavaScript:

<ml-object onload="update_window_content()"></ml-object>

This logic only applies to the ML-OBJECT element, placing the onload attribute on any other non-standard element will be ignored.

Execute a function passing an object (window) identifier

If you use the keyword this as a parameter, then a variable with the object of the current window will be passed. In this case, you can access the contents of the window via the following properties:

<ml-object onload="update_window_content( this )"></ml-object>

Example of a function with the win argument

function update_window_content( win ){ /* routine */ }

Overview of the properties of the win object:

  • win.id - campaign id
  • win.el - top element of the window
  • win.doc - parent element of the window, e.g. if it is placed in an iframe
  • win.form - form data object