1/*Estadístiques Google Analytics*/ 2oct8ne=null;// ha de ser global 3window.dataLayer = window.dataLayer || [];// ha de ser global 4 //setGA_TRACKING_CONVER només per ok 5 function gestioPixels(setAccount,setAutoLink,setGA_TRACKING_ID,setGTM,oct8neCode,oct8neLicense,oct8neBaseUrl,oct8neDeparId,setSizmekDL,setActiuPF,pixelFace,setHotjar,setGA_TRACKING_CONVER,oct8neLocale){ 6 $(".popupBarraCookie").css("display","none"); 7 var valCookie2=getCookie('valCookie2'); 8 if(valCookie2==null)valCookie2=1;//FERROCARRIL 9 10 if(valCookie2==1 && setAccount!=null && setAccount!=""){ 11 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 12 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 13 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 14 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 15 16 if(setAutoLink!=null && setAutoLink!=""){ 17 ga('create', setAccount, 'auto', {'allowLinker': true}); 18 ga('require', 'linker'); 19 ga('linker:autoLink', [setAutoLink]); 20 ga('set', 'anonymizeIp', true); 21 }else{ 22 ga('create', setAccount, 'auto'); 23 ga('set', 'anonymizeIp', true); 24 } 25 ga('send', 'pageview'); 26 } 27 28 //Global site tag (gtag.js) - Google Analytics 29 if(valCookie2==1 && setGA_TRACKING_ID!=null && setGA_TRACKING_ID!=""){ 30 (function(i,s,o,g,r,a,m){i['GoogleTagManager']=r;i[r]=i[r]||function(){ 31 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 32 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 33 })(window,document,'script','https://www.googletagmanager.com/gtag/js?id='+setGA_TRACKING_ID,'gtag'); 34 35 function gtag(){dataLayer.push(arguments);} 36 gtag('js', new Date()); 37 gtag('config', setGA_TRACKING_ID); 38 39 //sólo final compra (ok) 40 if(setGA_TRACKING_CONVER!=null && setGA_TRACKING_CONVER!="")gtag('event', 'conversion', {'send_to': setGA_TRACKING_CONVER}); 41 } 42 43 if(valCookie2==1){ 44 //Google Tag Manager 45 if(setGTM!=null && setGTM!=""){ 46 (function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 47 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 48 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
49 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 50 })(window,document,'script','dataLayer',setGTM); 51 52 $("#googleTagGTM").attr("src", "https://www.googletagmanager.com/ns.html?id="+setGTM); 53 } 54 55 //oct8ne code 56 if(oct8neCode!=null && oct8neCode!="" && oct8neCode!="F"){ 57 oct8ne = document.createElement("script"); 58 oct8ne.server = "backoffice-eu.oct8ne.com/"; 59 oct8ne.type = "text/javascript"; 60 oct8ne.async = true; 61 oct8ne.license=oct8neLicense; 62 oct8ne.src = (document.location.protocol == "https:" ? "https://" : "http://") + "static-eu.oct8ne.com/api/v2/oct8ne-api-2.3.js?" + (Math.round(new Date().getTime() / 86400000)); 63 oct8ne.locale = oct8neLocale; 64 oct8ne.baseUrl =oct8neBaseUrl; 65 oct8ne.allowedDepartmentsId = oct8neDeparId; 66 var s = document.getElementsByTagName("script")[0]; 67 insertOct8ne(); 68 function insertOct8ne() { 69 s.parentNode.insertBefore(oct8ne, s); 70 } 71 } 72 73 //Hotjar Tracking Code 74 if(setHotjar!=null && setHotjar!=""){ 75 (function(h,o,t,j,a,r){h.hj=h.hj||function(){(h.hj.q=h.hj.q||[]).push(arguments)};h._hjSettings={hjid:setHotjar,hjsv:6};a= 76 o.getElementsByTagName('head')[0];r=o.createElement('script');r.async=1;r.src= 77 t+h._hjSettings.hjid+j+h._hjSettings.hjsv;a.appendChild(r);})(window,document,'https://static.hotjar.com/c/hotjar-','.js?sv='); 78 } 79 80 if(setSizmekDL!=null && setSizmekDL!=""){ 81 (function(e, s, t){t = t || {}, t.id = e, versaTagObj = { $: [], onready: 82 function(e) { this.$.push(e) } }; var n = s.getElementsByTagName("script")[0], 83 r = s.createElement("script"); r.options = t, r.async = !0, r.src = 84 'https://secure-ds.serving-sys.com/SemiCachedScripts/ebOneTag.js?id='+e, r.options = t, 85 n.parentNode.insertBefore(r, n) })(setSizmekDL, document, { dataLayer:"SizmekDataLayer" }); 86 } 87 88 if(setActiuPF!=null && setActiuPF=="T"){ 89 loadFacebookPixel(pixelFace); 90 } 91 } 92 } 93 94 /*Facebook Pixel*/ 95 function loadFacebookPixel(pixelFace){ 96 !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? 97 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 98 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 99 n.queue=[];t=b.createElement(e);t.async=!0; 100 t.src=v;s=b.getElementsByTagName(e)[0]; 101 s.parentNode.insertBefore(t,s)}(window,document,'script', 102 'https://connect.facebook.net/en_US/fbevents.js'); 103 fbq('init', pixelFace); 104 fbq('track', 'PageView'); 105 106 var face_url = 'https://www.facebook.com/tr?id=#pixelFace#&ev=PageView&noscript=1'; 107 face_url=face_url.replace("#pixelFace#", pixelFace); 108 $("#addFace")[0].src=face_url; 109 } 110 111 function loadFacebookPixelPurchase(pixelFace,total,aValor){ 112 !function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod? 113 n.callMethod.apply(n,arguments):n.queue.push(arguments)}; 114 if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0'; 115 n.queue=[];t=b.createElement(e);t.async=!0; 116 t.src=v;s=b.getElementsByTagName(e)[0]; 117 s.parentNode.insertBefore(t,s)}(window,document,'script', 118 'https://connect.facebook.net/en_US/fbevents.js'); 119 fbq('init', pixelFace); 120 fbq('track', 'PageView'); 121 122/* var aAux=null; 123 var purchase=[]; 124 for (var i=0;i<aValor.length;i++){ 125 aAux=aValor[i].split("~"); 126 purchase.push({'id':aAux[3],'quantity':aAux[2]}); 127 }*/ 128 129 fbq('track', 'Purchase',{ 130 value: total, 131 currency: 'EUR' 132 }); 133 134 var face_url = 'https://www.facebook.com/tr?id=#pixelFace#&ev=PageView&noscript=1'; 135 face_url=face_url.replace("#pixelFace#", pixelFace); 136 $("#addFace")[0].src=face_url; 137 } 138 139 /*Enviament dades al finalitzar compra*/ 140 function pixelsAnalyticsCommerce(codiMuseu,total,identAny,numReserva,aEcommerce,setEcommerce,setEcommerceTrans,setEcommerceDatalayer,setEcommerceDatalayerGA4){ 141 if(setEcommerce!=null && setEcommerce=="T"){ 142 loadEcommerce(codiMuseu.substring(0, 3)+"-"+identAny+"-"+numReserva, aEcommerce, total.toFixed(2)); 143 } 144 145 if(setEcommerceTrans!=null && setEcommerceTrans=="T"){ 146 loadEcommerceTrans(codiMuseu.substring(0, 3)+"-"+identAny+"-"+numReserva, aEcommerce, total.toFixed(2)); 147 } 148 149 if(setEcommerceDatalayer!=null && setEcommerceDatalayer=="T"){ 150 loadEcommerceDatalayer(codiMuseu.substring(0, 3)+"-"+identAny+"-"+numReserva, aEcommerce, total.toFixed(2)); 151 } 152 153 if(setEcommerceDatalayerGA4!=null && setEcommerceDatalayerGA4=="T"){ 154 loadEcommerceDatalayerGA4(codiMuseu,codiMuseu.substring(0, 3)+"-"+identAny+"-"+numReserva, aEcommerce, total.toFixed(2)); 155 } 156 } 157 158 /*Enviament dades proces compra*/ 159 function pixelsAnalyticsProcesCompra(setMesureCheckoutGA4, setPaymentInfoGA4, aEcommerce){ 160 if(setMesureCheckoutGA4!=null && setMesureCheckoutGA4=="T"){//en el carrito (measure_a_checkout) 161 loadEcommerceDatalayerBeginCheckoutGA4(aEcommerce); 162 } 163 if(setPaymentInfoGA4!=null && setPaymentInfoGA4=="T"){//hacia el banco (add_payment_info) 164 loadEcommerceDatalayerPaymentInfoGA4(aEcommerce); 165 } 166 } 167 168 /*Enviament dades al finalitzar compra*/ 169 function pixelsAnalyticsOthers(codiMuseu,total,identAny,numReserva,gConversionId,gConversionLabel,gUrl,qservz_url,qservz_campaign,lang){ 170 loadQuisma(total.toFixed(2),codiMuseu.substring(0, 3)+"-"+identAny+"-"+numReserva,qservz_url,qservz_campaign,lang); 171 loadAddWords(gConversionId,gConversionLabel,gUrl); 172 } 173 174 /*Estadístiques Quisma*/ 175 function loadQuisma(totalCalculat,identif,qservz_url,qservz_campaign,lang){ 176 if(qservz_url!=null && qservz_url!="" && qservz_campaign!=null && qservz_campaign!=""){ 177 (function() { 178 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 179 ga.src = qservz_url; 180 qservz_url=qservz_url.replace("#campaign#", qservz_campaign); 181 qservz_url=qservz_url.replace("#orderid#", identif); 182 qservz_url=qservz_url.replace("#totalPrice#", totalCalculat); 183 qservz_url=qservz_url.replace("#lang#", lang); 184 185 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 186 187 $("#Quisma")[0].src=qservz_url; 188 })(); 189 }else $("#Quisma").css("display","none"); 190 } 191 192 /*Ecommerce Analytics*/ 193 function loadEcommerce(identif, aValor, total){ 194 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 195 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 196 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 197 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 198 199 identif='EC-'+identif;//+"-1"; 200 ga('require', 'ec'); 201 ga('set', '&cu', 'EUR'); 202 203 for (var i=0;i<aValor.length;i++){ 204 aAux=aValor[i].split("~"); 205 ga('ec:addProduct', { 206 'id': identif, 207 'name': aAux[1], 208 'category': 'Entrada', 209 'brand': identif, 210 'variant': "-", 211 'price': aAux[0], 212 'quantity': aAux[2] 213 }); 214 } 215 216 ga('ec:setAction', 'purchase', { 217 id: identif, 218 affiliation: 'Centre Cálcul Girona', 219 revenue: total 220 }); 221 222 ga('send', 'pageview'); 223 } 224 225 226 /*Ecommerce Analytics*/ 227 /*aValor=preu~descrip~persones~codiActiv~tipus*/ 228 function loadEcommerceTrans(identif, aValor, total){ 229 (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ 230 (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), 231 m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) 232 })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); 233 234 identif='ECT-'+identif; 235 ga('require', 'ecommerce'); 236 237 ga('ecommerce:addTransaction', { 238 'id': identif, // Transaction ID. Required. 239 'affiliation': 'Centre Cálcul Girona', // Affiliation or store name. 240 'revenue': total, // Grand Total. 241 'currency': 'EUR' 242 }); 243 244 var category='Actividad';//Actividad, combinada, artículo 245 var sku=''; 246 for (var i=0;i<aValor.length;i++){ 247 aAux=aValor[i].split("~"); 248 if(aAux[4]=='A')category='Actividad'; 249 else{ 250 if(aAux[4]=='B')category='Artículo'; 251 else category='Combinada'; 252 } 253 sku='SKU-'+aAux[3]; 254 ga('ecommerce:addItem', { 255 'id': identif, //i+1 +'-3' 256 'name': aAux[1], 257 'sku':sku, 258 'category': category, 259 'price': aAux[0], 260 'quantity': aAux[2], 261 'currency': 'EUR' 262 }); 263 ga('ecommerce:send'); 264 } 265 } 266 267 /*Ecommerce Datalayer*/ 268 /*aValor=preu~descrip~persones~codiActiv~tipus*/ 269 function loadEcommerceDatalayer(identif, aValor, total){ 270 identif='ECD-'+identif; 271 272 var aTransProducts=[]; 273 var category='Actividad';//Actividad, combinada, artículo 274 var sku=''; 275 for (var i=0;i<aValor.length;i++){ 276 aAux=aValor[i].split("~"); 277 if(aAux[4]=='A')category='Actividad'; 278 else{ 279 if(aAux[4]=='B')category='Artículo'; 280 else category='Combinada'; 281 } 282 sku='SKU-'+aAux[3]; 283 aTransProducts.push({ 284 'name': aAux[1], //Nombre del producto 285 'sku':sku, //Código SKU de producto 286 'category': category, //Categoría del producto(opciona) 287 'price': aAux[0],//Precio unitario 288 'quantity': aAux[2]//Número de elementos 289 }); 290 } 291 292 dataLayer.push({ 293 'event': 'transaction', 294 'transactionId': identif, // Identificador de transacción único. Required. 295 'transactionAffiliation': 'Centre Calcul Girona', // Partner o tienda 296 'transactionTotal': total, // Valor total de la transacción 297 'transactionProducts': aTransProducts 298 }); 299 } 300 301 /*Ecommerce Datalayer per GA4*/ 302 /*aValor=preu~descrip~persones~codiActiv~tipus~codiTarifa*/ 303 function loadEcommerceDatalayerGA4(codiMuseu,identif, aValor, total){ 304 identif='ECDGA4-'+identif; 305 306 var aItems=[]; 307 var category='Actividad';//Actividad, combinada, artículo 308 var sku=''; 309 for (var i=0;i<aValor.length;i++){ 310 aAux=aValor[i].split("~"); 311 if(aAux[4]=='A')category='Actividad'; 312 else{ 313 if(aAux[4]=='B')category='Artículo'; 314 else category='Combinada'; 315 } 316 sku='SKU-'+aAux[3]+'-'+aAux[5]; 317 aItems.push({ 318 'item_name': aAux[1], //Nombre del producto 319 'item_id':sku, //Código SKU de producto 320 'price': aAux[0],//Precio unitario 321 'item_brand': codiMuseu, 322 'item_category': category, 323 'item_variant': "", 324 'quantity': aAux[2]//Número de elementos 325 }); 326 } 327 328 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 329 dataLayer.push({ 330 event: "purchase", 331 ecommerce: { 332 transaction_id: identif,//ID de transacción de comercio electrónico 333 affiliation: "Centre Calcul Girona", 334 value: total, 335 tax: "", 336 shipping: "", 337 currency: "EUR", 338 coupon: "", //no ho tractem 339 items: aItems 340 } 341 }); 342 } 343 344 /*Ecommerce Datalayer per GA4*/ 345 /*Quan s'accedeix al "RESUM" de la compra i es comencen a emplenar les dades personals. */ 346 /*aValor=preu~descrip~persones~codiActiv~tipus~codiTarifa*/ 347 function loadEcommerceDatalayerBeginCheckoutGA4(aValor){ 348 var aItems=[]; 349 var category='Actividad';//Actividad, combinada, artículo 350 var sku=''; 351 for (var i=0;i<aValor.length;i++){ 352 aAux=aValor[i].split("~"); 353 if(aAux[4]=='COMBI')category='Combinada'; 354 else{ 355 if(aAux[4]=='B' || aAux[4]=="ARTICLE")category='Artículo'; 356 else category='Actividad'; 357 } 358 sku='SKU-'+aAux[3]+'-'+aAux[5]; 359 aItems.push({ 360 'item_name': aAux[1], //Nombre del producto 361 'item_id':sku, //Código SKU de producto 362 'price': aAux[0],//Precio unitario 363 'item_category': category, 364 'quantity': aAux[2]//Número de elementos 365 }); 366 } 367 368 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 369 dataLayer.push({ 370 event: "begin_checkout", 371 ecommerce: { 372 items: aItems 373 } 374 }); 375 } 376 377 /*Ecommerce Datalayer per GA4*/ 378 /*Quan anem cap al banc */ 379 /*aValor=preu~descrip~persones~codiActiv~tipus~codiTarifa*/ 380 function loadEcommerceDatalayerPaymentInfoGA4(aValor){ 381 var aItems=[]; 382 var category='Actividad';//Actividad, combinada, artículo 383 var sku=''; 384 for (var i=0;i<aValor.length;i++){ 385 aAux=aValor[i].split("~"); 386 if(aAux[4]=='COMBI')category='Combinada'; 387 else{ 388 if(aAux[4]=='B' || aAux[4]=="ARTICLE")category='Artículo'; 389 else category='Actividad'; 390 } 391 sku='SKU-'+aAux[3]+'-'+aAux[5]; 392 aItems.push({ 393 'item_name': aAux[1], //Nombre del producto 394 'item_id':sku, //Código SKU de producto 395 'price': aAux[0],//Precio unitario 396 'item_category': category, 397 'quantity': aAux[2]//Número de elementos 398 }); 399 } 400 401 dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. 402 dataLayer.push({ 403 event: "add_payment_info", 404 ecommerce: { 405 items: aItems 406 } 407 }); 408 } 409 410 /*Estadístiques AddWords*/ 411 function loadAddWords(google_conversion_id,google_conversion_label,google_url){ 412 if(google_conversion_id!=null && google_conversion_id!="" && google_conversion_label!=null && google_conversion_label!=""){ 413 (function() { 414 var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 415 ga.src = ('http://www') + '.googleadservices.com/pagead/conversion.js'; 416 var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 417 418 google_url=google_url.replace("#conversionId#", google_conversion_id); 419 google_url=google_url.replace("#conversionLavel#", google_conversion_label); 420 421 $("#addWords")[0].src=google_url; 422 })(); 423 } 424 } 425 426
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.