SCRIPT IMPORTANTES:
Script para evento Purchase no TGM.
🔴🔴 Não esqueça de mudar o link do MOTOR DE RESERVAS ao mudar de cliente:
Exemplo: https://bugaendrus-paradise.artaxnet.com/#/success/
!function(w,d,l){
if (window.location.href === "👉LINK DO MOTOR DE RESERVAS AQUI👈") {
function getText(selector) {
const el = document.querySelector(selector);
return el ? el.textContent.trim() : '';
}
const transactionId = getText("span.text-h4.q-ma-none.text-primary");
const rawValue = getText("div.q-item__label.text-grey-8 em + text, div.q-item__label.text-grey-8");
const checkIn = getText("div.q-item__label.text-grey-8:nth-of-type(2)");
const checkOut = getText("div.q-item__label.text-grey-8:nth-of-type(3)");
const value = parseFloat(rawValue.replace(/[^\d,]/g, '').replace(',', '.')) || 0;
w[l] = w[l] || [];
w[l].push({
event: 'purchase',
transactionId: transactionId,
value: value,
currency: 'BRL',
checkInDate: checkIn,
checkOutDate: checkOut,
bookingChannel: 'Site Oficial'
});
}
}(window, document, 'dataLayer');
COMO TESTAR?
Após carregar a págins de Sucesso, cole este código no console e dê enter:
dataLayer.filter(d => d.event === "purchase")