PageSourceSearch

https://www.boorberg.de/theme/abc273fcd973b3a92d09202d9c9d9856/js/…torefront.google-analytics.plugin.e3d2c0.js

js boorberg.de collected 2026-09-24 09:41:29 UTC 18,375 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[25431],{1369(e,t,r){r.d(t,{A:()=>a});var n=r(1452);class i{constructor(){this._storage={}}setItem(e,t){return this._storage[e]=t}getItem(e){return Object.prototype.hasOwnProperty.call(this._storage,e)?this._storage[e]:null}removeItem(e){return delete this._storage[e]}key(e){return Object.values(this._storage)[e]||null}clear(){return this._storage={}}}class s{constructor(){this._storage=null,this._chooseStorage(),this._validateStorage()}_chooseStorage(){return s._isSupported("localStorage")?this._storage=window.localStorage:s._isSupported("sessionStorage")?this._storage=window.sessionStorage:n.A.isSupported()?this._storage=n.A:this._storage=new i}static _isSupported(e){try{let t="__storage_test";return window[e].setItem(t,"1"),window[e].removeItem(t),!0}catch(e){return!1}}_validateStorage(){if("function"!=typeof this._storage.setItem)throw Error('The storage must have a "setItem" function');if("function"!=typeof this._storage.getItem)throw Error('The storage must have a "getItem" function');if("function"!=typeof this._storage.removeItem)throw Error('The storage must have a "removeItem" function');if("function"!=typeof this._storage.key)throw Error('The storage must have a "key" function');if("function"!=typeof this._storage.clear)throw Error('The storage must have a "clear" function')}getStorage(){return this._storage}}let a=Object.freeze(new s).getStorage()},5431(e,t,r){r.r(t),r.d(t,{default:()=>I});var n=r(1452),i=r(1369),s=r(746);class a{supports(e,t,r){return console.warn("[Google Analytics Plugin] Method 'supports' was not overridden by `"+this.constructor.name+"`. Default return set to false."),!1}execute(){console.warn("[Google Analytics Plugin] Method 'execute' was not overridden by `"+this.constructor.name+"`.")}disable(){this.active=!1}constructor(){this.active=!0}}class o{static getCategoriesFromElement(e){let t={};for(let r=1;r<=5;r++){let n=e.getAttribute(`data-category-${r}`);if(n)t[1===r?"item_category":`item_category${r}`]=n;else break}return t}static getLineItems(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=document.querySelector(".hidden-line-items-information"),r=t?.querySelectorAll(".hidden-line-item")??[],n=[];return r.forEach(t=>{if(e&&t.getAttribute("data-id")!==e)return;let r={id:t.getAttribute("data-sku")??t.getAttribute("data-id"),name:t.getAttribute("data-name"),quantity:t.getAttribute("data-quantity"),price:t.getAttribute("data-price"),brand:t.getAttribute("data-brand")};n.push({...r,...o.getCategoriesFromElement(t)})}),n}static getAdditionalProperties(){let e=document.querySelector(".hidden-line-items-information");return{currency:e.getAttribute("data-currency"),shipping:e.getAttribute("data-shipping"),value:e.getAttribute("data-value"),tax:e.getAttribute("data-tax")}}static getProductData(e){if(!document.querySelector(".hidden-line-items-information"))return null;let t=o.getLineItems(e).find(()=>!0);if(!t)return null;let r=o.getAdditionalProperties(),n={};for(let[e,r]of Object.entries(t))e.startsWith("item_category")&&(n[e]=r);return{id:t.id,name:t.name,brand:t.brand,value:t.price,currency:r.currency,categories:n}}}class c extends a{supports(e,t,r){return"frontend.checkout.confirm.page"===r}execute(){if(!this.active)return;let e=o.getLineItems();if(0===e.length)return;let t=this._getPaymentType(),r=o.getAdditionalProperties();gtag("event","add_payment_info",{currency:r.currency,value:r.value,payment_type:t,items:e})}_getPaymentType(){let e=document.querySelector(".payment-method-input:checked");if(!e)return"";let t=e.closest(".payment-method-radio")?.querySelector(".payment-method-description strong");return t&&t.textContent?.trim()||""}}class u extends a{supports(e,t,r){return"frontend.checkout.confirm.page"===r}execute(){if(!this.active||!document.querySelector(".shipping-method-input"))return;let e=o.getLineItems();if(0===e.length)return;let t=this._getShippingTier(),r=o.getAdditionalProperties();gtag("event","add_shipping_info",{currency:r.currency,value:r.value,shipping_tier:t,items:e})}_getShippingTier(){let e=document.querySelector(".shipping-method-input:checked");if(!e)return"";let t=e.closest(".shipping-method-radio")?.querySelector(".shipping-method-description strong");return t&&t.textContent?.trim()||""}}class d extends a{execute(){this._subscribedElements=this._subscribedElements||new WeakSet,this._subscribeToPluginInstances(),this._subscribeToListingUpdates()}_getPluginInstances(e){try{let t=window.PluginManager.getPluginInstances(e);return t?.length>0?t:null}catch{return null}}_subscribeToPluginInstances(){let e=this._getPluginInstances(this.getPluginName());if(!e)return;let t=this.getEvents();
1e.forEach(e=>{let r=e.el||e;this._subscribedElements.has(r)||(Object.keys(t).forEach(r=>{e.$emitter.subscribe(r,t[r])}),this._subscribedElements.add(r))})}_subscribeToListingUpdates(){if("Listing"===this.getPluginName()||this._listingSubscribed)return;let e=this._getPluginInstances("Listing");e&&(e.forEach(e=>{e.$emitter.subscribe("Listing/afterRenderResponse",async()=>{await window.PluginManager.initializePlugins(),this._subscribeToPluginInstances()})}),this._listingSubscribed=!0)}getEvents(){console.warn("[Google Analytics Plugin] Method 'getEvents' was not overridden by `"+this.constructor.name+"`.")}getPluginName(){console.warn("[Google Analytics Plugin] Method 'getPluginName' was not overridden by `"+this.constructor.name+"`.")}}class l{static getProductData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=l.getProductDetailData();if(r.name)return r;let n=l.getProductCardData(e,t);return{id:n.id,name:n.name,brand:n.brand,currency:r.currency,value:n.value}}static getProductDetailData(){return{id:l.getSku(),name:document.querySelector(".product-detail-name")?.textContent.trim(),brand:l.getBrand(),currency:l.getCurrency(),value:l.getValue()}}static getProductCardData(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=document.querySelector(`.product-wishlist-${e}`)?.closest(".product-box");if(!r&&t&&(r=t.closest(".product-box")),!r?.dataset.productInformation)return{};try{let t=JSON.parse(r.dataset.productInformation);return{id:t.sku??e,name:t.name,brand:t.brand,value:t.price}}catch{return{}}}static getSku(){return document.querySelector('[itemprop="sku"]')?.textContent.trim()}static getBrand(){return document.querySelector('[itemprop="brand"] [itemprop="name"]')?.content}static getCurrency(){return document.querySelector('meta[property="product:price:currency"]')?.content||window.currencyIsoCode}static getValue(){return document.querySelector('meta[property="product:price:amount"]')?.content}static getCategories(){let e=document.querySelectorAll('[aria-label="breadcrumb"] .breadcrumb-title'),t={};return e.forEach((e,r)=>{r<5&&(t[0===r?"item_category":`item_category${r+1}`]=e.textContent.trim())}),t}}class g extends d{supports(e,t,r){return!0}getPluginName(){return"AddToCart"}getEvents(){return{beforeFormSubmit:this._beforeFormSubmit.bind(this)}}_beforeFormSubmit(e){if(!this.active)return;let t=e.detail,r=e.target,n=null;if(t.forEach((e,t)=>{t.endsWith("[id]")&&(n=e)}),!n){console.warn("[Google Analytics Plugin] Product ID could not be fetched. Skipping.");return}let i=l.getProductData(n,r);gtag("event","add_to_cart",{currency:i.currency||l.getCurrency(),value:i.value,items:[{id:i.id??n,name:t.get("product-name")||i.name,quantity:t.get(`lineItems[${n}][quantity]`),brand:t.get("brand-name")||i.brand,...l.getCategories()}]})}}class h extends a{supports(e,t,r){return"frontend.checkout.cart.page"===r}execute(){let e=document.querySelector(".cart-add-product");e&&e.addEventListener("submit",this._formSubmit.bind(this))}_formSubmit(e){if(!this.active)return;let t=e.currentTarget.querySelector(".form-control");gtag("event","add_to_cart",{currency:o.getAdditionalProperties().currency,items:[{id:t.value,quantity:1}]})}}class m extends d{supports(){return!0}getPluginName(){return"WishlistStorage"}getEvents(){return{"Wishlist/onProductAdded":this._onProductAdded.bind(this)}}_onProductAdded(e){if(!this.active)return;let t=e.detail?.productId;if(!t)return;let r=l.getProductData(t),n=l.getCategories();if(!r.name){let e=o.getProductData(t);e&&(r=e,n=e.categories||{})}gtag("event","add_to_wishlist",{currency:r.currency,value:r.value,items:[{id:r.id??t,name:r.name,brand:r.brand,...n}]})}}class p extends d{supports(e,t,r){return!0}getEvents(){return this._boundOnBeginCheckout=this._onBeginCheckout.bind(this),{offCanvasOpened:this._offCanvasOpened.bind(this)}}getPluginName(){return"OffCanvasCart"}_offCanvasOpened(){let e=document.querySelector(".begin-checkout-btn");e&&(e.removeEventListener("click",this._boundOnBeginCheckout),e.addEventListener("click",this._boundOnBeginCheckout))}_onBeginCheckout(){if(!this.active)return;let e=o.getAdditionalProperties();gtag("event","begin_checkout",{currency:e.currency,value:e.value,items:o.getLineItems()})}}class v extends a{supports(e,t,r){return"frontend.checkout.cart.page"===r}execute(){let e=document.querySelector(".begin-checkout-btn");e&&e.addEventListener("click",this._onBeginCheckout.bind(this))}_onBeginCheckout(){if(!this.active)return;let e=o.getAdditionalProperties();gtag("event","begin_checkout",{currency:e.currency,value:e.value,items:o.getLineItems()})}}class b extends d{supports(e,t,r){return"frontend.account.login.page"===r||"frontend.checkout.register.page"===r}getPluginName(){return"FormValidation"}getEvents(){return{beforeSubmit:this._onFormSubmit.bind(this)}}_onFormSubmit(e){this.active&&e.target.classList.contains("login-form")&&e.detail.validity&&gtag("event","login",{method:"mail"})}}class f extends a{supports(e,t,r){return"frontend.checkout.finish.page"===r&&window.trackOrders}execute(){if(!this.active)return;let e=document.querySelector(".finish-ordernumber");if(!e){console.warn("Cannot get order number element - Skip order tracking");return}let t=e.getAttribute("data-order-number");if(!t){console.warn("Cannot determine order number - Skip order tracking");return}gtag("event","purchase",{transaction_id:t,items:o.getLineItems(),...o.getAdditionalProperties()})}}class _ extends a{supports(e,t,r){return!0}execute(){document.addEventListener("click",this._onRemoveFromCart.bind(this))}_onRemoveFromCart(e){if(!this.active)return;let t=e.target.closest(".line-item-remove-button");if(!t)return;let r=t.getAttribute("data-product-id");if(!r)return;let n=o.getAdditionalProperties(),i=document.querySelector(`.hidden-line-item[data-id="${r}"]`);if(!i){gtag("event","remove_from_cart",{currency:n.currency,items:[{id:r}]});return}let s=o.getCategoriesFromElement(i),a=i.getAttribute("data-price"),c=i.getAttribute("data-quantity"),u=i.getAttribute("data-sku"),d=(parseFloat(a)||0)*(parseInt(c,10)||1);gtag("event","remove_from_cart",{currency:n.currency,value:d.toFixed(2),items:[{id:u??r,n
1ame:i.getAttribute("data-name"),quantity:c,price:a,brand:i.getAttribute("data-brand"),...s}]})}}class y extends a{supports(){return!0}execute(){this._registerWishlistStorageEvents(),document.addEventListener("submit",this._onFormSubmit.bind(this))}_registerWishlistStorageEvents(){let e;try{e=window.PluginManager.getPluginInstances("WishlistStorage")}catch{return}e?.length&&e.forEach(e=>{e.$emitter.subscribe("Wishlist/onProductRemoved",this._onProductRemoved.bind(this))})}_onFormSubmit(e){if(!this.active)return;let t=e.target;if(!t.classList.contains("product-wishlist-form"))return;let r=this._extractProductIdFromForm(t);r&&this._sendEvent(r,t)}_onProductRemoved(e){if(!this.active)return;let t=e.detail?.productId;t&&this._sendEvent(t)}_extractProductIdFromForm(e){let t=e.getAttribute("action").match(/\/wishlist\/product\/delete\/([a-f0-9-]+)/i);return t?t[1]:null}_sendEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=l.getProductData(e,t),n=l.getCategories(),i=o.getProductData(e);!r.name&&i&&(r=i,n=i.categories||{}),gtag("event","remove_from_wishlist",{currency:r.currency,value:r.value,items:[{id:r.id??e,name:r.name,brand:r.brand,...n}]})}}class E extends d{supports(e,t,r){return!0}getPluginName(){return"SearchWidget"}getEvents(){return{handleInputEvent:this._onSearch.bind(this)}}_onSearch(e){this.active&&gtag("event","search",{search_term:e.detail.value})}}class w extends d{supports(e,t,r){return"frontend.account.login.page"===r||"frontend.checkout.register.page"===r}getPluginName(){return"FormValidation"}getEvents(){return{beforeSubmit:this._onFormSubmit.bind(this)}}_onFormSubmit(e){this.active&&e.target.classList.contains("register-form")&&e.detail.validity&&gtag("event","sign_up",{method:"mail"})}}class k extends a{supports(e,t,r){return"frontend.checkout.cart.page"===r||this._isOffcanvasTrackingEnabled()}execute(){this.active&&(this._debounceTimeout=null,"frontend.checkout.cart.page"===window.activeRoute&&this._fireViewCartEvent(),this._isOffcanvasTrackingEnabled()&&this._registerOffcanvasListener())}_isOffcanvasTrackingEnabled(){return"1"===window.trackOffcanvasCart}_registerOffcanvasListener(){let e=window.PluginManager.getPlugin("OffCanvasCart",!1);if(!e)return;let t=e.get("instances");t&&0!==t.length&&t.forEach(e=>{e.$emitter.subscribe("offCanvasOpened",this._onOffCanvasCartChange.bind(this)),e.$emitter.subscribe("registerEvents",this._onOffCanvasCartChange.bind(this))})}_onOffCanvasCartChange(){this.active&&(this._debounceTimeout&&clearTimeout(this._debounceTimeout),this._debounceTimeout=setTimeout(()=>{this._fireViewCartEvent(),this._debounceTimeout=null},50))}_fireViewCartEvent(){let e=o.getLineItems();if(0===e.length)return;let t=o.getAdditionalProperties();gtag("event","view_cart",{currency:t.currency,value:t.value,items:e})}}class S extends a{supports(e,t,r){return"frontend.detail.page"===r}execute(){if(!this.active)return;let e=document.querySelector('[itemtype="https://schema.org/Product"]');if(!e){console.warn('[Google Analytics Plugin] Product itemtype ([itemtype="https://schema.org/Product"]) could not be found in document.');return}let t=e.querySelector('[itemprop="sku"]'),r=e.querySelector('[itemprop="name"]');if(!t||!r){console.warn('[Google Analytics Plugin] Product ID ([itemprop="sku"]) or product name ([itemprop="name"]) could not be found within product scope.');return}let n=t.textContent.trim(),i=r.textContent.trim();if(!n||!i){console.warn("[Google Analytics Plugin] Product ID or product name is empty, do not track page view.");return}gtag("event","view_item",{currency:l.getCurrency(),value:l.getValue(),items:[{id:n,name:i,brand:l.getBrand(),...l.getCategories()}]})}}class C extends d{supports(){return!!document.querySelector(".cms-element-product-listing-wrapper")}getPluginName(){return"Listing"}getEvents(){return{"Listing/afterRenderResponse":this._onListingChange.bind(this)}}execute(){this._fireViewItemListEvent(),super.execute()}_onListingChange(){this._fireViewItemListEvent()}_fireViewItemListEvent(){if(!this.active)return;let e=this.getListItems();if(0===e.length)return;let t=e.reduce((e,t)=>
1e+(parseFloat(t.price)||0),0);gtag("event","view_item_list",{currency:l.getCurrency(),value:t.toFixed(2),items:e})}getListItems(){let e=document.querySelectorAll(".product-box"),t=[];if(!e)return t;let r=l.getCategories();return e.forEach(e=>{if(e.dataset.productInformation){let{sku:n,id:i,...s}=JSON.parse(e.dataset.productInformation);t.push({...s,id:n??i,...r})}}),t}}class P extends a{supports(e,t,r){return"frontend.search.page"===r}execute(){this.active&&gtag("event","view_search_results",{search_term:document.querySelector(".header-search-input").value})}}var A=r(4335);class I extends A.A{init(){this.cookieEnabledName="google-analytics-enabled",this.cookieAdsEnabledName="google-ads-enabled",this.storage=i.A,this.handleTrackingLocation(),this.handleCookieChangeEvent(),(!window.useDefaultCookieConsent||n.A.getItem(this.cookieEnabledName)||n.A.getItem(this.cookieAdsEnabledName))&&this.startGoogleAnalytics()}startGoogleAnalytics(){let e=document.createElement("script");e.src=window.gtagURL,document.head.append(e),gtag("js",new Date),gtag("config",window.gtagTrackingId,window.gtagConfig),this.controllerName=window.controllerName,this.actionName=window.actionName,this.activeRoute=window.activeRoute,this.events=[],this.registerDefaultEvents(),this.handleEvents()}handleTrackingLocation(){this.trackingUrl=new URL(window.location.href);let e=this.trackingUrl.searchParams.get("gclid");e?this.storage.setItem(this._getGclidStorageKey(),e):this.storage.getItem(this._getGclidStorageKey())&&this.trackingUrl.searchParams.set("gclid",this.storage.getItem(this._getGclidStorageKey())),this.trackingUrl.searchParams.get("gclid")&&(window.gtagConfig.page_location=this.trackingUrl.toString())}handleEvents(){this.events.forEach(e=>{e.supports(this.controllerName,this.actionName,this.activeRoute)&&e.execute()})}registerDefaultEvents(){this.registerEvent(c),this.registerEvent(u),this.registerEvent(g),this.registerEvent(h),this.registerEvent(p),this.registerEvent(v),this.registerEvent(b),this.registerEvent(f),this.registerEvent(_),this.registerEvent(E),this.registerEvent(w),this.registerEvent(S),this.registerEvent(C),this.registerEvent(P),this.registerEvent(m),this.registerEvent(y),this.registerEvent(k)}registerEvent(e){this.events.push(new e)}handleCookieChangeEvent(){document.$emitter.subscribe(s.COOKIE_CONFIGURATION_UPDATE,this.handleCookies.bind(this))}handleCookies(e){let t=e.detail;this._updateConsent(t);let r=t[this.cookieEnabledName],n=t[this.cookieAdsEnabledName];if(void 0!==r||void 0!==n){if(r||n){this.startGoogleAnalytics();return}this.removeCookies(),this.disableEvents()}}removeCookies(){let e=document.cookie.split(";"),t=/^(_swag_ga|_gat_gtag)/;e.forEach(e=>{let r=e.split("=")[0].trim();r.match(t)&&n.A.removeItem(r)})}disableEvents(){this.events.forEach(e=>{e.disable()})}_updateConsent(e){if(0===Object.keys(e).length)return;let t={};Object.hasOwn(e,this.cookieEnabledName)&&(t.analytics_storage=e[this.cookieEnabledName]?"granted":"denied"),Object.hasOwn(e,this.cookieAdsEnabledName)&&(t.ad_storage=e[this.cookieAdsEnabledName]?"granted":"denied",t.ad_user_data=e[this.cookieAdsEnabledName]?"granted":"denied",t.ad_personalization=e[this.cookieAdsEnabledName]?"granted":"denied"),0!==Object.keys(t).length&&gtag("consent","update",t)}_getGclidStorageKey(){return`google-analytics-${window.salesChannelId||""}-gclid`}}}}]);

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.