function subscribeOnBodlEvents(n,e){function t(){dataLayer.push(arguments)}function o(e){return Object.assign({},e,{send_to:n})}function i(n,e){var t=n.discount||0,o=n.coupon_amount||0,i={item_id:n.sku||n.variant_sku||n.product_sku||n.variant_id||n.product_id,item_name:n.product_name,discount:t+o,currency:n.currency,index:void 0!==n.index?n.index:e,item_brand:n.brand_name,item_variant:n.sku||n.variant_sku||n.product_sku||n.product_id,quantity:n.quantity};if(n.category_name)i.item_category=n.category_name;else if(n.category_names&&Array.isArray(n.category_names)){n.category_names.slice(0,5).forEach((function(n,e){i["item_category"+(e?e+1:"")]=n}))}return n.purchase_price?i.price=n.purchase_price:i.price=n.sale_price>0?n.sale_price:n.price,n.coupon&&(i.coupon=n.coupon),i}window&&void 0!==window.bodlEvents&&(e&&window.bodlEvents.consent&&"function"==typeof window.bodlEvents.consent.updated&&window.bodlEvents.consent.updated((function(n){t("consent","update",function(n){var e={advertising:["ad_storage","ad_user_data","ad_personalization"],analytics:["analytics_storage"],functional:["functionality_storage"]},t={};return Object.keys(n).forEach((function(o){var i=e[o],r=n[o]?"granted":"denied";Array.isArray(i)&&i.forEach((function(n){t[n]=r}))})),t}(n))})),function(){var n="begin_checkout",e="purchase",r="add_shipping_info",c="add_payment_info";function a(n){var e=Array.isArray(n.coupon_codes)&&n.coupon_codes.length?n.coupon_codes[0]:n.coupon,t={currency:n.currency,value:n.cart_value,items:n.line_items.map((function(n,t){return e&&(n.coupon=e),i(n,t)}))};return e&&(t.coupon=e),o(t)}void 0!==window.bodlEvents.checkout&&("function"==typeof window.bodlEvents.checkout.checkoutBegin&&window.bodlEvents.checkout.checkoutBegin((function(e){t("event",n,function(n){return o(a(n))}(e))})),"function"==typeof window.bodlEvents.checkout.orderPurchased&&window.bodlEvents.checkout.orderPurchased((function(n){t("event",e,function(n){var e=a(n),t={transaction_id:n.order_id||n.transaction_id,shipping:n.shipping_cost};return n.tax&&(t.tax=n.tax),o(Object.assign(e,t))}(n))})),"function"==typeof window.bodlEvents.checkout.shippingDetailsProvided&&window.bodlEvents.checkout.shippingDetailsProvided((function(n){t("event",r,function(n){var e=a(n),t={shipping_tier:n.shipping_method};return o(Object.assign(e,t))}(n))})),"function"==typeof window.bodlEvents.checkout.paymentDetailsProvided&&window.bodlEvents.checkout.paymentDetailsProvided((function(n){t("event",c,function(n){var e=a(n),t={payment_type:n.payment_type};return o(Object.assign(e,t))}(n))})))}(),function(){if(void 0!==window.bodlEvents.cart){var n="view_cart",e="add_to_cart",r="remove_from_cart";"function"==typeof window.bodlEvents.cart.viewed&&window.bodlEvents.cart.viewed((function(e){t("event",n,c(e))})),"function"==typeof window.bodlEvents.cart.addItem&&window.bodlEvents.cart.addItem((function(n){t("event",e,c(n))})),"function"==typeof window.bodlEvents.cart.removeItem&&window.bodlEvents.cart.removeItem((function(n){t("event",r,c(n))}))}function c(n){var e={currency:n.currency,items:Array.isArray(n.line_items)?n.line_items.map(i):[]};return e.value=n.product_value||n.cart_value||e.items.reduce((function(n,e){return n+e.price*e.quantity}),0),o(e)}}(),function(){if(void 0!==window.bodlEvents.product){var n="view_item",e="view_item_list",r="search";"function"==typeof window.bodlEvents.product.pageViewed&&window.bodlEvents.product.pageViewed((function(e){t("event",n,function(n){var e=n.line_items&&n.line_items.map((function(n){var e=i(n);return delete e.quantity,e})),t=e&&e[0]||{};return o({value:t.price,currency:t.currency,items:e})}(e))})),"function"==typeof window.bodlEvents.product.categoryViewed&&window.bodlEvents.product.categoryViewed((function(n){t("event",e,function(n){return o({item_list_id:n.category_id,item_list_name:n.category_name,items:n.line_items&&n.line_items.map((function(n){var e=i(n);return delete e.quantity,e}))})}(n))})),"function"==typeof window.bodlEvents.product.searchPerformed&&window.bodlEvents.product.searchPerformed((function(n){t("event",r,function(n){return o({search_term:n.search_keyword})}(n))}))}}(),function(){if(void 0!==window.bodlEvents.banner){var n="view_promotion";"function"==typeof window.bodlEvents.banner.viewed&&window.bodlEvents.banner.viewed((function(e){t("event",n,function(n){return o({promotion_id:"banner_"+n.banner_id,promotion_name:n.banner_name})}(e))}))}}())} //# sourceMappingURL=google_analytics4_bodl_subscribers-358423becf5d870b8b603a81de597c10f6bc7699.js.map