Přejít k obsahu  Přejít k hlavnímu menu

Blog / Knowledge base

Updated: 11. August 2020

Actions in Mailocator - onSubmit

Dynamic change of the onSubmit event based on user behavior

What are Actions?

If you don't know how events work, we recommend that you get acquainted with them first Actions in Mailocator.



OnSubmit event and dynamic event change

During the management of more advanced scenarios, it may be necessary to influence the parameters of the onsubmit event, most often by:
filling in the form (eg checking the subscription),
visitor behavior,
status of cookies or dataLayer.

In addition to the parameter of the function mailocator.action.do (), the action can also be sent using the value of the attribute mlctr-action, which you can change dynamically.
The content of the parameter of the function mailocator.action.do () cannot be changed dynamically, browsers may consider such an attempt as a violation of security rules.


Case study:
Questionnaire with the possibility of subscribing to newsletters

The query form displayed in INQUIRY may also, if the user agrees, forward the email address to the Newsletter (ESP).

Find the FORM tag in your campaign HTML code.
Leave the mailocator.action.do () function parameter blank.
Fill in the attribute mlctr-action
Enter the desired default action in the attribute value.
<form onsubmit="return mailocator.action.do()" mlctr-action="subscribe:1|send">






After checking the checkbox - agree to subscribe - change the value of the attribute mlctr-action

Add the event to the checkbox and use it to change the value of the attribute mlctr-action
If the checkbox is checked, we want to send an event to Mailocator to send a query and at the same time to subscribe - subscribe:1|send
If the user did not check the box, the form will be submitted by action send
<input type="checkbox" value="1" onclick="this.checked ?
(document.querySelector('[mlctr-action]').setAttribute('mlctr-action','subscribe:1|send')) : (document.querySelector('[mlctr-action]').setAttribute('mlctr-action','send'))">



RELATED

Instructions for your own design for the wheel of fortune

How to create a wheel of fortune with your own HTML and CSS code

How to Thank you page in Mailocator?

See how to better bring your future customers back to your site as you complete the verification process.

Wheel of Fortune

A popular gamification element is the wheel of fortune, in which the user is offered a reward for providing data or subscribing to newsletters.

Mark campaign conversions with actions

Where a campaign is not automatically marked as converted (such as a newsletter sign-up), you can add a conversion using an action to better evaluate the success of the campaign.

Scenario testing laboratory

An easy way to verify the functionality of the scenario in Mailocator is to run a laboratory where you can see the entire course of processing over time, including the evaluation of conditions and user actions.

Disabling and enabling Mailocator using a parameter in the URL

If you need to limit campaigns in time and the UTM parameter is not available, you can use the internal parameter of Mailocator