Callbacks

You can define callbacks in the Configuration file. Callbacks is a property of the global variable window.MaitreConfig.

<script type="text/javascript">
  window.MaitreConfig = {
      callbacks: {
        onLoad: function() {
          ... your logic ...
        },
        ready: function() {
          ... your logic ...
        },
        success: function(response, data) {
           ... your logic ...
        },
        afterSuccess: function(response, data) {
           ... your logic ...
        },
        error: function() {
          ... your logic ...
        },
        popupOpen: function() {
          ... your logic ...
        },
        popupClose: function() {
          ... your logic ...
        },
        subscriberNotFound: function() {
          ... your logic ...
        },
        emailNotValid: function(reason) {
          ... your logic ...
        },
	serverProblem: function(reason) {
          ... your logic ...
        }
      }
  }
</script>

These are the available callbacks:

  • onLoad
    Is triggered before everything else.
  • ready
    Is triggered after the form have been generated and all libraries have been loaded.
  • success
    Is triggered when the form has been successfully submitted. It receives two parameters: response, which is a string with the response result of the submission (eg: subscriber_created, subscriber_retrieved, etc) and data, which is a JSON object with the properties of the subscriber.
  • afterSuccess
    Is triggered after the form has been successfully submitted. It receives two parameters: response, which is a string with the response result of the submission (eg: subscriber_created, subscriber_retrieved, etc) data, which is a JSON object with the properties of the subscriber.
  • error
    Is triggered when an error occurs.
  • popupOpen
    Is triggered when the popup is opened.
  • popupClose
    Is triggered when the popup is closed.
  • subscriberNotFound
    Is triggered when an email that doens't exist is used to check the status
  • emailNotValid
    Is triggered when the email entered is not valid. It receives one parameter: reason, which contains the reason why Maître thinks that email is not valid.
  • serverProblem
    Is triggered when the server returns a 500 or 4XX error.

NOTE: When you initialise the success or error callbacks, those will override the default ones. Therefore, if you use them, make sure to write your own logic to display the sharing screen.

Email validation

We take data security very seriously and have implemented an anti-spam system that verifies every single email, making sure it's a valid email, it doesn't come from a known disposable domain and it's not an alias.

If an email address doesn't pass our validation test, the JSON object will contain two properties:

  • response
    email_not_valid
  • reason
    • Email format is not valid.
      If email format is not valid. Eg: myname@gmail
    • Email can't be an alias.
      If the email address is an alias. Eg: myname+test@gmail.com
    • You can't use a disposable domain.
      If email address uses a disposable domain. Eg: myname@xyzfree.net

Still need help? Contact Us Contact Us