Callbacks

Callbacks allow you to "register" functions that will be executed when a specific event occurs.

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

IMPORTANT

Callbacks must be defined BEFORE the Tracking Pixel.

<script type="text/javascript">
  window.RHConfig = {
    callbacks: {
      onLoad: function() {
        // ... your logic ...
      },
      ready: function() {
        // ... your logic ...
      },
      beforeSubmit: function(data) {
         RH.form.data = {
            name: "Mr "+ data.name,
            email: "john.smith@email.com",
            extra_field: null,
            extra_field_2: null
         }
      },
      success: function(output) {
         // ... your logic ...
         
      },
      afterSuccess: function(output) {
         // ... 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 ...
      },
	    subscriberLoaded: function(response, data) {
        // ... your logic ...
      }
    }
  }
</script>

Last updated