PageSourceSearch

https://www.waterbedkampioen.nl/static/version1790591867/frontend/ReachDigital/wbx/nl_NL/Anowave_Ec4/js/ec4.js

js waterbedkampioen.nl collected 2026-10-05 21:39:26 UTC 2,409 bytes, 113 lines download raw bytes

1if ('undefined' !== typeof AEC && 'undefined' !== typeof AEC.EventDispatcher)
2{	
3	AEC.GA4 = (() => 
4	{
5		return {
6			enabled: false,
7			transformCategories: function(category)
8			{
9				if (null === category)
10				{
11					return {};
12				}
13				
14				let map = {}, categories = category.toString().split('/');
15				
16				if (categories)
17				{
18					map['item_category'] = categories.shift();
19					
20					if (categories.length)
21					{
22						let index = 1;
23						
24						categories.forEach(category => 
25						{
26							map['item_category' + (++index)] = category;
27						});
28					}
29				}
30				
31				return map;
32			},
33			augmentCategories: function(product) 
34			{
35				if (product.hasOwnProperty('category'))
36				{
37					AEC.Cookie.augment([product]);
38				}
39				
40				return this.transformCategories(product.category);
41			},
42			augmentItem: function(product)
43			{
44				let map = {};
45				
46				map['google_business_vertical'] = 'retail';
47				
48				Object.entries(product).forEach(([key, value]) => 
49				{
50					if (-1 === ['id','name','price','category','currency','variant','brand'].indexOf(key))
51					{
52						map[key] = value;
53					}
54				});
55				
56				return map;
57			}
58			
59		}
60	})();
61	
62	/**
63	 * Modify checkout step option payloasd
64	 */
65	AEC.EventDispatcher.on('ec.checkout.step.option.data', data => 
66	{
67		if (!AEC.GA4.enabled)
68		{
69			return true;
70		}
71		
72		switch(parseInt(data.ecommerce.checkout_option.actionField.step))
73		{
74			case AEC.Const.CHECKOUT_STEP_SHIPPING:
75				
76				data['event'] = 'add_shipping_info';
77				
78				if (AEC.GA4.quote.hasOwnProperty('coupon'))
79				{
80					data.ecommerce['coupon'] = AEC.GA4.quote.coupon;
81				}
82				
83				data.ecommerce['currency'] = AEC.GA4.currency;
84				
85				data.ecommerce['items'] = AEC.Checkout.getPayload().ecommerce.items;
86				
87				data.ecommerce['shipping_tier'] = data.ecommerce.checkout_option.actionField.option;
88				
89				delete data.ecommerce.checkout_option;
90				
91				break;
92				
93			case AEC.Const.CHECKOUT_STEP_PAYMENT:
94				
95				data['event'] = 'add_payment_info';
96				
97				if (AEC.GA4.quote.hasOwnProperty('coupon'))
98				{
99					data.ecommerce['coupon'] = AEC.GA4.quote.coupon;
100				}
101
102				data.ecommerce['currency'] = AEC.GA4.currency;
103				
104				data.ecommerce['items'] = AEC.Checkout.getPayload().ecommerce.items;
105				
106				data.ecommerce['payment_type'] = data.ecommerce.checkout_option.actionField.option;
107				
108				delete data.ecommerce.checkout_option;
109				
110				break;
111		}
112	});
113}

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.