var google_tag = document.createElement('script'); google_tag.async = true; google_tag.src = 'https://www.googletagmanager.com/gtag/js?id=AW-944112003'; document.head.insertBefore(google_tag, document.getElementsByTagName('script')[0]); window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'AW-944112003'); !function(f,b,e,v,n,t,s) {if(f.fbq)return;n=f.fbq=function(){n.callMethod? n.callMethod.apply(n,arguments):n.queue.push(arguments)}; if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; n.queue=[];t=b.createElement(e);t.async=!0; t.src=v;s=b.getElementsByTagName(e)[0]; s.parentNode.insertBefore(t,s)}(window,document,'script', 'https://connect.facebook.net/en_US/fbevents.js'); fbq('init', '815823761785678'); fbq('track', 'PageView'); var google_tag = document.createElement('script'); google_tag.async = true; google_tag.src = 'https://www.googletagmanager.com/gtag/js?id=UA-29172852-14'; document.head.insertBefore(google_tag, document.getElementsByTagName('script')[0]); window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-29172852-14'); var slt = function(value){ const apiUrl = "https://msd8t5sbhj.execute-api.eu-west-1.amazonaws.com/default/stagelinkPurchase"; addUrlToRecord(); var urlList = JSON.parse(localStorage.getItem('sl.urlRecord')); if(urlList == null || urlList == []){ urlList = [window.location.href]; } fetch(apiUrl, { method: 'POST', headers: { 'x-api-key': 'IPnDK1FlpK7bNwjVr6eMs4aiWaVv3IFG2wWGcJUk' }, body: JSON.stringify({value: value, eventUrlList: urlList}), mode: 'no-cors' }).then(function(res){ clearUrlRecord(); }); } function remove(array, element) { const index = array.indexOf(element); if (index !== -1) { array.splice(index, 1); } } function addUrlToRecord(){ var urlList = JSON.parse(localStorage.getItem('sl.urlRecord')); if(urlList == null){ urlList = []; } if(urlList.includes(window.location.href)){ remove(urlList, window.location.href); } urlList.push(window.location.href); localStorage.setItem("sl.urlRecord", JSON.stringify(urlList)); } function clearUrlRecord(){ localStorage.setItem("sl.urlRecord", JSON.stringify([])); } window.setInterval( addUrlToRecord, 2000 ); Tito.on('registration:finished', function(data){ try{ var pv = data.total; var cu = 'EUR'; } catch(e){ var pv = 0.0; var cu = 'EUR'; } gtag('event', 'conversion', { 'send_to': 'AW-944112003/hA8FCP-KiXoQg4OYwgM', 'value': pv, 'currency': cu }); fbq('track', 'Purchase', { value: pv, currency: cu }); gtag('event', 'conversion', { 'send_to': 'UA-29172852-14' }); slt(pv); })