We’ve migrated our documentation to a new site, which means some URLs have changed.
Subscriptions

How to track close events on Templates?

The callback event checkoutClose not only fires in the checkout but also for Offer templates.

It does not fire for Identity Management templates.

You can use the following code to track the close events:

tp.push(["addHandler", "checkoutClose", function(event){
 // Detect close event & Run your script
 
}]);

You can double-check if the template closes are being tracked by executing the following code in the browser's console:

tp.push(["addHandler", "checkoutClose", function(event){
 // Detect close event & Run your script
 console.log('checkoutClose callback works for this template too!');
}]);

Now when you close the template, you should see the message checkoutClose callback works for this template too! appears in the console.

More information about the checkoutClose callback is available here.

Last updated: