1function Y(){function l(e,t="ga4Event"){try{if(window.dataLayer=window.dataLayer||[],!window.dataLayer||!e.dataset[t])return;const i=JSON.parse(e.dataset[t]),{event:a,...r}=i,d={event:a};Object.keys(r).length>0&&(d.ga4_data=r),console.log("GA4 event triggered:"+t),window.dataLayer.push(d)}catch(i){console.error("Error triggering GA4 event:",i)}}window.triggerGA4EventOnElement=l,document.querySelectorAll(".ga4-on-submit-event").forEach(e=>{e.addEventListener("submit",()=>{l(e)})}),document.querySelectorAll(".ga4-on-click-event").forEach(e=>{e.addEventListener("click",t=>{e.classList.contains("Product-card")&&t.target.classList.contains("ga4-on-click-event")&&t.target.classList.contains("btn")||l(e)})}),document.querySelectorAll(".ga4-on-load-event").forEach(e=>{document.addEventListener("DOMContentLoaded",()=>{l(e)})}),document.querySelectorAll("a[href^='tel:'], a[href^='mailto:']").forEach(e=>{e.addEventListener("click",()=>{if(e.dataset.ga4Event)l(e);else{const t=e.href.startsWith("tel:")?"ga4_phone_click":"ga4_email_click";window.dataLayer.push({event:t})}})}),$(".ga4-popup-event").on("show.bs.modal",e=>{l(e.target)}),$(".ga4-popup-event").on("hide.bs.modal",e=>{l(e.target.querySelector(".close"))}),document.querySelectorAll('.ga4-popup-event button[type="submit"]').forEach(e=>{e.addEventListener("click",()=>{l(e)})});function I(){const e=document.querySelector(".ga4-review-event");let t;e&&setTimeout(()=>{if(e.tagName==="FORM"?t=e:t=e.querySelector("form")??null,!t)return;let i=!1;t.querySelectorAll("input","textarea").forEach(a=>{a.addEventListener("input",()=>{i||(l(e.querySelector("#review-change-event")),i=!0)})}),t.addEventListener("submit",()=>{let a=!0;t.querySelectorAll("input","textarea").forEach(r=>{if(!r.checkValidity()){a=!1;return}}),a&&l(e.querySelector("#review-submit-event"))})},2e3)}window.initReviewFormEvents=I;function V(){setTimeout(()=>{document.querySelectorAll(".pr-snippet-write-review-link").forEach(t=>{t.addEventListener("click",()=>{const i=new URL(t.href).searchParams.get("productId");window.dataLayer.push({event:"ga4_review",ga4_data:{action_type:"Write a review cta click",single_item_id:i}})})})},1e3)}window.addPRReviewLinkEvent=V,V();function T(){const e=document.querySelectorAll("form.ga4-form-event");!e||e.length<=0||e.forEach(t=>{const i={root:null,rootMargin:"0px",threshold:.1};new IntersectionObserver((d,o)=>{d.forEach(n=>{n.isIntersecting&&(l(n.target,"ga4VisibleEvent"),o.disconnect())})},i).observe(t);let r=!1;t.querySelectorAll("input, textarea").forEach(d=>{d.addEventListener("input",()=>{r||(l(t,"ga4StartEvent"),r=!0)})}),t.addEventListener("submit",async d=>{const o=document.querySelector(".g-recaptcha")!==null;!$(t).valid()||o&&typeof grecaptcha<"u"&&grecaptcha.getResponse().length===0||l(t,"ga4SubmitEvent")})})}window.initFormEvents=T;const p=document.querySelector(".ga4-retailer-event");function A(e){const t=e.currentTarget;window.dataLayer.push({event:"ga4_buy_now_go_to_retailer",ga4_data:{retailer:t.dataset.retailername,single_item_name:t.dataset.productname,single_item_id:t.dataset.productid}})}$("#BuyModal").on("show.bs.modal",()=>{setTimeout(()=>{p==null||p.querySelectorAll("a[data-retailername]").forEach(e=>{e.addEventListener("click",A)})},100)}),$("#BuyModal").on("hide.bs.modal",()=>{p==null||p.querySelectorAll("a[data-retailername]").forEach(e=>{e.removeEventListener("click",A)})});function L(e){return e?1:0}function q(e,t,i,a,r,d,o){const n=window.localStorage.getItem("trackedVideos")?JSON.parse(window.localStorage.getItem("trackedVideos")):[];n.some(c=>c.url===e)||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"ga4_video_start",ga4_data:{...t,visible:L(i),video_current_time:d,video_duration:a,video_percent:r,video_title:o}}),n.push({url:e,progress:[0]}),window.localStorage.setItem("trackedVideos",JSON.stringify(n)))}function y(e,t,i,a,r,d,o){const n=window.localStorage.getItem("trackedVideos")?JSON.parse(window.localStorage.getItem("trackedVideos")):[],c=n.find(_=>_.url===e);c&&c.progress.includes(r)||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"ga4_video_progress",ga4_data:{...t,visible:L(i),video_current_time:d,video_duration:a,video_percent:r,video_title:o}}),c?c.progress.includes(r)||c.progress.push(r):n.push({url:e,progress:[r]}),window.localStorage.setItem("trackedVideos",JSON.stringify(n)))}function D(e,t,i,a,r,d,o){window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"ga4_video_complete",ga4_data:{...t,visible:L(i),video_current_time:d,video_duration:a,video_percent:r,video_title:o}})}function C(e){if(typeof YT<"u"&&typeof YT.Player<"u"){e();return}if(window.__ga4YtApiCallbacks=window.__ga4YtApiCallbacks||[],window.__ga4YtApiCallbacks.push(e),window.__ga4YtApiLoading)return;window.__ga4YtApiLoading=!0;const t=document.createElement("script");t.src="https://www.youtube.com/iframe_api",document.head.appendChild(t),window.onYouTubeIframeAPIReady=function(){window.__ga4YtApiCallbacks.forEach(i=>
1i()),window.__ga4YtApiCallbacks=[]}}document.querySelectorAll(".ga4-video-event").forEach(e=>{const t=JSON.parse(e.dataset.ga4VideoStartEvent);let i=!1;const a={root:null,rootMargin:"0px",threshold:.5};new IntersectionObserver((c,_)=>{c.forEach(u=>{u.isIntersecting?(i=!0,_.disconnect()):i=!1})},a).observe(e);const{event:d,...o}=t,n=e.tagName==="VIDEO";e.tagName!=="DIV"&&(n||e.addEventListener("click",()=>{setTimeout(()=>{if(!document.querySelector("video")){const u=e.dataset.src.match(/v=([^&]+)/)[1];if(u){let b=function(h,v){const g=new YT.Player(v,{videoId:h,autoplay:1,mute:1,events:{onReady:function(s){s.target.mute(),s.target.playVideo()},onStateChange:function(s){const w=Math.floor(g.getDuration()),O=g.getCurrentTime(),N=Math.floor(O/w*100),E=g.getVideoData().title;s.data===YT.PlayerState.PLAYING&&(q(t.video_url,o,i,w,N,Math.floor(O),E),window.checkProgress=setInterval(()=>{const m=g.getCurrentTime(),k=g.getDuration();if(k>0){const f=m/k*100;f>=25&&f<50?y(t.video_url,o,i,w,25,Math.floor(m),E):f>=50&&f<75?y(t.video_url,o,i,w,50,Math.floor(m),E):f>=75&&y(t.video_url,o,i,w,75,Math.floor(m),E)}},1e3));const R=()=>{clearInterval(window.checkProgress)};if((s.data===YT.PlayerState.PAUSED||s.data===YT.PlayerState.ENDED)&&R(),s.data===YT.PlayerState.ENDED){let m=window.localStorage.getItem("trackedVideos")?JSON.parse(window.localStorage.getItem("trackedVideos")):[];m.find(f=>f.url===t.video_url)&&g.getCurrentTime()/g.getDuration()>=.95&&D(t.video_url,o,i,w,100,w,E),window.localStorage.setItem("trackedVideos",JSON.stringify(m.filter(f=>f.url!==t.video_url)))}}}})};var _=b;const S=document.querySelector("#youtube-player div");C(()=>b(u,S))}}},500)}))});function P(e,t=.5){if(!e)return!1;const i=e.getBoundingClientRect();if(i.width<=0||i.height<=0)return!1;const a=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,d=Math.min(i.right,a)-Math.max(i.left,0),o=Math.min(i.bottom,r)-Math.max(i.top,0);return d<=0||o<=0?!1:d*o/(i.width*i.height)>=t}document.querySelectorAll('iframe[src*="youtube.com/embed"], iframe[src*="youtube-nocookie.com/embed"]').forEach(e=>{if(e.closest("#youtube-player")||e.dataset.ga4VideoTracked)return;e.dataset.ga4VideoTracked="true";const t=e.src.match(/embed\/([^?&/]+)/);if(!t)return;const a=`https://www.youtube.com/watch?v=${t[1]}`,r={video_provider:"youtube",video_url:a};function d(){if(!/[?&]enablejsapi=1(&|$)/.test(e.src)){const n=e.src.includes("?")?"&":"?";e.src=`${e.src}${n}enablejsapi=1&origin=${window.location.origin}`}C(()=>{const n=new YT.Player(e,{events:{onStateChange:function(c){const _=P(n.getIframe()),u=Math.floor(n.getDuration()),S=n.getCurrentTime(),b=Math.floor(S/u*100),h=n.getVideoData().title;if(c.data===YT.PlayerState.PLAYING&&(q(a,r,_,u,b,Math.floor(S),h),window.checkProgress=setInterval(()=>{const v=n.getCurrentTime(),g=n.getDuration();if(g>0){const s=v/g*100,w=P(n.getIframe());s>=25&&s<50?y(a,r,w,u,25,Math.floor(v),h):s>=50&&s<75?y(a,r,w,u,50,Math.floor(v),h):s>=75&&y(a,r,w,u,75,Math.floor(v),h)}},1e3)),(c.data===YT.PlayerState.PAUSED||c.data===YT.PlayerState.ENDED)&&clearInterval(window.checkProgress),c.data===YT.PlayerState.ENDED){let v=window.localStorage.getItem("trackedVideos")?JSON.parse(window.localStorage.getItem("trackedVideos")):[];v.find(s=>s.url===a)&&n.getCurrentTime()/n.getDuration()>=.95&&D(a,r,_,u,100,u,h),window.localStorage.setItem("trackedVideos",JSON.stringify(v.filter(s=>s.url!==a)))}}}})})}const o=new IntersectionObserver(n=>{n.forEach(c=>{c.isIntersecting&&(o.disconnect(),d())})},{root:null,rootMargin:"0px",threshold:.5});o.observe(e)});function M(){let e=!1;function t(a){if(e)return;e=!0;const r=document.querySelector('form[id^="bv-submitreview-product"]');if(!r)return;let d=!1;r.querySelectorAll("input, textarea").forEach(o=>{o.addEventListener("input",()=>{d||(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"ga4_review",ga4_data:{action_type:"Start to write a review",single_item_id:a}}),d=!0)})}),r.querySelector(".bv-submit").addEventListener("click",()=>{let o=!0;r.querySelectorAll("input","textarea").forEach(n=>{if(!n.checkValidity()){o=!1;return}}),o&&(window.dataLayer=window.dataLayer||[],window.dataLayer.push({event:"ga4_review",ga4_data:{action_type:"Submit a review",single_item_id:a}}))})}function i(){const a=document.querySelectorAll(".bv_war_button, .bv-write-review");if(!a)return;const r=document.querySelector(".reviews-bazaar");if(!r)return;const d=r.dataset.bvProductid??"";a.forEach(o=>{o.addEventListener("click",()=>{window.dataLayer.push({event:"ga4_review",ga4_data:{action_type:"Write a review cta click",single_item_id:d}}),setTimeout(()=>{t(d)},2e3)})})}document.addEventListener("DOMContentLoaded",()=>{setTimeout(()=>{i()},2e3)})}window.initBVReviewEvents=M,window.addEventListener("message",function(e){if(e.origin==="https://widget.clic2buy.com"){if(!e.data)return;let t;try{t=JSON.parse(e.data)}catch{return}if(t.event==="iframeRetailerClick"){const i=t.retailer,r=document.querySelector("#c2b-widget-popin-iframe").src.match(/\/([^\/?]+)\?/)[1],d=document.querySelector(`.C2B_Widget_Key[data-widget-id="${r}"], .C2B_liProduct[data-widget-id="${r}"]`);if(!d)return;const o=JSON.parse(d.dataset.ga4Event),n={event:"ga4_buy_now_go_to_retailer",ga4_data:{single_item_id:o.single_item_id,single_item_name:o.single_item_name,retailer:i}};window.dataLayer.push(n)}}},!1),I(),T(),M()}window.initGa4=Y;Y();
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.