define(['jquery','uiComponent','underscore','Magento_Customer/js/customer-data'],function($,Component,_,customerData){'use strict';return Component.extend({initialize:function(){this._super();const gtm=customerData.get('gtm');customerData.reload(['gtm'],false);gtm.subscribe(this.onUpdate);},onUpdate:function(data){_.each(data.push,function(item){if(item){window.dataLayer.push({ecommerce:null});if(typeof item.analytics_type!='undefined'&&item.analytics_type=='ga3'){window.dataLayer.push(item);}else if(typeof item.analytics_type!='undefined'&&item.analytics_type=='fbpixel'){if(typeof fbq!='undefined'){fbq(item[0],item[1],item[2]);}}else{if(typeof gtag!='undefined'){gtag(item[0],item[1],item[2]);}else{if(typeof item[0]!='undefined'){var formatedObj={};formatedObj[item[0]]=item[1];formatedObj['ecommerce']=item[2];window.dataLayer.push(formatedObj);}else{window.dataLayer.push(item);}}}}})}});});