function gtag(){dataLayer.push(arguments)}function addToCartGA(n,t,i,r,u){gtag("event","add_to_cart",{items:[{item_id:n,item_name:t,item_category:i,quantity:u,price:r}]})}function removeFromCartGA(n,t,i,r,u){gtag("event","remove_from_cart",{items:[{item_id:n,item_name:t,item_category:i,quantity:u,price:r}]})}function getItems(){var t,n;if(typeof gtag!="undefined"&&typeof cartItemsGA!="undefined"){for(t=[],n=0;n<cartItemsGA.length;n++)t.push({item_id:cartItemsGA[n].id,item_name:cartItemsGA[n].name,item_category:cartItemsGA[n].category,quantity:cartItemsGA[n].quantity,price:cartItemsGA[n].price});return t}}function addProducts(){if(typeof gtag!="undefined"&&typeof cartItemsGA!="undefined"){var n=getItems();gtag("event","view_cart",{items:n})}}window.dataLayer=window.dataLayer||[];gtag("js",new Date);gtag("config","G-E3R5KLKN1S");typeof transactionsGA!="undefined"&&gtag("event","purchase",{send_to:"GA4",currency:"CAD",transaction_id:transactionsGA.id,affiliation:transactionsGA.affiliation,value:transactionsGA.revenue,tax:transactionsGA.tax,shipping:transactionsGA.shipping,items:getItems()});typeof checkoutGA!="undefined"&&(addProducts(),gtag("event","begin_checkout",{checkout_step:checkoutGA}));typeof detailGA!="undefined"&&gtag("event","view_item",{items:[{item_id:detailGA.id,item_name:detailGA.name,item_category:detailGA.category,item_brand:detailGA.brand,item_variant:detailGA.variant}]});gtag("config","GA_MEASUREMENT_ID",{page_title:document.title,page_path:location.pathname});$(function(){$("a").on("click",function(){var r=$(this),u=!0,t=r.attr("href"),i=t.split("?")[0].split("/"),n,f;return i=$.grep(i,function(n){return n}),!t.match(/^javascript:/i)&&(n={},t.match(/^mailto\:/i)?(n.category="courriel",n.action="click",n.label=t.replace(/^mailto\:/i,""),n.loc=t):t.match(/\.(zip|exe|dmg|pdf|doc.*|xls.*|ppt.*|mp3|txt|rar|wma|mov|avi|wmv|flv|wav)$/i)?(f=/[.]/.exec(t)?/[^.]+$/.exec(t):undefined,n.category="telechargement",n.action="click-"+f[0],n.label=t.replace(/ /g,"-"),n.loc=baseHref+t):t&&t.match(/^https?\:/i)&&!t.match(document.domain)?(n.category="externe",n.action="click",n.label=t.replace(/^https?\:\/\//i,""),n.loc=t):i.length>0&&i[0].toLowerCase()==="telechargement"&&(i[1].toLowerCase()==="g"||i[1].toLowerCase()==="p")&&i.length===3?(n.category=i[1].toLowerCase()==="g"?"telechargement_publication_gratuite":"telechargement_publication_payante",n.action="click",n.label=t.replace(/^http?\:\/\//i,""),n.non_i=!0,n.loc=t):t.match(/^tel\:/i)?(n.category="telephone",n.action="click",n.label=t.replace(/^tel\:/i,""),n.loc=t):u=!1,u&&(gtag("event",n.action.toLowerCase(),{event_category:n.category.toLowerCase(),event_label:n.label.toLowerCase()}),r.attr("target")==undefined||r.attr("target").toLowerCase()!=="_blank"))?(setTimeout(function(){location.href=n.loc},400),!1):void 0})})