Use window.AXLWebsite to listen for form and checkout events on AXL pages. This is an advanced integration task: start by logging the events on a test page before sending anything to your analytics service.
Description of the AXLWebsite Object
The object is available as window.AXLWebsite. Add listeners after it has been initialized on the page. To inspect events, add ?debug=true to an address with no query string, or &debug=true if the address already has one, then open the browser console.
Place listeners in the page or site integration code, depending on whether they should run on one page or all pages. Register a listener once, and make sure the destination analytics library is loaded before calling it.
Event Types
FormSubmit: the page form was submitted; receives form data.CheckoutStarted: the visitor started checkout through a payment control; receives checkout data when available.CheckoutInit: checkout was initialized.CheckoutSuccess: the checkout success flow ran; receives checkout data.CheckoutFail: checkout reported an error; the payload includeserroranddata.
Log the payload in your test flow before reading its fields. A click or CheckoutStarted event is not proof of a successful payment.
if (window.AXLWebsite) {
window.AXLWebsite.addEventListener("FormSubmit", function (data) {
console.log("FormSubmit", data);
});
}
AXL can already send Meta Lead, InitiateCheckout, and Purchase events through its configured integration. Do not add a second sender for the same event without a deliberate deduplication plan. The examples below illustrate listener syntax; confirm the event payload and existing tracking before adapting them.
Start a Custom Event Automation from Your Code
A page's automation can start from Custom Event. To send that event from your own script, for example when a visitor finishes watching an embedded video, call runCustomEvent with the same event name you entered in the trigger:
window.AXLWebsite.runCustomEvent('video-watched');
Important:
- The name must match the trigger's Event Name; capital letters do not matter.
- The event starts the automation only for a visitor the site already knows as a contact, for example after they submitted a form or signed in. For an anonymous visitor nothing happens.
- The event reaches the automation of the page it was sent from. See "Website Automation".
Example 1: Conversion When a Form Is Submitted
For a custom Lead listener, the narrower AXLWebsite.disableMetaLead flag disables AXL’s automatic browser Lead event. Set it before a form can submit. It does not disable server-side Conversions API events.
if (window.AXLWebsite) {
window.AXLWebsite.disableMetaLead = true;
window.AXLWebsite.addEventListener("FormSubmit", function (data) {
if (typeof window.fbq !== "function") return;
window.fbq("track", "Lead");
});
}
Example 2: Conversion at the Start of Payment (Click the "Pay" Button)
if (window.AXLWebsite) {
window.AXLWebsite.addEventListener("CheckoutStarted", function (data) {
console.log("Checkout started", data);
// Inspect this payload and the built-in Meta tracking first.
// Do not send a second InitiateCheckout event for the same order.
});
}
The built-in Meta InitiateCheckout event uses the order ID for deduplication. CheckoutStarted can occur before an order exists; do not assume this event provides a valid order ID for a replacement sender.
Example 3: Conversion on Successful Payment
if (window.AXLWebsite) {
window.AXLWebsite.addEventListener("CheckoutSuccess", function (data) {
console.log("Checkout success", data);
// Verify payment identity and existing Purchase tracking
// before adding a custom analytics sender.
});
}
The built-in Meta Purchase helper uses a payment ID as its event ID. A custom replacement must preserve the intended payment-level identity and account for server-side events. Avoid copying an unverified order object into a Purchase call.
Verify the integration. On a test page, submit one test form and run the supported checkout test flow. Confirm the listener fires at the intended stage, inspect the payload, and check that the analytics service receives one intended event rather than duplicates.