1"use strict"; 2//debug mode 3const debugTracking = false; 4//Tarte au citron init (rgpd cookie banner) 5tarteaucitron.init({ 6 privacyUrl: privacy_url, 7 useExternalCss: true, 8 removeCredit: true, 9 iconSrc: "https://cdn.vates.tech/rgpd/manage-cookie-icon.png", 10 orientation: "bottom", 11 /* 12 cookieDomain: ".vates.tech", 13custom domain for cookie to avoid re asking consent at each visit on different subdomain 14But we need to set the param previously because we have other domain name like xc-ng.com, etc. 15https://github.com/AmauriC/tarteaucitron.js/blob/55a0daa0407274c3a9aceb57aea55ba611a5d928/README.md?plain=1#L65 16*/ 17}); 18//Mautic (self hosted) tracking 19tarteaucitron.services.mauticcustom = { 20 key: "mauticcustom", 21 type: "analytic", 22 name: "Mautic (Self hosted)", 23 uri: "https://www.mautic.org/privacy-policy/", 24 needConsent: true, 25 cookies: ["mtc_id", "mtc_sid"], 26 js: function () { 27 "use strict"; 28 //mautic tracking 29 (function (w, d, t, u, n, a, m) { 30 w["MauticTrackingObject"] = n; 31 ((w[n] = 32 w[n] || 33 function () { 34 (w[n].q = w[n].q || []).push(arguments); 35 }), 36 (a = d.createElement(t)), 37 (m = d.getElementsByTagName(t)[0])); 38 a.async = 1; 39 a.src = u; 40 m.parentNode.insertBefore(a, m); 41 })(window, document, "script", "https://campaign.vates.tech/mtc.js", "mt"); 42 mt("send", "pageview"); 43 }, 44}; 45(tarteaucitron.job = tarteaucitron.job || []).push("mauticcustom"); 46//Matomo (self hosted) tracking 47tarteaucitron.user.matomoId = matomo_id; 48tarteaucitron.user.matomoHost = "https://visit.vates.tech/"; 49tarteaucitron.user.matomoCustomJSPath = "https://visit.vates.tech/matomo.js"; 50tarteaucitron.user.matomoDontTrackPageView = false; 51tarteaucitron.user.matomoFullTracking = true; 52(tarteaucitron.job = tarteaucitron.job || []).push("matomocloud"); 53//Listner for form submit events 54function trackFormSubmit(event) { 55 const form = event.target; 56 //defauts; 57 let TrackwithMautic = true; 58 let TrackwithMatomo = true; 59 let category = "Form"; 60 let action = "Generic"; 61 let name = form.getAttribute("action"); 62 //Debug : log the initial values 63 if (debugTracking) { 64 console.debug("trackFormSubmit->initial values", [category, action, name]); 65 } 66 //check if it's a mautic form 67 const mauticId = form.getAttribute("data-mautic-form"); 68 if (mauticId) { 69 action = `Mautic`; 70 name = mauticId; 71 //dont't track with mautic as it's already tracked with the mautic script 72 TrackwithMautic = false; 73 } else if (name && name.length > 10) { 74 //check is action contains formage.vates.tech 75 if (name.includes("formage.vates.tech")) { 76 action = "Formage"; 77 // dont't track with Mautic or Matomo as it's already tracked 78 // with the message listener at the end of this file 79 TrackwithMautic = false; 80 TrackwithMatomo = false; 81 } 82 //check is action contains cal.vates.tech 83 else if (name.includes("cal.vates.tech")) { 84 action = "Cal"; 85 } 86 //check is action contains account.vates.fr 87 else if (name.includes("account.vates.fr")) { 88 action = "Account"; 89 } 90 try { 91 const url = new URL(name); 92 const parts = url.pathname.split("/").filter(Boolean); 93 name = parts.length ? parts[parts.length - 1] : "error"; 94 } catch (e) { 95 console.error(e); 96 } 97 } 98 //track with mautic if possible 99 if (TrackwithMautic) { 100 MauticTrackEvent({ page_url: name, page_title: action }); 101 } 102 //track with matomo if possible 103 if (TrackwithMatomo) { 104 window._paq.push(["trackEvent", category, action, name]); 105 } 106 //Debug : log the event 107 if (debugTracking) { 108 console.debug("trackFormSubmit->trackEvent", [category, action, name]); 109 } 110} 111function InitEventTracking() { 112 //track download links (like on xcp-ng.org) 113 document.querySelectorAll(".track-download").forEach(function (link) { 114 link.addEventListener("click", function () { 115 var type = link.getAttribute("data-download-type") || "unknown"; 116 //Debug : log the event 117 if (debugTracking) { 118 console.debug("trackDownload", type); 119 } 120 //trach with mautic if possible 121 MauticTrackEvent({ 122 page_url: "track-download-" + type, 123 page_title: "Download clicked : " + type, 124 }); 125 //track with matomo if possible 126 window._paq.push(["trackEvent", "Link", "Download", type]); 127 }); 128 }); 129 //track external links (like social media) 130 document.querySelectorAll(".track-link").forEach(function (link) { 131 link.addEventListener("click", function () { 132 var type = link.getAttribute("data-link-type") || "unknown"; 133 //Debug : log the event 134 if (debugTracking) { 135 console.debug("trackLink", type); 136 } 137 //trach with mautic if possible 138 MauticTrackEvent({ 139 page_url: "track-link-" + type, 140 page_title: "Link clicked : " + type, 141 }); 142 //track with matomo if possible 143 window._paq.push(["trackEvent", "Link", "External", type]); 144 }); 145 }); 146 //track existing forms 147 document.querySelectorAll("form").forEach((form) => { 148 form.addEventListener("submit", trackFormSubmit); 149 if (debugTracking) { 150 console.debug("document.querySelectorAll()->forEach", form); 151 } 152 }); 153 //track added forms 154 const observer = new MutationObserver((mutations) => { 155 mutations.forEach((mutation) => {
156 mutation.addedNodes.forEach((node) => { 157 if (node.nodeType === 1 && node.tagName === "FORM") { 158 node.addEventListener("submit", trackFormSubmit); 159 if (debugTracking) { 160 console.debug("mutation.addedNodes->node.tagName === FORM", node); 161 } 162 } else if (node.querySelectorAll) { 163 node.querySelectorAll("form").forEach((form) => { 164 form.addEventListener("submit", trackFormSubmit); 165 if (debugTracking) { 166 console.debug("mutation.addedNodes->node.querySelectorAll", form); 167 } 168 }); 169 } 170 }); 171 }); 172 }); 173 observer.observe(document.body, { childList: true, subtree: true }); 174} 175if (document.readyState === "loading") { 176 // Loading hasn't finished yet 177 document.addEventListener("DOMContentLoaded", InitEventTracking); 178} else { 179 // `DOMContentLoaded` has already fired 180 InitEventTracking(); 181} 182//listen to banner open & close event to handle body class 183window.addEventListener("tac.open_alert", function (event) { 184 document.getElementsByTagName("body")[0].classList.add("tac-alert-opened"); 185}); 186window.addEventListener("tac.close_alert", function (event) { 187 document.getElementsByTagName("body")[0].classList.remove("tac-alert-opened"); 188}); 189//listen to allow or deny matomo and mautic cookies 190document.addEventListener("mauticcustom_allowed", function (event) { 191 _paq.push(["trackEvent", "Consent", "MauticAllowed"]); 192}); 193document.addEventListener("mauticcustom_disallowed ", function (event) { 194 _paq.push(["trackEvent", "Consent", "MauticDisallowed"]); 195}); 196document.addEventListener("matomocloud_allowed", function (event) { 197 _paq.push(["trackEvent", "Consent", "MatomoAllowed"]); 198}); 199document.addEventListener("matomocloud_disallowed ", function (event) { 200 _paq.push(["trackEvent", "Consent", "MatomoDisallowed"]); 201}); 202//Post message listener for iframe tracking 203window.addEventListener("message", function (event) { 204 //debug : log the received message 205 if (debugTracking) { 206 console.debug("window.addEventListener('message')", event); 207 } 208 // check origin 209 if (event.origin !== "https://vates.tech") { 210 return; 211 } 212 // check type 213 if (!event.data || event.data.type !== "FORM_SUBMIT_TRACKING") { 214 return; 215 } 216 //track the form submission with the received data 217 TrackFormageData(event.data); 218}); 219//listen to formage vates.tech forms (like contact form) 220function TrackFormageData(data_object) { 221 //debug : log the received message 222 if (debugTracking) { 223 console.debug("TrackFormageData()", data_object); 224 } 225 //send a tracking event to matomo 226 _paq.push(["trackEvent", "Form", "Formage", data_object.page_url]); 227 //and mautic with the form name and metadata 228 MauticTrackEvent(data_object); 229} 230//Mautic pixel tracking for custom eventing 231//https://campaign.vates.tech/mtracking.gif?page_url=register-demo&page_title=Book%20a%20demo%20request&tags=demo&hostcount=60&email=test-maut
231[email protected] 232function MauticTrackEvent(data_object) { 233 //debug : log the received message 234 if (debugTracking) { 235 console.debug("MauticTrackEvent()", data_object); 236 } 237 // possible key listed below 238 // the key must exist in Mautic 239 // and be configured to Publicly updatable 240 const allowed_keys = [ 241 "page_url", 242 "page_title", 243 "tags", 244 "hostcount", 245 "email", 246 "project_timeline", 247 "project_type", 248 "firstname", 249 "lastname", 250 "position", 251 "country", 252 ]; 253 //build the url with the available data_object key / value pairs 254 let url = ""; 255 for (var key of allowed_keys) { 256 if (data_object.hasOwnProperty(key)) { 257 url += key + "=" + encodeURIComponent(data_object[key]) + "&"; 258 if (debugTracking) { 259 console.debug( 260 "data_object.hasOwnProperty(" + key + ") true", 261 data_object[key], 262 ); 263 } 264 } else { 265 if (debugTracking) { 266 console.debug("data_object.hasOwnProperty(" + key + ") false"); 267 } 268 } 269 } 270 //if empty url => nothing to track => stop here 271 if (url === "") { 272 return; 273 } 274 //remove the last & 275 url = url.slice(0, -1); 276 //create an image node to track the event 277 var img = new Image(); 278 img.src = "https://campaign.vates.tech/mtracking.gif?" + url; 279 //add an invisible image at the end of the body to trigger the request 280 img.style.display = "none"; 281 document.body.appendChild(img); 282 //debug : log the image creation 283 if (debugTracking) { 284 console.debug("document.body.appendChild(img)", img.src); 285 } 286}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.