If you want to hook in custom analytics to the widget or make other elements on your page react to events inside the widget you can do this easily using the event API.
Include the following code in the header of your site:
<script>
(function(i,a) { i[a] = i[a]||{ _upa:[] }; i[a].on = function(e,v) { i[a]._upa.push([e,v]); }; })(window, 'allocate');
</script>
you can now add event listeners that will be triggered automatically when certain actions are performed inside the widget.
allocate.on('start', function(ev) {
console.log("booking started!", ev);
s});
allocate.on('finish', function(ev) {
console.log("booking complete cost was ", ev.total_cost);
s});
start
{ }
occupancy-options
{ }
product
{ }
click_product
{ href: "http://" }
room
{ }
click_room
{ href: "http://" }
click_staytype
{ href: "http://" }
extras
{ }
details
{
total_deposit: 100,
take_payment: true,
total_cost: 100,
provider: "Stripe"
}
payment_status
{state: enum("3d_complete", "3d_failure", "taken", "failure") }
finish
{
total_cost: 100,
total_paid: 100,
reference: "XX/XX",
property_name: "Test Property",
stays: [
{
price: 50,
room: { href: "http://" },
product: { href: "http://" },
stay_type: { href: "http://" },
occupancy: { adult: 2, child: 1, infant: 0 }
}, {
price: 50,
room: { href: "http://" },
product: { href: "http://" },
stay_type: { href: "http://" },
occupancy: { adult: 2, child: 1, infant: 0 }
}
]
}