if(typeof(window.webtracking_id) !== 'undefined') {console.log('Webtracking è stato caricato più di una volta, per favore controllare.');} function ts_setCookie(cname, value, exdays) {
if(typeof(exdays) === 'undefined') exdays = 365;
var d = new Date();
d.setTime(d.getTime() + (exdays*24*60*60*1000));
var expires = "expires="+ d.toUTCString();
var cookieValue = (typeof(value) === 'object' ? JSON.stringify(value) : value);
document.cookie = cname + "=" + cookieValue + ";expires=Thu, 01 Jan 1970 00:00:01 GMT';path=/;domain=." + document.domain.replace('www.', '');
document.cookie = cname + "=" + cookieValue + ";" + expires + ";path=/;domain=" + window.webtracking_SessionDomain;
}
function ts_getCookie(key) {
var keyValue = document.cookie.match('(^|;) ?' + key + '=([^;]*)(;|$)');
keyValue = decodeURIComponent(keyValue ? keyValue[2] : null);
var tryJSON = {};
try {
tryJSON = JSON.parse(keyValue);
if(typeof(tryJSON) == 'object' && tryJSON !== null) {
return tryJSON;
}
} catch (e) {}
return (keyValue !== 'null' ? keyValue : '');
} window.webtracking_id = '1'; ts_setCookie('Fw360_WebTracking_ProjectID', window.webtracking_id, 365); if(typeof(window.webtracking_Url) === 'undefined') { window.webtracking_Url = 'https://webtracking.framework360.it/FRAMEWORK360/Framework/Production/backend/ajax/proxy/tracking.php'; } window.webtracking_manual_actions = {}; window.webtracking_current_lang = 'en_GB'; window.webtracking_default_lang = 'it_IT'; window.webtracking_loading_pixels = []; if(ts_getCookie('Fw360_WebTracking_UniqueID') === '') { ts_setCookie('Fw360_WebTracking_UniqueID', (new Date()).getTime() + '.' + (Math.random()*1000000).toFixed()) } function initWebtrackingActions() { try { var phone_regex = /(?:\>|^|\s){1}((?:(\+[0-9]{2})[\s]{0,1}){0,1}([0-9][\s]{0,1}){9,10})(?:\<|\s|$)/g
window.phone_tracking_info = {"numeri_da_tracciare":"all","hide_phones":"0","cover_text":"{\"it_IT\":\"Visualizza Telefono\"}","enable_external_tracking":"0","webtracking":{"event_name":"Chiamata Ricevuta","event_value":"{telefono}"},"nothing":[[],[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}"},"tiktok":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""},"custom_phone_numbers":[{"phone_number":"","webtracking":{"event_name":"Chiamata Ricevuta","event_value":"{telefono}"},"nothing":[[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}"},"tiktok":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""}}]};
var tags = ['a', 'span', 'li', 'p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
tags.forEach(function(tag) {
jQuery(tag).each(function() {
var class_to_attach = '';
if(jQuery(this).prop('tagName') == 'A' && typeof(jQuery(this).attr('class')) !== 'undefined') {
class_to_attach = jQuery(this).attr('class');
}
var sourcestring = jQuery(this).text();
if(phone_regex.test(sourcestring) && !jQuery(this).closest('.select2').length) {
var match = sourcestring.match(phone_regex);
var block = jQuery(this);
match.forEach(function(cellphone) {
var replacementpattern = (0 ? 'Visualizza Telefono' : '...');
replacementpattern = replacementpattern.replace(/{old_class}/g, class_to_attach);
if(block.prop('tagName') == 'A') replacementpattern = replacementpattern.replace(/tagType/g, 'span');
else replacementpattern = replacementpattern.replace(/tagType/g, 'a');
block.html(block.html().replace(jQuery.trim(cellphone), replacementpattern));
});
}
});
});
jQuery('.covered_phone').each(function() {
if(!jQuery(this).hasClass('covered_content')) jQuery(this).text(jQuery(this).data('phone'));
});
jQuery('[href*="tel:"]').not('.tracking_content').filter(function() {
return !jQuery(this).find('.tracking_content').length && jQuery.isNumeric(decodeURI(jQuery(this).attr('href')).replace('tel:', '').replace('+', '').replace(/\s/g, ''))
}).each(function() {
var phone = decodeURI(jQuery(this).attr('href')).replace('tel:', '').replace('+', '').replace(/\s/g, '');
jQuery(this).addClass('tracking_content covered_phone').data('phone', phone).attr('data-phone', phone);
});
jQuery('body').on('click', '.covered_phone, a', function(e) {
if(jQuery(this).prop('tagName') == 'A' && jQuery(this).find('.covered_phone').length) {
var phoneElement = jQuery(this).find('.covered_phone');
} else if(jQuery(this).hasClass('covered_phone')) {
var phoneElement = jQuery(this);
} else {
return true;
}
var phone = (phoneElement.data('phone').toString()).replace(/\s/g, '');
if(/\+[0-9]{2}/g.test(phone)) {
phone = phone.replace(/\+[0-9]{2}/g, '');
}
var tracking_info = (typeof(phone_tracking_info[phone]) !== 'undefined' ? phone_tracking_info[phone] : phone_tracking_info);
if(tracking_info['webtracking']['event_value'] === '') {
tracking_info['webtracking']['event_value'] = '{telefono}';
}
msInternalTrack(tracking_info, {telefono: phone}, 'telefono', phoneElement.hasClass('covered_content'));
if(phoneElement.hasClass('covered_content')) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
phoneElement.attr('href', 'tel:' + (phoneElement.data('phone').toString()).replace(/\s/g, ''));
phoneElement.text(phoneElement.data('phone'));
}
phoneElement.removeClass('covered_content').removeClass('covered_phone').addClass('uncovered_content');
}); } catch(e) { console.log('[Webtracking] Errore inizializzazione evento telefono', e); } try { var email_regex = /([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,9})/g;
window.email_tracking_info = {"email_da_tracciare":"all","hide_emails":"0","cover_text":"{\"it_IT\":\"Visualizza Email\"}","enable_external_tracking":"0","webtracking":{"event_name":"Email Ricevuta","event_value":"{email}"},"nothing":[[],[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}"},"tiktok":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""},"custom_email_addresses":[{"email_address":"","webtracking":{"event_name":"Email Ricevuta","event_value":"{email}"},"nothing":[[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}"},"tiktok":{"label":"{\"it_IT\":\"Contact\"}","currency":"","value":""}}]};
var tags = ['a', 'span', 'li', 'p'];
tags.forEach(function(tag) {
jQuery(tag).each(function() {
var class_to_attach = '';
if(jQuery(this).prop('tagName') == 'A' && typeof(jQuery(this).attr('class')) !== 'undefined') {
class_to_attach = jQuery(this).attr('class');
}
var sourcestring = jQuery(this).text();
if(email_regex.test(sourcestring) && !jQuery(this).closest('.select2').length)
{
var match = sourcestring.match(email_regex);
var block = jQuery(this);
match.forEach(function(email) {
var replacementpattern = (0 ? 'Visualizza Email' : '...');
replacementpattern = replacementpattern.replace(/{old_class}/g, class_to_attach);
if(block.prop('tagName') == 'A') replacementpattern = replacementpattern.replace(/tagType/g, 'span');
else replacementpattern = replacementpattern.replace(/tagType/g, 'a');
block.html(block.html().replace(jQuery.trim(match), replacementpattern));
});
}
});
});
jQuery('.covered_email').each(function() {
if(!jQuery(this).hasClass('covered_content')) jQuery(this).text(jQuery(this).data('email'));
});
jQuery('[href]').not('.tracking_content').filter(function() {
return !jQuery(this).find('.tracking_content').length && email_regex.test(jQuery(this).attr('href'));
}).each(function() {
var email = jQuery(this).attr('href').match(email_regex);
jQuery(this).addClass('tracking_content covered_email').data('email', email[0]).attr('data-email', email[0]);
});
jQuery('body').on('click', '.covered_email, a', function(e) {
if(jQuery(this).prop('tagName') == 'A' && jQuery(this).find('.covered_email').length) {
var mailElement = jQuery(this).find('.covered_email');
} else if(jQuery(this).hasClass('covered_email')) {
var mailElement = jQuery(this);
} else {
return true;
}
var email = mailElement.data('email');
var tracking_info = (typeof(email_tracking_info[email]) !== 'undefined' ? email_tracking_info[email] : email_tracking_info);
if(tracking_info['webtracking']['event_value'] === '') {
tracking_info['webtracking']['event_value'] = '{email}';
}
msInternalTrack(tracking_info, {email: email}, 'email', mailElement.hasClass('covered_content'));
if(mailElement.hasClass('covered_content')) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
mailElement.attr('href', 'mailto:' + mailElement.data('email'));
mailElement.text(mailElement.data('email'));
}
mailElement.removeClass('covered_content').removeClass('covered_email').addClass('uncovered_content');
}); } catch(e) { console.log('[Webtracking] Errore inizializzazione evento email', e); } try { var current_clean_domain = (document.location.origin.replace('www.', '').replace('://', '').replace('https', '').replace('http', '')).split('/')[0]
var current_clean_referer = (document.referrer.replace('www.', '').replace('://', '').replace('https', '').replace('http', '')).split('/')[0]
if(current_clean_referer.length && current_clean_referer !== current_clean_domain && current_clean_referer.indexOf('myframework360') === -1) {
var track_referer = true;
window.referer_tracking_info = {"referer_da_tracciare":"all","enable_external_tracking":"0","webtracking":{"event_name":"Referer","event_value":"{domain}"},"nothing":[[],[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}"},"tiktok":{"label":"{\"it_IT\":\"\"}"},"custom_referer_url":[{"referer":""}]};
if(track_referer) {
if(typeof(referer_tracking_info[current_clean_referer]) !== 'undefined') {
referer_tracking_info = referer_tracking_info[current_clean_referer];
}
msInternalTrack(referer_tracking_info, {domain: current_clean_referer, url: document.referrer}, 'referer');
}
} } catch(e) { console.log('[Webtracking] Errore inizializzazione evento referer', e); } try { window.session_start_time = ts_getCookie('Fw360_Session_Start');
if(!window.session_start_time) {
window.session_start_time = (new Date()).getTime();
ts_setCookie('Fw360_Session_Start', window.session_start_time, 1);
}
if(!ts_getCookie("session_0_passed")) {
window.session_0_interval = setInterval(function() {
if(!ts_getCookie("session_0_passed")) {
if(Math.floor(Date.now() / 1000)-(window.session_start_time/1000) > 3) {
ts_setCookie("session_0_passed", 1, 1);
clearInterval(window.session_0_interval);
msInternalTrack({"durata_minima":"3","unita_durata":"s","enable_external_tracking":"0","webtracking":{"event_name":"","event_value":""},"nothing":[[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}","currency":"","value":""},"tiktok":{"label":"{\"it_IT\":\"\"}","currency":"","value":""}}, {}, "durata_sessione");
}
}
}, 5000);
} } catch(e) { console.log('[Webtracking] Errore inizializzazione evento durata_sessione', e); } try { var trackedScroll = [];
$(window).on('scroll', function() {
var s = $(window).scrollTop(), d = $(document).height(), c = screen.height;
var scrollPercent = ((s+c) * 100) / d;
if(trackedScroll.indexOf(20) < 0 && scrollPercent > 20) {
msInternalTrack({"scroll_percentage":"20","use-session":"0","enable_external_tracking":"0","webtracking":{"event_name":"","event_value":""},"nothing":[[]],"analytics":{"event_action":"{\"it_IT\":\"\"}"},"gads":{"conversion_label":"","value":""},"facebook":{"label":"{\"it_IT\":\"\"}","currency":"","value":""},"linkedin_insight":{"conversion_id":""},"microsoft":{"event_action":"{\"it_IT\":\"\"}","event_category":"{\"it_IT\":\"\"}","event_label":"{\"it_IT\":\"\"}","value":"{\"it_IT\":\"\"}"},"twitter":{"label":"{\"it_IT\":\"\"}","currency":"","value":""},"tiktok":{"label":"{\"it_IT\":\"\"}","currency":"","value":""}}, {}, "scroll");
trackedScroll.push(20)
}
}) } catch(e) { console.log('[Webtracking] Errore inizializzazione evento scroll', e); } } function getTrackingDefaultEventByName(id) { var extra_params = {}; extra_params['Standard'] = {"name":"{{Contattato via Email}}","extra_params":[],"platforms":{"webtracking":{"inputs":[],"extra_params":[]},"facebook":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"tiktok":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"reddit":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"twitter":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"analytics":{"inputs":[],"extra_params":[]},"microsoft":{"inputs":[],"extra_params":[]},"quora":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}}}}; extra_params['EmailContact'] = {"name":"{{Contattato via Email}}","extra_params":{"email":{"type":"string","description":"{{L'indirizzo email cliccato}}","required":true,"default":""}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"{{Email Ricevuta}}","disabled":false},"event_value":{"value":"{email}","placeholder":"Se vuoto indicher\u00e0 l'indirizzo email"}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"{{Contact}}","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"tiktok":{"inputs":{"label":{"value":"{{Contact}}","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"reddit":{"inputs":{"label":{"value":"{{Contact}}","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"analytics":{"inputs":{"label":{"value":"{{Contact}}","disabled":false}},"extra_params":[]},"quora":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}}}}; extra_params['PhoneCall'] = {"name":"{{Contattato via Telefono}}","extra_params":{"telefono":{"type":"string","description":"{{Il numero di cellulare chiamato}}","required":true,"default":""}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"{{Chiamata Ricevuta}}","disabled":false},"event_value":{"value":"{telefono}","placeholder":"{{Se vuoto indicher\u00e0 il numero di telefono}}"}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"Contact","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"tiktok":{"inputs":{"label":{"value":"Contact","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"reddit":{"inputs":{"label":{"value":"Contact","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"analytics":{"inputs":{"label":{"value":"Contact","disabled":false}},"extra_params":[]},"quora":{"inputs":{"label":{"value":"","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}}}}; extra_params['MouseClick'] = {"name":"{{Click effettuato}}","extra_params":{"link":{"type":"string","description":"{{Eventuali URL cliccati}}","required":true,"default":""}},"platforms":[]}; extra_params['PageVisit'] = {"name":"{{Pagina Visitata}}","extra_params":{"link":{"type":"string","description":"{{Il link visitato dal cliente}}","required":true,"default":"{link}"},"value":{"type":"float","description":"Il valore dell'oggetto visualizzato","required":false,"default":"0.0"},"currency":{"type":"string","description":"{{Il codice della valuta in uso (USD, EUR ...)}}","required":false,"default":""},"title":{"type":"string","description":"Il titolo dell'oggetto visualizzato","required":false},"product_id":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"Link Visitato","disabled":false},"event_value":{"value":"{link}","placeholder":""}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"ViewContent","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata}}","required":false,"default":"","match":""},"value":{"type":"float","description":"Il valore dell'azione effettuata","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto visualizzato}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"","match":""}}},"tiktok":{"inputs":{"label":{"value":"ViewContent","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata}}","required":false,"default":"","match":""},"value":{"type":"float","description":"Il valore dell'azione effettuata","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto visualizzato}}","required":false,"default":"","match":"title"},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"match":""}}},"reddit":{"inputs":{"label":{"value":"Page Visit","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata}}","required":false,"default":"","match":""},"value":{"type":"float","description":"Il valore dell'azione effettuata","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto visualizzato}}","required":false,"default":"","match":"title"},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"match":""}}},"analytics":{"inputs":{"label":{"value":"Contact","disabled":false}},"extra_params":[]},"quora":{"inputs":{"label":{"value":"ViewContent","disabled":false}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"Il valore","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto visualizzato}}","required":false,"default":"","match":"title"}}}}}; extra_params['Referer'] = {"name":"{{Referente}}","extra_params":{"url":{"type":"string","description":"L'URL referente","required":false,"default":""},"domain":{"type":"string","description":"{{Il dominio referente}}","required":false,"default":""}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"Referer","disabled":false},"event_value":{"value":"{domain}","placeholder":""}},"extra_params":[]},"facebook":{"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"analytics":{"extra_params":[]}}}; extra_params['Search'] = {"name":"{{Ricerca}}","extra_params":{"page-link":{"type":"string","description":"L'URL da cui il cliente ha inviato la ricerca","required":false,"default":""}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"Ricerca","disabled":false}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"Search","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"Il valore dell'azione effettuata","required":false,"default":"0","match":""},"search_string":{"type":"string","description":"La stringa ricercata dall'utente","required":false,"default":"","match":""}}},"tiktok":{"inputs":{"label":{"value":"Search","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"Il valore dell'azione effettuata","required":false,"default":"0","match":""},"search_string":{"type":"string","description":"La stringa ricercata dall'utente","required":false,"default":"","match":""}}},"reddit":{"inputs":{"label":{"value":"Search","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"Il valore dell'azione effettuata","required":false,"default":"0","match":""},"search_string":{"type":"string","description":"La stringa ricercata dall'utente","required":false,"default":"","match":""}}},"analytics":{"extra_params":[]}}}; extra_params['FormSubmit'] = {"name":"{{Invio Form}}","extra_params":{"site-link":{"type":"string","description":"{{L'URL da cui il cliente ha inviato il form}}","required":false,"default":""}},"platforms":{"webtracking":{"extra_params":[]},"facebook":{"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":false},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":false}}},"analytics":{"extra_params":[]}}}; extra_params['AddToCart'] = {"name":"{{Aggiungi al carrello}}","extra_params":{"price":{"type":"float","description":"{{Il prezzo del prodotto}}","required":true,"default":"0.0"},"currency":{"type":"string","description":"{{Il codice della valuta in uso (USD, EUR ...)}}","required":true,"default":""},"title":{"type":"string","description":"{{Il titolo del prodotto}}","required":false},"category":{"type":"string","description":"{{La categoria del prodotto}}","required":false},"product_id":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"Aggiungi al carrello","disabled":false},"event_value":{"value":"","placeholder":""}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"AddToCart","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto aggiunto al carrello}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"twitter":{"inputs":{"label":{"value":"AddToCart","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto aggiunto al carrello}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"tiktok":{"inputs":{"label":{"value":"AddToCart","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto aggiunto al carrello}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"reddit":{"inputs":{"label":{"value":"Add To Cart","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto aggiunto al carrello}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"analytics":{"extra_params":[]}}}; extra_params['Purchase'] = {"name":"{{Acquisto}}","extra_params":{"price":{"type":"float","description":"{{Il prezzo del prodotto}}","required":true,"default":"0.0"},"currency":{"type":"string","description":"{{Il codice della valuta in uso (USD, EUR ...)}}","required":true,"default":""},"title":{"type":"string","description":"{{Il titolo del prodotto}}","required":false},"category":{"type":"string","description":"{{La categoria del prodotto}}","required":false},"product_id":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false},"order_id":{"type":"string","description":"L'ID dell'ordine","required":false}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"Acquisto","disabled":false},"event_value":{"value":"","placeholder":""}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"Purchase","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto acquistato}}","required":false,"default":"","match":""},"content_category":{"type":"string","description":"{{Categoria del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"twitter":{"inputs":{"label":{"value":"Purchase","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto acquistato}}","required":false,"default":"","match":""},"content_category":{"type":"string","description":"{{Categoria del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"tiktok":{"inputs":{"label":{"value":"CompletePayment","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto acquistato}}","required":false,"default":"","match":""},"content_category":{"type":"string","description":"{{Categoria del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"reddit":{"inputs":{"label":{"value":"Purchase","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_name":{"type":"string","description":"{{Il nome del prodotto acquistato}}","required":false,"default":"","match":""},"content_category":{"type":"string","description":"{{Categoria del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"analytics":{"extra_params":[]},"microsoft":{"inputs":{"event_action":{"value":"PRODUCT_PURCHASE","disabled":true},"event_label":{"hidden":true,"disabled":true},"event_category":{"disabled":true,"hidden":true},"value":{"disabled":true,"hidden":true}},"extra_params":{"ecomm_prodid":{"type":"string","description":"L'id del prodotto acquistato","disabled":true,"default":"","match":"product_id"},"ecomm_pagetype":{"type":"string","description":"{{La tipologia della pagina}}","disabled":true,"default":"PURCHASE","match":""},"revenue_value":{"type":"string","description":"{{Il valore del prodotto}}","required":false,"default":"","match":"price"},"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":"currency"}}},"quora":{"inputs":{"label":{"value":"Purchase","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore}}","required":false,"default":"","match":""}}}}}; extra_params['InitiateCheckout'] = {"name":"{{Inizio Checkout}}","extra_params":{"price":{"type":"float","description":"{{Il prezzo del prodotto}}","required":false,"default":"0.0"},"currency":{"type":"string","description":"{{Il codice della valuta in uso (USD, EUR ...)}}","required":false,"default":""},"count":{"type":"integer","description":"{{Il numero di prodotti nel carrello}}","required":false},"product_id":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false}},"platforms":{"webtracking":{"inputs":{"event_name":{"value":"Inizio Checkout","disabled":false},"event_value":{"value":"","placeholder":""}},"extra_params":[]},"facebook":{"inputs":{"label":{"value":"InitiateCheckout","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"num_items":{"type":"integer","description":"{{Il valore del prodotto}}","required":false,"default":"","match":"count"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"twitter":{"inputs":{"label":{"value":"InitiateCheckout","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"num_items":{"type":"integer","description":"{{Il valore del prodotto}}","required":false,"default":"","match":"count"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"tiktok":{"inputs":{"label":{"value":"StartCheckout","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"num_items":{"type":"integer","description":"{{Il valore del prodotto}}","required":false,"default":"","match":"count"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"reddit":{"inputs":{"label":{"value":"","disabled":true}},"extra_params":{"currency":{"type":"string","description":"{{La valuta utilizzata dal cliente}}","required":false,"default":"","match":""},"value":{"type":"float","description":"{{Il valore del prodotto}}","required":false,"default":"","match":""},"content_ids":{"type":"string","description":"L'ID del prodotto, o un array contenente pi\u00f9 id (Es: ['1','2'])","required":false,"default":"","match":"product_id"},"num_items":{"type":"integer","description":"{{Il valore del prodotto}}","required":false,"default":"","match":"count"},"content_type":{"type":"string","description":"La tipologia del prodotto passato (Lascia 'product' per il corretto funzionamento della ads dinamiche)","required":false,"default":"product","match":"","hidden":true}}},"analytics":{"extra_params":[]}}}; var standard_objectives_events = {}; standard_objectives_events['Chiamata Ricevuta'] = 'PhoneCall'; standard_objectives_events['Email Ricevuta'] = 'EmailContact'; standard_objectives_events['Referer'] = 'Referer'; standard_objectives_events[''] = ''; standard_objectives_events[''] = ''; if(typeof(standard_objectives_events[id]) !== 'undefined' && typeof(extra_params[standard_objectives_events[id]]) !== 'undefined') {
return extra_params[standard_objectives_events[id]];
} return false; } function webtracking_getNearestElement(element, selector) {
for (; element && element.tagName !== undefined; element = element.parentNode) {
if(jQuery(element).find(selector).length) return jQuery(element).find(selector);
}
return false;
} function webtracking_extractPriceFromString(price) {
price = price.replace(/[^0-9.,-]+/g,"");
if(parseFloat(price) && parseFloat(price) > 0) {
price = price.trim();
var result = price.replace(/[^0-9]/g, '');
if (/[,\.]\d{1,2}$/.test(price)) {
price = result.replace(/(\d{2})$/, '.$1');
}
}
return price;
} function webtracking_extractCurrencyFromString(price) {
var currency_list = {"USD":"$","CAD":"CA$","EUR":"€","AED":"AED","AFN":"Af","ALL":"ALL","AMD":"AMD","ARS":"AR$","AUD":"AU$","AZN":"man.","BAM":"KM","BDT":"Tk","BGN":"BGN","BHD":"BD","BIF":"FBu","BND":"BN$","BOB":"Bs","BRL":"R$","BWP":"BWP","BYR":"BYR","BZD":"BZ$","CDF":"CDF","CHF":"CHF","CLP":"CL$","CNY":"CN¥","COP":"CO$","CRC":"₡","CVE":"CV$","CZK":"Kč","DJF":"Fdj","DKK":"Dkr","DOP":"RD$","DZD":"DA","EEK":"Ekr","EGP":"EGP","ERN":"Nfk","ETB":"Br","GBP":"£","GEL":"GEL","GHS":"GH₵","GNF":"FG","GTQ":"GTQ","HKD":"HK$","HNL":"HNL","HRK":"kn","HUF":"Ft","IDR":"Rp","ILS":"₪","INR":"Rs","IQD":"IQD","IRR":"IRR","ISK":"Ikr","JMD":"J$","JOD":"JD","JPY":"¥","KES":"Ksh","KHR":"KHR","KMF":"CF","KRW":"₩","KWD":"KD","KZT":"KZT","LBP":"LB£","LKR":"SLRs","LTL":"Lt","LVL":"Ls","LYD":"LD","MAD":"MAD","MDL":"MDL","MGA":"MGA","MKD":"MKD","MMK":"MMK","MOP":"MOP$","MUR":"MURs","MXN":"MX$","MYR":"RM","MZN":"MTn","NAD":"N$","NGN":"₦","NIO":"C$","NOK":"Nkr","NPR":"NPRs","NZD":"NZ$","OMR":"OMR","PAB":"B\/.","PEN":"S\/.","PHP":"₱","PKR":"PKRs","PLN":"zł","PYG":"₲","QAR":"QR","RON":"RON","RSD":"din.","RUB":"RUB","RWF":"RWF","SAR":"SR","SDG":"SDG","SEK":"Skr","SGD":"S$","SOS":"Ssh","SYP":"SY£","THB":"฿","TND":"DT","TOP":"T$","TRY":"TL","TTD":"TT$","TWD":"NT$","TZS":"TSh","UAH":"₴","UGX":"USh","UYU":"$U","UZS":"UZS","VEF":"Bs.F.","VND":"₫","XAF":"FCFA","XOF":"CFA","YER":"YR","ZAR":"R","ZMK":"ZK"};
var current_currency_name = 'EUR';
Object.keys(currency_list).forEach(function(name) {
if(price.indexOf(currency_list[name]) >= 0) {
current_currency_name = name;
}
});
return current_currency_name;
} function webtracking_prependEvent(type, selettore, fn) {
var attachFn = function(element) {
jQuery(element).removeAttr(type).unbind(type);
var function_name = 'ms_' + type + '_' + Math.random().toString(36).substr(2, 9);
window[function_name] = fn;
jQuery(element).attr(type, function_name + '(this)');
}
if(jQuery(selettore).length) {
attachFn(jQuery(selettore));
} else {
jQuery('body').on('mouseenter touchenter ', selettore, function() {attachFn(jQuery(selettore))});
}
} jQuery(document).ready(function() {
initWebtrackingActions();
}); window.trackingUniqueID = (Math.random() + 1).toString(36).substring(7) + Date.now(); function _msFormatParamsFor(platform, id, parameters, extra_parameters) {
if(typeof(extra_parameters) !== 'object') {
extra_parameters = {};
}
var ary_to_return = {};
if(platform === 'analytics') {
ary_to_return = Object.assign({}, parameters);
delete ary_to_return['event_action'];
}
else if(platform === 'microsoft') {
ary_to_return = Object.assign({}, parameters);
delete ary_to_return['event_action'];
}
else if(platform === 'reddit') {
ary_to_return = Object.assign({}, parameters);
delete ary_to_return['event_action'];
}
else if(platform === 'quora') {
ary_to_return = Object.assign({}, parameters);
delete ary_to_return['event_action'];
}
else if(platform === 'gads') {
ary_to_return = Object.assign({}, parameters);
ary_to_return['send_to'] = '/' + parameters['conversion_label'];
delete ary_to_return['conversion_label'];
}
else if(platform === 'facebook' || platform === 'tiktok' || platform === 'twitter') {
ary_to_return = Object.assign({}, parameters);
delete ary_to_return['label'];
if(typeof(ary_to_return['currency']) === 'undefined' || !ary_to_return['currency']) {
ary_to_return['currency'] = 'EUR';
ary_to_return['value'] = 0.00;
}
}
var current_params = getTrackingDefaultEventByName(id);
if(current_params) {
try {
var current_extra_params = current_params['platforms'][platform]['extra_params'];
Object.keys(current_extra_params).forEach(function(param_id) {
if(typeof(ary_to_return[param_id]) === 'undefined' || ary_to_return[param_id] === '') {
ary_to_return[param_id] = current_extra_params[param_id]['default'];
}
});
Object.keys(current_extra_params).forEach(function(param_id) {
var value_to_sent = '';
var current_param_match = current_extra_params[param_id]['match'];
if(typeof(parameters[param_id]) !== 'undefined' && (typeof(parameters[param_id]) === 'number' || parameters[param_id].length)) {
value_to_sent = parameters[param_id];
} else if(current_param_match && current_param_match.length >= 1) {
if(typeof(extra_parameters[current_param_match]) !== 'undefined' && (typeof(extra_parameters[current_param_match]) === 'number' || extra_parameters[current_param_match].length)) {
value_to_sent = extra_parameters[current_param_match];
}
}
if(current_extra_params[param_id]['type'] === 'int') {
value_to_sent = (!isNaN(parseInt(value_to_sent)) ? parseInt(value_to_sent) : '');
} else if(current_extra_params[param_id]['type'] === 'float') {
value_to_sent = (!isNaN(parseFloat(value_to_sent)) ? parseFloat(value_to_sent) : '');
}
if(value_to_sent !== 0 || ['int', 'float'].indexOf(current_extra_params[param_id]['type']) >= 0) {
ary_to_return[param_id] = value_to_sent;
}
});
} catch(e) {}
}
Object.keys(ary_to_return).forEach(function(param_key) {
if(ary_to_return[param_key] === '') {
delete ary_to_return[param_key];
}
});
return ary_to_return;
} function msInternalTrack(tp, extra_parameters, action_id, async) {
if(typeof(async) === 'undefined') async = true;
async = true;
var tracking_parameters = JSON.parse(JSON.stringify(tp));
if(typeof(extra_parameters) !== 'object') {
extra_parameters = {};
}
/* SOSTITUISCO EVENTUALI SHORTCODES CON VALORI DEI PARAMETRI */
['webtracking', 'facebook', 'analytics', 'tiktok', 'reddit', 'twitter', 'microsoft', 'gads'].forEach(function(platform) {
/* Sostituisco eventuali shortcodes parametri */
if(typeof(tracking_parameters[platform]) === 'object') {
Object.keys(tracking_parameters[platform]).forEach(function(param_key) {
Object.keys(extra_parameters).forEach(function(extra_key) {
try {
tracking_parameters[platform][param_key] = tracking_parameters[platform][param_key].replace('{' + extra_key + '}', extra_parameters[extra_key]);
} catch(e) {}
});
});
}
}); var sendTrack = function() { if(typeof(MS_initVisit) === 'function') {MS_initVisit(true);} if(tracking_parameters.enable_external_tracking == '1' && (typeof(tracking_parameters['execAction']) === 'undefined' || !tracking_parameters['execAction'])) { } var trackingSources = {}; trackingSources['Fw360_WebTracking_UniqueID'] = ts_getCookie('Fw360_WebTracking_UniqueID'); trackingSources['_fbc'] = ts_getCookie('_fbc'); trackingSources['_ttp'] = ts_getCookie('_ttp'); trackingSources['ttclid'] = ts_getCookie('ttclid'); trackingSources['_fbp'] = ts_getCookie('_fbp'); trackingSources['_ga'] = ts_getCookie('_ga'); trackingSources['_gclid'] = ts_getCookie('_gclid'); trackingSources['gclid'] = ts_getCookie('gclid'); trackingSources['fbclid'] = ts_getCookie('fbclid'); trackingSources['gad_source'] = ts_getCookie('gad_source'); trackingSources['gad_campaignid'] = ts_getCookie('gad_campaignid'); trackingSources['wbraid'] = ts_getCookie('wbraid'); trackingSources['gbraid'] = ts_getCookie('gbraid'); trackingSources['msclkid'] = ts_getCookie('msclkid'); trackingSources['li_fat_id'] = ts_getCookie('li_fat_id'); trackingSources['utm_id'] = ts_getCookie('utm_id'); trackingSources['utm_term'] = ts_getCookie('utm_term'); trackingSources['utm_content'] = ts_getCookie('utm_content'); trackingSources['utm_source'] = ts_getCookie('utm_source'); trackingSources['utm_medium'] = ts_getCookie('utm_medium'); trackingSources['utm_campaign'] = ts_getCookie('utm_campaign'); trackingSources['_referrer'] = ts_getCookie('_referrer'); trackingSources['_utm'] = ts_getCookie('_utm'); tracking_parameters['webtracking_id'] = window.webtracking_id;
jQuery.ajax({
type: "POST",
url: window.webtracking_Url + '?proxy',
xhrFields: { withCredentials: true },
async: async,
data: {
token: 'ZGdoandSZmljYkxtWEFZWXA5aWVqZz09',
current_url: location.href,
uniqueID: window.trackingUniqueID,
project_id: window.webtracking_id,
track_info: tracking_parameters['webtracking'],
action_id: action_id,
global_track: tracking_parameters,
track_extra: extra_parameters,
userID: ts_getCookie('Fw360_WebTracking_UserID'),
sources: trackingSources,
exec_action: (typeof(tracking_parameters['execAction']) !== 'undefined' ? tracking_parameters['execAction'] : '')
}
});
window.trackingUniqueID = (Math.random() + 1).toString(36).substring(7) + Date.now(); }; if(window.webtracking_loading_pixels.length) {
(function checkPixelLoading() {
if (!window.webtracking_loading_pixels.length) {
sendTrack();
} else {
setTimeout(checkPixelLoading, 10);
}
})();
} else {
sendTrack();
} } function msTrack(event_name, extra_params) {
if(typeof(extra_params) !== 'undefined') {
if(typeof(extra_params) !== 'object') {
extra_params = {value: extra_params};
}
} else {
extra_params = {};
}
var manual_action = getWebtrackingManualAction(event_name, extra_params);
msInternalTrack(manual_action, extra_params, '');
} function webtracking_getFormParams(elem) {
var data = {};
jQuery(elem).find('[name]').each(function() {
data[$(this).attr('name')] = $(this).val();
if($(this).attr('type') === 'email' && ts_getCookie('Fw360_WebTracking_UserEmail') === '') {
ts_setCookie('Fw360_WebTracking_UserEmail', $(this).val());
}
});
return data;
} function msProductEvent(event_name, products_data, extra) {
if(typeof(extra) === 'undefined') extra = {};
if(typeof(window.enhancedEcommerceEvent) == 'undefined') window.enhancedEcommerceEvent = {};
var dataToSent = extra;
if(products_data.length) {
dataToSent.items = products_data;
}
window.enhancedEcommerceEvent[event_name] = dataToSent;
} function getWebtrackingManualAction(event_name, extra_params) {
var manual_action = {};
if(typeof(window.webtracking_manual_actions[event_name]) == 'object') {
manual_action = window.webtracking_manual_actions[event_name];
} else {
console.warn('[Webtracking] È stato inviato un Evento (' + event_name + ') non esistente negli Obiettivi, pertanto l\'azione verrà tracciata solo su Webtracking e non saranno inviati parametri extra.');
manual_action = {
enable_external_tracking: 0,
webtracking: {
event_name: event_name,
event_value: (typeof(extra_params.value) !== 'undefined' ? extra_params.value : '')
}
};
}
return manual_action;
} function msTrackUser(email, user_data) {
ts_setCookie('Fw360_WebTracking_UserEmail', email);
} if(window !== window.top) { var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
var eventer = window[eventMethod];
var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
eventer(messageEvent,function(event) {
if(event.data.cmd === 'initVisualSelector') {
initVisualSelector(event.data.preferences);
}
}, false);
/* DISABILITA TUTTI I LINK ESTERNI */
jQuery('a').filter(function() {
return (this.hostname && this.hostname !== location.hostname) || jQuery(this).attr('target') === "_blank";
}).attr("href", "#");
function initVisualSelector(preferences) {
if(typeof(preferences.include_css) !== 'undefined') {
jQuery("head").append('');
}
var mousedownTimer = false;
var onSelectionFunction = function (target) {
var selector = jQuery(target).getSelector(true, 3, (typeof (preferences.limit_tags) !== 'undefined' ? preferences.limit_tags : []));
var is_form = 0;
var $form_element = (jQuery(target)[0].attrName === 'FORM' ? jQuery(target) : jQuery(target).closest('form'));
var extra = {};
if($form_element.hasClass('.MSForm')) {
is_form = $form_element.data('form_id');
}
if($form_element.length) {
var form_fields = [];
$form_element.find('[name]').each(function() {
form_fields.push(jQuery(this).attr('name'));
});
extra.form_fields = form_fields;
}
parent.postMessage(JSON.parse(JSON.stringify({
cmd: "onSelectionFunction",
selector: selector,
is_form: is_form,
extra: extra
})),"*");
};
jQuery('body').off('contextmenu').on('contextmenu', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
onSelectionFunction(event.target);
}).off('mousedown').on('mousedown', function (event) {
event.preventDefault();
event.stopImmediatePropagation();
event.stopPropagation();
var $button = jQuery(event.target);
mousedownTimer = setTimeout(function () {
onSelectionFunction(event.target);
$button.addClass('disable_temp');
}, 1000);
}).on('mouseup', function (event) {
if (mousedownTimer !== false) {
clearTimeout(mousedownTimer);
mousedownTimer = false;
}
}).off('click').on('click', function (event) {
var $button = jQuery(event.target);
if ($button.hasClass('disable_temp')) {
event.preventDefault();
event.stopImmediatePropagation();
event.stopPropagation();
$button.removeClass('disable_temp');
return false;
}
});
window.addEventListener('beforeunload', function (e) {
parent.postMessage(JSON.parse(JSON.stringify({
cmd: "onIframeUnload"
})),"*");
});
parent.postMessage(JSON.parse(JSON.stringify({
cmd: "connected",
url: location.href
})),"*");
}
/* FUNZIONE PER OTTENERE IL SELETTORE */
!(function ($, undefined) {
var get_selector = function (element, max_parents, tag_limit) {
var pieces = [];
var current_parent = 0;
var is_ok = false;
var tag_found = true;
if(tag_limit.length > 0) {
tag_found = false;
}
for (; ($(element).length && typeof(element.tagName) !== 'undefined' && current_parent < max_parents && !is_ok); element = element.parentNode) {
var currently_pieces = [];
if(tag_limit.length > 0) {
if(tag_limit.indexOf(element.tagName) >= 0) {
tag_found = true;
}
}
if(tag_found) {
if (element.id && !/\s/.test(element.id)) {
if (current_parent < 2 && element.tagName === 'A') {
return '#' + element.id;
}
currently_pieces.unshift('#' + element.id);
is_ok = true;
} else {
if (element.className) {
var classes = element.className.split(' ');
for (var i in classes) {
if (classes.hasOwnProperty(i) && classes[i].length && classes[i].indexOf('col-') < 0 && classes[i].indexOf('msVisualElement') < 0 && classes[i].indexOf('mb-') < 0 && classes[i] !== 'row') {
currently_pieces.unshift('.' + classes[i]);
}
}
} else if (typeof(element.name) === 'string' && element.name.length) {
currently_pieces.unshift('[name="' + element.name + '"]');
}
}
if (currently_pieces.length > 0 && tag_found) {
currently_pieces.unshift(' ');
current_parent++;
pieces = currently_pieces.concat(pieces);
}
}
}
return pieces.slice(1).join('');
};
jQuery.fn.getSelector = function (only_one, max_parent, tag_limit) {
if(typeof(max_parent) == 'undefined') max_parent = 10;
if(typeof(tag_limit) == 'undefined') tag_limit = [];
if (true === only_one) {
return get_selector(this[0], max_parent, tag_limit);
} else {
return jQuery.map(this, function (el) {
return get_selector(el, max_parent, tag_limit);
});
}
};
})(window.jQuery); }