This object is what handles the requests to the NeverBounce API. It can be accessed in the browser at window._nb.api
.
getValidatePublic(email, successCallback, errorCallback)
This method performs a verification request directly. It accepts a single email as well as two callbacks. The first callback is called on a successful request and contains a Result Object as the first argument. The second callback is called when an error is encountered and will contain the error message as a string.
_nb.api.getValidatePublic('[email protected]',
function(result) {
// Returns a Result object
console.log(result)
},
function(err) {
// Returns error message as string
console.log(err)
}
)
sendEvent(event)
This method can be used to report back to the API what the status of the form is. These events are used to create the reports available on the widget's overview page.
The only events currently supported are form.load
and form.completion
. Abandoned forms are calculated from the difference between form.load
and form.completion
events.
// Send form load event
_nb.api.sendEvent('form.load');
// Send form completion event
_nb.api.sendEvent('form.completion');