MT Config
Web Integrations supports additional configuration via a global javascript object, MT_CONFIG
. We check for this object when initializing Web Integrations. Defining this object is completely optional.
Events
We offer callback functions after specific events in Web Integrations that allow you to trigger supplemental functionality.
onCheckoutComplete
onCheckoutComplete: (data: { order: Order; userId: string; }) => Promise<void>;
Fires after the user successfully completes a purchase.
You can view the full definition of an order here.
onCreateAccountComplete
onCreateAccountComplete: (data: { emailAddress: string; userId: string; }) => Promise<void>;
Fires after the user successfully creates an account, using the Create Account form.
onLoginComplete
onLoginComplete: (data: { emailAddress: string; userId: string; }) => Promise<void>;
Fires after the user successfully logs-in, anywhere a login link is accessible.
Example
The following is an example of the MT_CONFIG object with the onCreateAccountComplete
event which, after a user successfully creates an account, logs the user's Email Address and User ID.