//init script
function loadScriptSync (src) {
var s = document.createElement('script');
s.src = src;
s.type = "text/javascript";
s.async = false; // <-- this is important
document.getElementsByTagName('head')[0].appendChild(s);
}
loadScriptSync('//assets.adobedtm.com/launch-ENf01128449a5840749633dd50a7356992.min.js')
//process script
var event = data.event || {};
var attendee = data.attendee || {};
if(( window.location.pathname || '').indexOf('/createaccount') > -1 )
{
console.log('firing on createaccount page - datalayer', data)
window.webData =
{
pageName: event.name.concat(":reg:createaccount"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
events: "reg-create-account-start"
};
}
else if(( window.location.pathname || '').indexOf('/login') > -1 )
{
console.log('firing on login page - datalayer', data)
window.webData =
{
pageName: event.name.concat(":reg:login"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
events: "reg-create-account-login"
};
}
else if(( window.location.pathname || '').indexOf('/contactdetails') > -1 )
{
console.log('firing on contactdetails page - datalayer', data)
window.webData =
{
pageName: event.name.concat(":reg:contactdetails"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
events: "reg-create-account-contact-details"
};
}
else if(( window.location.pathname || '').indexOf('/attendeedetails') > -1 )
{
console.log('firing on attendeedetails page - datalayer', data)
//window.webData2 = { something: 'something'}
window.webData =
{
pageName: event.name.concat(":reg:attendeedetails"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
events: "reg-create-account-contact-details"
};
}
else if(( window.location.pathname || '').indexOf('/examdetails') > -1 )
{
console.log('firing on examdetails page - datalayer', data)
window.webData =
{
pageName: event.name.concat(":reg:examdetails"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
events: "reg-create-account-contact-details"
};
}
else if(( window.location.pathname || '').indexOf('/order') > -1 )
{
console.log('firing on order page - datalayer', data)
window.webData =
{
pageName: event.name.concat("reg:order"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
events: "reg-order"
};
}
else if(( window.location.pathname || '').indexOf('/confirm') > -1 )
{
console.log('firing on confirm page - datalayer', data)
var order = data.order || {}
var products = (order.items || []).map(function(item){
totalTax += (item.tax || 0)
return {
'id': '', // Product ID, set to empty string for now
'name': (item.name || ''), // Product Name
'price': (item.price || 0).toString(), // unit price
'quantity': item.quantity || 0
}
})
var item = {}
products.forEach( product => {
item.quantity = product.quantity;
item.price = {
basePrice: product.price
}
item.productInfo ={
productID: product.id,
productName: product.name
}
})
window.webData =
{
pageName: event.name.concat(":reg:order"),
siteSection: "Rainfocus Registration",
property: event.name,
formType: "Conference Registration Form",
formName: event.name.concat(" Registration"),
eMail: attendee.email,
companyName: attendee.companyName,
jobTitle: attendee.jobTitle,
country: "", //MUST ADD ATTRIBUTE
state: "", //MUIST ADD ATTRIBUTE
events: "reg-order-complete",
transaction: {
purchaseID: order.orderId,
paymentMethod: order.methodOfPayment,
//TRANSACTION ITEMS
item: item
}
} ;
}
loadScriptSync('//assets.adobedtm.com/launch-ENf01128449a5840749633dd50a7356992.min.js')