MXO Tag Lifecycle
You can customize the MXO Tag at various points in the lifecycle, as show below. Customizing the MXO Tag provides you with full control of the lifecycle itself.
Notes
Line | Notes |
---|---|
1 | The MXO Tag loads, initializes and provides you with the defaults object. The defaults object includes information about the Touchpoint, defaults.interaction, and any default properties, defaults.properties, taken from the URL of the web page. You can either add to the existing defaults or replace the defaults completely, for example, to send data that is not directly available on the web page to MXO. |
2 | Sends the initial request to MXO, including information about what to do after a response is returned, then (function (response). Note that the response returned is not the actual response from by MXO, but a promise object. For more information, see Promises.In the example above, when a response is received, MXO follows the instructions in lines 4 through 6. |
3 | Optional. Use to add additional code that should execute before any capture, track or optimize instructions. For example, to handle the response coming back from MXO manually, if you wanted to trigger an optimization programmatically. |
4 | Returns the response to the MXO Tag to process, attaching any capture, track or optimize instructions to the page. |
8 | Optional. Use, for example, to expose the Javascript methods to your framework by setting the customerAPI object as a global variable. |