PageSourceSearch

https://m.beerbusterspodcast.com/js/google-tag-manager-universal.min.js

js beerbusterspodcast.com collected 2026-10-04 05:10:37 UTC 11,992 bytes, 25 lines download raw bytes

1(function(){'use strict';function getCookie(name){var cookie=' '+document.cookie,search=' '+name+'=',setStr=null,offset=0,end=0;if(cookie.length>0){offset=cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=cookie.indexOf(';',offset);if(end==-1){end=cookie.length;}
2setStr=decodeURI(cookie.substring(offset,end));}}
3return setStr;}
4function delCookie(name){var date=new Date(0);document.cookie=name+'='+'; path=/; expires='+date.toUTCString();}
5function GoogleAnalyticsUniversalCart(config){this.dlCurrencyCode=config.dlCurrencyCode;this.dataLayer=config.dataLayer;this.cookieAddToCart=config.cookieAddToCart;this.cookieRemoveFromCart=config.cookieRemoveFromCart;this.productQtys=[];this.origProducts={};this.productWithChanges=[];this.addedProducts=[];this.removedProducts=[];this.googleAnalyticsUniversalData={};}
6GoogleAnalyticsUniversalCart.prototype={listenMinicartReload:function(){var context=this;if(!_.isUndefined(window.Minicart)&&typeof Minicart.prototype.initAfterEvents){Minicart.prototype.initAfterEvents['GoogleAnalyticsUniversalCart:subscribeProductsUpdateInCart']=function(){context.subscribeProductsUpdateInCart();context.parseAddToCartCookies();context.parseRemoveFromCartCookies();};Minicart.prototype.removeItemAfterEvents['GoogleAnalyticsUniversalCart:subscribeProductsRemoveFromCart']=function(){context.parseRemoveFromCartCookies();};}},subscribeProductsUpdateInCart:function(){var context=this;$(document).on('mousedown','[data-cart-item-update]',function(){context.collectCustomerProducts();}).on('mousedown','.update-cart-item',function(){context.collectCustomerProducts();}).on('mousedown','[data-multiship-item-update]',function(){context.collectOriginalProducts();context.collectMultiCartQtys();}).on('mousedown','[data-multiship-item-remove]',function(){context.collectOriginalProducts();context.collectMultiCartQtys();context.updateMulticartCartObserver();}).on('mousedown','[data-cart-empty]',function(){context.emptyCartObserver();}).on('ajax:updateCartItemQty',function(){context.updateCartObserver();}).on('ajax:updateMulticartItemQty',function(){context.updateMulticartCartObserver();});},emptyCartObserver:function(){var product,i;this.collectOriginalProducts();for(i in this.origProducts){if(i!='length'&&this.origProducts.hasOwnProperty(i)){product=$.extend({},this.origProducts[i]);this.removedProducts.push(product);}}
7this.cartItemRemoved();},updateMulticartCartObserver:function(){this.collectMultiProductsWithChanges();this.collectProductsForMessages();this.cartItemAdded();this.cartItemRemoved();},updateCartObserver:function(){this.collectProductsWithChanges();this.collectProductsForMessages();this.cartItemAdded();this.cartItemRemoved();},collectMultiProductsWithChanges:function(){var groupedProducts={},cartProduct,i=0,j,product;this.productWithChanges=[];for(i;i<this.productQtys.length;i++){cartProduct=this.productQtys[i];if(_.isUndefined(groupedProducts[cartProduct.id])){groupedProducts[cartProduct.id]=parseInt(cartProduct.qty,10);}else{groupedProducts[cartProduct.id]+=parseInt(cartProduct.qty,10);}}
8for(j in groupedProducts){if(groupedProducts.hasOwnProperty(j)){if(!_.isUndefined(this.origProducts[j])&&groupedProducts[j]!=this.origProducts[j].qty){product=$.extend({},this.origProducts[j]);product.qty=groupedProducts[j];this.productWithChanges.push(product);}}}},collectProductsWithChanges:function(){var i=0,cartProduct,product;this.productWithChanges=[];for(i;i<this.productQtys.length;i++){cartProduct=this.productQtys[i];if(!_.isUndefined(this.origProducts[cartProduct.id])&&cartProduct.qty!=this.origProducts[cartProduct.id].qty){product=$.extend({},this.origProducts[cartProduct.id]);if(parseInt(cartProduct.qty,10)>0){product.qty=cartProduct.qty;this.productWithChanges.push(product);}}}},collectCustomerProducts:function(){this.collectOriginalProducts();this.collectCartQtys();this.collectMiniCartQtys();},collectOriginalProducts:function(){var products={},items=customerData.get('cart')().items;if(!_.isUndefined(items)){items.forEach(function(item){products[item['product_sku']]={'id':item['product_sku'],'name':item['product_name'],'price':item['product_price_value'],'qty':parseInt(item.qty,10)};});}
9this.googleAnalyticsUniversalData.shoppingCartContent=products;this.origProducts=this.googleAnalyticsUniversalData.shoppingCartContent;},collectMultiCartQtys:function(){var productQtys=[];$('[data-multiship-item-id]').each(function(index,elem){productQtys.push({'id':$(elem).data('multiship-item-id'),'qty':$(elem).val()});});this.productQtys=productQtys;},collectCartQtys:function(){var productQtys=[];$('[data-cart-item-id]').each(function(index,elem){productQtys.push({'id':$(elem).data('cart-item-id'),'qty':$(elem).val()});});this.productQtys=productQtys;},collectMiniCartQtys:function(){var productQtys=[];$('input[data-cart-item-id]').each(function(index,elem){productQtys.push({'id':$(elem).data('cart-item-id'),'qty':$(elem).val()});});this.productQtys=productQtys;},collectProductsForMessages:function(){var i=0,product;this.addedProducts=[];this.removedProducts=[];for(i;i<this.productWithChanges.length;i++){product=this.productWithChanges[i];if(!_.isUndefined(this.origProducts[product.id])){if(product.qty>this.origProducts[product.id].qty){product.qty=Math.abs(product.qty-this.origProducts[product.id].qty);this.addedProducts.push(product);}else if(product.qty<this.origProducts[product.id].qty){product.qty=Math.abs(this.origProducts[product.id].qty-product.qty);this.removedProducts.push(product);}}}},formatProductsArray:function(productsIn){var productsOut=[],itemId,i;for(i in productsIn){if(i!='length'&&productsIn.hasOwnProperty(i)){if(!_.isUndefined(productsIn[i].sku)){
9itemId=productsIn[i].sku;}else{itemId=productsIn[i].id;}
10productsOut.push({'id':itemId,'name':productsIn[i].name,'price':productsIn[i].price,'quantity':parseInt(productsIn[i].qty,10)});}}
11return productsOut;},cartItemAdded:function(){if(!this.addedProducts.length){return;}
12this.dataLayer.push({'event':'addToCart','ecommerce':{'currencyCode':this.dlCurrencyCode,'add':{'products':this.formatProductsArray(this.addedProducts)}}});this.addedProducts=[];},cartItemRemoved:function(){if(!this.removedProducts.length){return;}
13this.dataLayer.push({'event':'removeFromCart','ecommerce':{'currencyCode':this.dlCurrencyCode,'remove':{'products':this.formatProductsArray(this.removedProducts)}}});this.removedProducts=[];},parseAddToCartCookies:function(){var addProductsList;if(getCookie(this.cookieAddToCart)){this.addedProducts=[];addProductsList=decodeURIComponent(getCookie(this.cookieAddToCart));this.addedProducts=JSON.parse(addProductsList);delCookie(this.cookieAddToCart);this.cartItemAdded();}},parseRemoveFromCartCookies:function(){var removeProductsList;if(getCookie(this.cookieRemoveFromCart)){this.removedProducts=[];removeProductsList=decodeURIComponent(getCookie(this.cookieRemoveFromCart));this.removedProducts=JSON.parse(removeProductsList);delCookie(this.cookieRemoveFromCart);this.cartItemRemoved();}}};window.GoogleAnalyticsUniversalCart=GoogleAnalyticsUniversalCart;function GoogleAnalyticsUniversal(config){this.blockNames=config.blockNames;this.dlCurrencyCode=config.dlCurrencyCode;this.dataLayer=config.dataLayer;this.staticImpressions=config.staticImpressions;this.staticPromotions=config.staticPromotions;this.updatedImpressions=config.updatedImpressions;this.updatedPromotions=config.updatedPromotions;}
14GoogleAnalyticsUniversal.prototype={activeOnCategory:function(id,name,category,list,position){this.dataLayer.push({'event':'productClick','ecommerce':{'click':{'actionField':{'list':list},'products':[{'id':id,'name':name,'category':category,'list':list,'position':position}]}}});},activeOnProducts:function(id,name,list,position,category){this.dataLayer.push({'event':'productClick','ecommerce':{'click':{'actionField':{'list':list},'products':[{'id':id,'name':name,'list':list,'position':position,'category':category}]}}});},addToCart:function(id,name,price,quantity){this.dataLayer.push({'event':'addToCart','ecommerce':{'currencyCode':this.dlCurrencyCode,'add':{'products':[{'id':id,'name':name,'price':price,'quantity':quantity}]}}});},removeFromCart:function(id,name,price,quantity){this.dataLayer.push({'event':'removeFromCart','ecommerce':{'currencyCode':this.dlCurrencyCode,'remove':{'products':[{'id':id,'name':name,'price':price,'quantity':quantity}]}}});},clickBanner:function(id,name,creative,position){this.dataLayer.push({'event':'promotionClick','ecommerce':{'promoClick':{'promotions':[{'id':id,'name':name,'creative':creative,'position':position}]}}});},bindImpressionClick:function(id,type,name,category,list,position,blockType,listPosition){var productLink=[],eventBlock;switch(blockType){case'catalog.product.related':eventBlock='.products-related .products';break;case'product.info.upsell':eventBlock='.products-upsell .products';break;case'checkout.cart.crosssell':eventBlock='.products-crosssell .products';break;case'category.products.list':case'search_result_list':eventBlock='.products .products';break;}
15productLink=$(eventBlock+' .item:nth-child('+listPosition+') a');if(type==='configurable'||type==='bundle'||type==='grouped'){productLink=$(eventBlock+' .item:nth-child('+listPosition+') .tocart',eventBlock+' .item:nth-child('+listPosition+') a');}
16productLink.each(function(index,element){$(element).on('click',function(){if(blockType!=='category.products.list'){category='';}
17this.activeOnProducts(id,name,list,position,category);}.bind(this));}.bind(this));},updateImpressions:function(){var pageImpressions=this.mergeImpressions(),dlImpressions={'event':'productImpression','ecommerce':{'impressions':[]}},i=0,impressionCounter=0,impression,blockName;for(blockName in pageImpressions){if(blockName==='length'||!pageImpressions.hasOwnProperty(blockName)){continue;}
18for(i;i<pageImpressions[blockName].length;i++){impression=pageImpressions[blockName][i];dlImpressions.ecommerce.impressions.push({'id':impression.id,'name':impression.name,'category':impression.category,'list':impression.list,'position':impression.position});impressionCounter++;
18this.bindImpressionClick(impression.id,impression.type,impression.name,impression.category,impression.list,impression.position,blockName,impression.listPosition);}}
19if(impressionCounter>0){this.dataLayer.push(dlImpressions);}},mergeImpressions:function(){var pageImpressions=[];this.blockNames.forEach(function(blockName){if(blockName in this.updatedImpressions){pageImpressions[blockName]=this.updatedImpressions[blockName];}else if(blockName in this.staticImpressions){pageImpressions[blockName]=this.staticImpressions[blockName];}},this);return pageImpressions;},updatePromotions:function(){var dlPromotions={'event':'promotionView','ecommerce':{'promoView':{'promotions':[]}}},pagePromotions=[],promotionCounter=0,bannerIds=[],i=0,promotion,self=this;if(this.updatedPromotions.length){pagePromotions=this.updatedPromotions;}
20if(!pagePromotions.length&&this.staticPromotions.length){pagePromotions=this.staticPromotions;}
21if($('[data-banner-id]').length){_.each($('[data-banner-id]'),function(banner){var $banner=$(banner),ids=($banner.data('ids')+'').split(',');bannerIds=$.merge(bannerIds,ids);});}
22bannerIds=$.unique(bannerIds);for(i;i<pagePromotions.length;i++){promotion=pagePromotions[i];if($.inArray(promotion.id,bannerIds)==-1||promotion.activated=='0'){continue;}
23dlPromotions.ecommerce.promoView.promotions.push({'id':promotion.id,'name':promotion.name,'creative':promotion.creative,'position':promotion.position});promotionCounter++;}
24if(promotionCounter>0){this.dataLayer.push(dlPromotions);}
25$('[data-banner-id]').on('click','[data-banner-id]',function(){var bannerId=$(this).attr('data-banner-id'),promotions=_.filter(pagePromotions,function(item){return item.id===bannerId;});_.each(promotions,function(promotionItem){self.clickBanner(promotionItem.id,promotionItem.name,promotionItem.creative,promotionItem.position);});});}};window.GoogleAnalyticsUniversal=GoogleAnalyticsUniversal;})();

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.