PageSourceSearch

https://www.somfy.de/TagCommander/js/tagCommanderV5.js?1790861358235

js somfy.de collected 2026-10-02 14:32:50 UTC 78,804 bytes, 1,612 lines download raw bytes

1$(document).ready(function(){
2    function setDynamicTags() {
3    	var tagRequest = {dataType:"json", url:pageAjaxURL+"?targetFunction=setTags&targetComponent=ajax&sitename="+pageSitename+"&plugin=TagCommander",method:"POST"};
4    	tagRequest.success = function(data) { 
5    		if(data) {
6    			//console.log("sendTags document ready datas:");
7				//console.log(data);
8    			sendTags(data);
9    		}
10    	 };
11    	 tagRequest.error = function(err) { 
12    		
13    	};
14    	jQuery.ajax(tagRequest);
15    }            
16    setDynamicTags();
17    initEvents();
18                
19});
20
21function displayPrice(x) {
22	if (Number.isNaN(Number.parseFloat(x))) {
23		return 0;
24	}
25	return Math.round(x * 100) / 100;
26}
27
28function sendTags(tags,addScriptsTC=true) {
29	// add here boolean fields
30	const booleanFields = ["user_returning","product_act_for_green","product_id_ecommerce"];
31	// add here float fields for prices
32	const priceFields = ["listing_product_unit_sale_price_ati","listing_product_bundle_unit_sale_price_ati","listing_product_promotion_discount","product_promotion_discount","product_unit_sale_price_ati","product_bundle_unit_sale_price_ati"];
33	for(var key in tags) {
34		//console.log(key+":"+tags[key]);
35		if(typeof tags[key] == "object") {
36			tc_vars[key] = tags[key];
37			try {
38				for(var keyProduct in tc_vars[key]) {
39					if(typeof tc_vars[key][keyProduct] == "object") {
40						for(var productItem in tc_vars[key][keyProduct]) {
41							if(priceFields.includes(productItem)){
42								tc_vars[key][keyProduct][productItem] = displayPrice(tc_vars[key][keyProduct][productItem]);
43							}
44						}
45					}
46				}	
47			}
48			catch(error) {  console.error(error); }
49		} else {
50			if(booleanFields.includes(key)){
51				tc_vars[key] = tags[key] == 'true' || tags[key] == true;
52			}else if(priceFields.includes(key)){
53				tc_vars[key] = displayPrice(tags[key]);
54			}else{
55				tc_vars[key] = String(tags[key]);	
56			}		
57		}
58	}		
59	if(addScriptsTC) {
60		addTCJavaScript();
61	}
62}
63
64function addTCJavaScript() {
65	//console.log(tc_vars);
66	
67	//var tc_tag_1 = document.createElement('script');
68	var tc_tag_2 = document.createElement('script');
69	var tc_tag_3 = document.createElement('script');
70	//var firstScriptTag = document.getElementsByTagName('script')[0];
71	var headTag = document.getElementsByTagName('head')[0];
72	var bodyTag = document.getElementsByTagName('body')[0];
73	
74    //tc_tag_1.src = tc_container1;
75    tc_tag_2.src = tc_container2;
76    tc_tag_3.src = tc_container3;
77    
78    //headTag.appendChild(tc_tag_1);
79    bodyTag.appendChild(tc_tag_2);
80    bodyTag.appendChild(tc_tag_3);
81    //firstScriptTag.parentNode.insertBefore(tc_tag_1, firstScriptTag);
82    //firstScriptTag.parentNode.insertBefore(tc_tag_2, firstScriptTag);
83    //firstScriptTag.parentNode.insertBefore(tc_tag_3, firstScriptTag);
84    
85}
86
87function setEnvTemplate(tag){
88	var finalTag = "lead_lp";
89
90	if(tag == "savrdv"){
91		finalTag = "assistance_lead_lp";
92	}else if (tag == "quote"){
93		finalTag = "project_lead_lp";
94	}
95
96	var tagRequest = {dataType:"json", url: pageAjaxURL + "?targetFunction=setEnvTemplate&targetComponent=ajax&tag="+finalTag+"&plugin=TagCommander",method:"POST"};
97
98	jQuery.ajax(tagRequest);
99}
100
101
102function initEvents() {
103	showEventsInConsole = false;
104	// SEARCH SUGGESTION CLICK //
105	
106	$(".tc_event_search").click(function() {
107		//event.preventDefault();
108		//tc_events_global(this, 'search_click', {'evt_button_label': $(this).data('label'),'evt_button_url': $(this).attr('href')});
109		if(showEventsInConsole) console.log("tc_events_global(this, 'search_click', {'evt_button_label': " + $(this).data('label') + ",'evt_button_url': " + $(this).attr('href') + "});");
110	});
111	
112	/* Event when choosing service on DL
113	$(".tc_event_search_service a.dropdown-item").click(function() {
114		var selectedService = $(this).find("span.text").text();
115		var value = $("select.tc_event_search_service option:contains('"+selectedService+"')").val().toUpperCase();
116		
117		custom_tc_events_global(this, 'search_service', {'evt_button_label': value, 'evt_button_action': value});
118		if(showEventsInConsole) console.log("tc_events_global(this, 'search_service', {'evt_button_label': " + value + ",'evt_button_action': " + value + " });");
119	});
120	*/
121	 
122	/*$("#findCustomersForm").submit(function(event) {
123		try {
124			custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': 'searchbutton_click'});
125
126		}
127		catch(error) {
128		  console.error(error);
129		}
130	});*/
131	
132	
133	$(".videos-template-container").on('click', '.video', function() {
134		var video_label ="";
135		var video_title = $(this).find('h3').text();
136		var video_id = '';
137		var video_url = '';
138		try{
139			video_url = $(this).attr('href');
140			video_id = video_url.split("/").pop();
141			} catch(error){
142			 video_id = '';
143			 video_url = '';
144		}
145		//tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action': 'play','evt_button_label': video_label});
146		custom_tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action': 'YouTube_play' ,'evt_button_label': video_label, 'evt_video_url': video_url, 'evt_video_title' : video_title, 'evt_video_id' : video_id });
147		
148		if(showEventsInConsole) console.log("tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action': 'YouTube_play','evt_button_label': " + video_label + ",'evt_video_url': " + video_url + "});");
149	});	
150	
151	
152	// FORM // myaccount / contactUs
153	
154	$(".tc_event_form").submit(function(event) {
155		if($(".tc_event_form").valid()){
156			setTagCommanderJSVars($(this));
157		}
158	});
159		
160	// LEAD SEND DEVIS //
161	tc_event_lead_sent = false;
162	$(".tc_event_lead").submit(function(event) {
163		thisForm = $(this);
164
165		if(typeof bIsSubmitted === 'undefined' && tc_event_lead_sent == false) {
166			//event.preventDefault();
167
168			tc_event_lead_sent = true;
169			
170			var typeoflead = "";
171			
172			if ($(this).find("input[name=project_prestation]").val() == 'savrdv'){
173				typeoflead = "assistance_lead";
174			}else{
175				typeoflead = "project_lead";
176			}
177			var _marketing_optin = thisForm.find("input[name=marketing_optin]");
178			var form_marketing_optin = _marketing_optin.length > 0 && _marketing_optin.is(":checked");
179			
180			var mail = $(this).find("input[name=email]").val();
181			var fld_event_sent = $(this).find("input[name=event_sent]");
182			var email = md5(mail).toUpperCase();
183
184			if (typeof custom_tc_events_global === "function") {
185				custom_tc_events_global(this, 'lead', {'evt_form_label': typeoflead,'evt_form_id': email, 'form_marketing_optin': form_marketing_optin});
186				if(showEventsInConsole) console.log("tc_events_global(this, 'lead', {'evt_form_label': '" + typeoflead + "','evt_form_id': '" + email + "'});");
187				fld_event_sent.val("true");
188			}	
189			// Also send event to GTM
190			try {
191				dataLayer.push({'event':'GTM-lead', 'evt_form_label': typeoflead, 'evt_form_id': email});
192				console.log('GTM event sent:');
193				console.log("dataLayer.push({'event':'GTM-lead', 'evt_form_label': '"+typeoflead+"', 'evt_form_id': '"+email+"'});");
194			}
195			catch(error) {
196				console.log('Error with GTM event:');
197			  console.log(error);
198			}
199
200			if(!thisForm.find(".g-recaptcha").length && !thisForm.find(".hasCaptcha").length) {
201				// if there is no recaptcha, submit is sent here
202				// if there is a recaptcha, captchaJquery.cfc submit it after captcha is verified
203				bIsSubmitted = false
204				setTimeout(function(){ 
205					if(!bIsSubmitted) {
206						bIsSubmitted = true;
207						console.log('>> Form submitted');
208						thisForm.submit();
209					}
210				}, 500);
211			}
212		}	
213	});
214
215	// LEADS FORMS (global, form conversion and minisites) CLICK NEXT BUTTON 
216	$('.tc_lead_form_next_button_click').click(function(){
217		lead_form_next_button_click($(this));
218	});
219
220	//product comparator
221	$(".somfy").on("click",".tc_event_product_comparator", function(event) {
222		if($(this).hasClass('tc_event_product_comparator')) {
223			tc_product_event_click($(this));
224		}
225	});
226	// PRODUCT CLICK //
227	$('.tc_event_product').on( 'click', function(event){
228	//$(".somfy").on("click",".tc_event_product", function(event) {
229		//event.stopImmediatePropagation();
230		tc_product_event_click($(this));
231		/*
232		var _id = "product_click";
233		var _category = "product_listing";
234		if(typeof $(this).data('id') !== 'undefined' ) {
235			_id =  $(this).data('id');
236		}
237		if(typeof $(this).data('category') !== 'undefined' ) {
238			_category =  $(this).data('category');
239		}
240		tc_datas = {
241			'evt_category':  _category
242		}
243		if(typeof $(this).data('url') !== 'undefined' ) {
244			tc_datas.evt_button_url = $(this).data('url');
245		} else if( typeof $(this).attr('href') !== 'undefined') {
246			tc_datas.evt_button_url = $(this).attr('href');
247		}
248		if(typeof $(this).data('ref') !== 'undefined' ) {
249			tc_datas.evt_product_id = $(this).data('ref');
250		} else if(typeof $(this).data('reference') !== 'undefined' ) {
251			tc_datas.evt_product_id = $(this).data('reference');
252		} else if(typeof $(this).data('product-sku') !== 'undefined' ) {
253			tc_datas.evt_product_id = $(this).data('product-sku');
254		}
255		if(typeof $(this).data("label") !== 'undefined') 		tc_datas.evt_button_label = $(this).data("label");
256		if(typeof $(this).data("action") !== 'undefined') 		tc_datas.evt_button_action = $(this).data("action");
257		if(typeof $(this).data("retailer") !== 'undefined') 	tc_datas.evt_retailer_name = $(this).data("retailer");
258		if(typeof $(this).data("price") !== 'undefined') 		tc_datas.evt_value = $(this).data("price");
259		if(typeof $(this).data("promotion") !== 'undefined') 		tc_datas.product_promotion = $(this).data("promotion");
260		if(typeof $(this).data("promotion_discount") !== 'undefined') 		tc_datas.product_promotion_discount = $(this).data("promotion_discount");
261		if(typeof $(this).data("product_category") !== 'undefined') 		tc_datas.product_category = $(this).data("product_category");
262		if(typeof $(this).data("product_name") !== 'undefined') 		tc_datas.product_name = $(this).data("product_name");
263		if(typeof $(this).data("product_type") !== 'undefined') 		tc_datas.product_type = $(this).data("product_type");
264		if(typeof $(this).data("product_id_ecommerce") !== 'undefined') 		tc_datas.product_id_ecommerce = $(this).data("product_id_ecommerce");
265		if(typeof $(this).data("p_id_ecommerce") !== 'undefined') 		tc_datas.product_id_ecommerce = $(this).data("p_id_ecommerce");
266		if(typeof $(this).data("product_stock") !== 'undefined') 		tc_datas.product_stock = $(this).data("product_stock");
267		
268		
269		custom_tc_events_global(this, _id, tc_datas);
270		*/
271	});
272
273	//LISTING PRODUCT
274
275	//Listing Product - View more button
276	$(".somfy").on("click","a.tc_event_viewmore", function(event) {
277		event.stopImmediatePropagation();
278		tc_datas = {
279			'evt_category':   'product_listing',
280			'id':   'product_listing_viewMore',
281			'evt_button_action':   'viewMore_click'
282		}
283		custom_tc_events_global(this, 'product_listing_viewMore', tc_datas);
284	});
285
286	//Listing Product - Image Push click
287	$(".somfy").on("click","a.tc_event_image", function(event) {
288		event.stopImmediatePropagation();
289		tc_datas = {
290			'evt_category':   'product_listing',
291			'id':   'product_listing_push',
292			'evt_button_action':   'imagePush_click',
293			'evt_button_label' :  $(this).attr('href')
294		}
295		custom_tc_events_global(this, 'product_listing_push', tc_datas);
296	});
297
298	//Listing Product - contact Push click 
299	$(".somfy").on("click","a.tc_event_contact", function(event) {
300		event.stopImmediatePropagation();
301		tc_datas = {
302			'evt_category':   'product_listing',
303			'id':   'product_listing_push',
304			'evt_button_action':   'contactPush_click',
305			'evt_button_label' :  $(this).attr('href')
306		}
307		custom_tc_events_global(this, 'product_listing_push', tc_datas);
308	});
309
310	//Listing Product - Filter Push 
311	$(".somfy").on("click","a.tc_event_needhelp", function(event) {
312		event.stopImmediatePropagation();
313		tc_datas = {
314			'evt_category':   'product_listing',
315			'id':   'product_listing_push',
316			'evt_button_action':   'filterPush_click',
317			'evt_button_label' :  $(this).attr('href')
318		}
319		custom_tc_events_global(this, 'product_listing_push', tc_datas);
320	});
321
322	//Listing Product - Applications filter
323	$(".somfy").on("change", "input[type='checkbox'][name='applications']", function(event) {
324		event.stopImmediatePropagation();
325		if(this.checked) {
326			var _evt_button_label = this.value;
327			if(typeof $(this).data("name") !== 'undefined') {
328				_evt_button_label = $(this).data("name"); 
329			}
330			tc_datas = {
331				'evt_category':   'product_listing',
332				'id':   'product_listing_filters',
333				'evt_button_action':   'applicationsFilter_click',
334				'evt_button_label' : _evt_button_label
335			}
336			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
337		}
338	});	
339
340	//Listing Product - Technology filter  
341	$(".somfy").on("change", "input[type='checkbox'][name='technology']", function(event) {
342		event.stopImmediatePropagation();
343		if(this.checked) {
344			var _evt_button_label = this.value;
345			if(typeof $(this).data("name") !== 'undefined') {
346				_evt_button_label = $(this).data("name"); 
347			}
348			tc_datas = {
349				'evt_category':   'product_listing',
350				'id':   'product_listing_filters',
351				'evt_button_action':   'technologyFilter_click',
352				'evt_button_label' : _evt_button_label
353			}
354			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
355		}
356	});	
357	//Listing Product - Price range filter  
358	$(".somfy").on("click",".filter-list-sidebar button.btn-price", function(event) {
359		event.stopImmediatePropagation();
360		tc_datas = {
361			'evt_category':   'product_listing',
362			'id':   'product_listing_filters',
363			'evt_button_action':   'priceRangeFilter_click',
364			'evt_button_label' : $('#min-price').val() + "/"+ $('#max-price').val()
365		}
366		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
367	});
368
369	//Listing Product - Product type filter
370	$(".somfy").on("change", "input[type='checkbox'][name='product_type']", function(event) {
371		event.stopImmediatePropagation();
372		if(this.checked) {
373			var _evt_button_label = this.value;
374			if(typeof $(this).data("name") !== 'undefined') {
375				_evt_button_label = $(this).data("name"); 
376			}
377			tc_datas = {
378				'evt_category':   'product_listing',
379				'id':   'product_listing_filters',
380				'evt_button_action':   'productTypeFilter_click',
381				'evt_button_label' : _evt_button_label
382			}
383			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
384		}
385	});
386	
387	//Listing Product - Customer ratings filter
388	$(".somfy").on("click",".filter-list-sidebar a.rating", function(event) {
389		event.stopImmediatePropagation();
390		tc_datas = {
391			'evt_category':   'product_listing',
392			'id':   'product_listing_filters',
393			'evt_button_action':   'ratingsFilter_click',
394			'evt_button_label' : $(this).find("label").text().trim()
395		}
396		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
397	});
398
399	//Listing Product - Color filter
400	$(".somfy").on("change", "input[type='checkbox'][name='color_finish']", function(event) {
401		event.stopImmediatePropagation();
402		if(this.checked) {
403			var _evt_button_label = this.value;
404			if(typeof $(this).data("name") !== 'undefined') {
405				_evt_button_label = $(this).data("name"); 
406			}
407			tc_datas = {
408				'evt_category':   'product_listing',
409				'id':   'product_listing_filters',
410				'evt_button_action':   'colorFilter_click',
411				'evt_button_label' : _evt_button_label
412			}
413			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
414		}
415	});
416	
417	// Listing Product - Search within result
418	$('input[name="search-within-results"]').focusout( function() {
419		tc_datas = {
420			'evt_category':   'product_listing',
421			'id':   'product_listing_filters',
422			'evt_button_action':   'searchFilter_click',
423			'evt_button_label' : this.value
424		}
425		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
426	 });
427
428	//Listing Product - page display grid
429	$(".somfy").on("click","#display_grid", function(event) {
430		event.stopImmediatePropagation();
431		tc_datas = {
432			'evt_category':   'product_listing',
433			'id':   'product_listing_filters',
434			'evt_button_action':   'displayGrid_click'
435		}
436		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
437	});
438
439	//Listing Product - page display list
440	$(".somfy").on("click","#display_list", function(event) {
441		event.stopImmediatePropagation();
442		tc_datas = {
443			'evt_category':   'product_listing',
444			'id':   'product_listing_filters',
445			'evt_button_action':   'displayList_click'
446		}
447		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
448	});
449	//Listing Product internal_compatibility
450	$(".somfy").on("change", "input[type='checkbox'][name='internal_compatibility']", function(event) {
451		event.stopImmediatePropagation();
452		if(this.checked) {
453			var _evt_button_label = this.value;
454			if(typeof $(this).data("name") !== 'undefined') {
455				_evt_button_label = $(this).data("name"); 
456			}
457			tc_datas = {
458				'evt_category':   'product_listing',
459				'id':   'product_listing_filters',
460				'evt_button_action':   'internalCompatibility_click',
461				'evt_button_label' : _evt_button_label
462			}
463			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
464		}
465
466		if(this.value == "tahoma") {
467			var _evt_button_label = this.value;
468			if(this.checked) {
469				_evt_button_label = 'on';
470			} else {
471				_evt_button_label = 'off';
472			}
473			tc_datas = {
474				'evt_category':   'product_listing',
475				'id':   'product_listing_filters',
476				'evt_button_action':   'TahomaCompatible_click',
477				'evt_button_label' : _evt_button_label
478			}
479			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
480		}
481	});
482	
483	//Listing Product mobile_apps
484	$(".somfy").on("change", "input[type='checkbox'][name='mobile_apps']", function(event) {
485		event.stopImmediatePropagation();
486		if(this.checked) {
487			var _evt_button_label = this.value;
488			if(typeof $(this).data("name") !== 'undefined') {
489				_evt_button_label = $(this).data("name"); 
490			}
491			tc_datas = {
492				'evt_category':   'product_listing',
493				'id':   'product_listing_filters',
494				'evt_button_action':   'mobileApps_click',
495				'evt_button_label' : _evt_button_label
496			}
497			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
498		}
499	});
500	
501	//Listing Product Partnerships
502	$(".somfy").on("change", "input[type='checkbox'][name='partnerships']", function(event) {
503		event.stopImmediatePropagation();
504		if(this.checked) {
505			var _evt_button_label = this.value;
506			if(typeof $(this).data("name") !== 'undefined') {
507				_evt_button_label = $(this).data("name"); 
508			}
509			tc_datas = {
510				'evt_category':   'product_listing',
511				'id':   'product_listing_filters',
512				'evt_button_action':   'partnerships_click',
513				'evt_button_label' : _evt_button_label
514			}
515			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
516		}
517	});
518	
519	//Listing Product External Compatibility
520	$(".somfy").on("change", "input[type='checkbox'][name='external_compatibility']", function(event) {
521		event.stopImmediatePropagation();
522		if(this.checked) {
523			var _evt_button_label = this.value;
524			if(typeof $(this).data("name") !== 'undefined') {
525				_evt_button_label = $(this).data("name"); 
526			}
527			tc_datas = {
528				'evt_category':   'product_listing',
529				'id':   'product_listing_filters',
530				'evt_button_action':   'externalCompatibility_click',
531				'evt_button_label' : _evt_button_label
532			}
533			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
534		}
535	});
536	
537	//Listing Product Act for green
538	$(".somfy").on("change", "input[type='checkbox'][name='is_act_for_green']", function(event) {
539		event.stopImmediatePropagation();
540		var _evt_button_label = this.value;
541		if(this.checked) {
542			_evt_button_label = 'on';
543		} else {
544			_evt_button_label = 'off';
545		}
546		tc_datas = {
547			'evt_category':   'product_listing',
548			'id':   'product_listing_filters',
549			'evt_button_action':   'ActForGreen_click',
550			'evt_button_label' : _evt_button_label
551		}
552		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
553	});
554	
555	//Listing Product Tahoma compatbile
556	$(".somfy").on("change", "input[type='checkbox'][name='is_tahoma_compatible']", function(event) {
557		event.stopImmediatePropagation();
558		var _evt_button_label = this.value;
559		if(this.checked) {
560			_evt_button_label = 'on';
561		} else {
562			_evt_button_label = 'off';
563		}
564		tc_datas = {
565			'evt_category':   'product_listing',
566			'id':   'product_listing_filters',
567			'evt_button_action':   'TahomaCompatible_click',
568			'evt_button_label' : _evt_button_label
569		}
570		custom_tc_events_global(this, 'product_listing_filters', tc_datas);
571	});
572	
573	//Listing Product Where to buy
574	$(".somfy").on("change", "input[type='checkbox'][name='where_to_buy']", function(event) {
575		event.stopImmediatePropagation();
576		if(this.checked) {
577			var _evt_button_label = this.value;
578			if(typeof $(this).data("name") !== 'undefined') {
579				_evt_button_label = $(this).data("name"); 
580			}
581			tc_datas = {
582				'evt_category':   'product_listing',
583				'id':   'product_listing_filters',
584				'evt_button_action':   'wheretobuy_click',
585				'evt_button_label' : _evt_button_label
586			}
587			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
588		}
589	});
590	
591	//Listing Product Voice assistant
592	$(".somfy").on("change", "input[type='checkbox'][name='voice_assistants']", function(event) {
593		event.stopImmediatePropagation();
594		if(this.checked) {
595			var _evt_button_label = this.value;
596			if(typeof $(this).data("name") !== 'undefined') {
597				_evt_button_label = $(this).data("name"); 
598			}
599			tc_datas = {
600				'evt_category':   'product_listing',
601				'id':   'product_listing_filters',
602				'evt_button_action':   'voiceAssistant_click',
603				'evt_button_label' : _evt_button_label
604			}
605			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
606		}
607	});
608	
609	//Listing Product Availibility
610	$(".somfy").on("change", "input[type='checkbox'][name='product_status']", function(event) {
611		event.stopImmediatePropagation();
612		var _evt_button_label = this.value;
613		if(this.checked) {
614			if(this.value == 0) {
615				_evt_button_label = 'active'; 
616			} else {
617				_evt_button_label = 'obsolete'; 
618			}
619			tc_datas = {
620				'evt_category':   'product_listing',
621				'id':   'product_listing_filters',
622				'evt_button_action':   'availibility_click',
623				'evt_button_label' : _evt_button_label
624			}
625			custom_tc_events_global(this, 'product_listing_filters', tc_datas);
626		}
627	});
628	
629	//Listing Product Sorting
630	$(".somfy").on("change", "select[name='sort_by']", function(event) {
631		event.stopImmediatePropagation();
632		var _evt_button_label = this.value;
633		tc_datas = {
634			'id':   'product_listing_sorting',
635			'evt_category':   'product_listing',
636			'evt_button_action':   'sorting_click',
637			'evt_sorting_label' : _evt_button_label
638		}
639		custom_tc_events_global(this, 'product_listing_sorting', tc_datas);
640	});
641
642	//END LISTING PRODUCT
643	//Faq product 
644	$(".tc_button_faq").click(function(event) {
645		if($(this).hasClass('active')){	
646			custom_tc_events_global(this, 'open_faq_accordion', {'evt_category': 'product','evt_button_action': 'open_faq_accordion','evt_button_label': $(this).text().replace(/\t/g, '').replace(/\n/g,''),'evt_product_id': '' + $(this).attr('data-reference')});
647	
648		}
649	});
650	
651	$(".tc_button_faq_seeall").click(function(event) {
652		custom_tc_events_global(this, 'display_all_faq', {'evt_category': 'product','evt_button_action': 'display_all_faq','evt_product_id': '' + $(this).attr('data-reference')});
653	});
654	
655	
656
657	// HEADER CLICK //
658	
659	// surheader_sites
660	$(".tc_event_surheader a").click(function(event) { 
661		if(!$(this).hasClass('tc_event_clickcart')) {
662			var label = $(this).text().trim();
663			if($(this).html().indexOf('img')>=0) {
664				var label = $(this).children("img").attr("alt");
665			}
666			custom_tc_events_global(this, 'header_click', {'evt_category': 'header','evt_button_label': label,'evt_button_url': $(this).attr('href')});
667			if(showEventsInConsole) console.log("tc_events_global(this, 'header_click', {'evt_category': 'header','evt_button_label': " + label + ",'evt_button_url': " + $(this).attr('href') + "});");
668		}
669	});
670	
671	$(".tc_event_header").click(function(event) { 
672		var label = $(this).text().trim();
673		if(typeof $(this).data('label') != 'undefined' ) {
674			var label = $(this).data('label');
675		}
676		var btn_url = $(this).attr('href');
677		if(btn_url == "javascript:void(null);") {
678			btn_url = "";
679		}
680		
681		if(label != "search_open" || (label == "search_open" && $(this).hasClass("-open"))) {
682			custom_tc_events_global(this, 'header_click', {'evt_button_label': label,'evt_button_url': btn_url});
683			if(showEventsInConsole) console.log("tc_events_global(this, 'header_click', {'evt_button_label': " + label + ",'evt_button_url': " + btn_url + "});");
684		}
685	});
686	
687	$(".tc_event_sticky").click(function(event) { 
688		var label = $(this).text().trim();
689		if(typeof $(this).data('label') != 'undefined' ) {
690			var label = $(this).data('label');
691		}
692
693		custom_tc_events_global(this, 'sticky_click', {'evt_button_label': label,'evt_button_url': $(this).attr('href')});
694		if(showEventsInConsole) console.log("tc_events_global(this, 'sticky_click', {'evt_button_label': " + label + ",'evt_button_url': " + $(this).attr('href') + "});");
695	});
696	
697	$(".tc_event_footer").click(function(event) { 
698		var label = $(this).text().trim();
699		if(typeof $(this).data('label') != 'undefined' ) {
700			var label = $(this).data('label');
701		}
702
703		custom_tc_events_global(this, 'footer_click', {'evt_button_label': label,'evt_button_url': $(this).attr('href')});
704		if(showEventsInConsole) console.log("tc_events_global(this, 'footer_click', {'evt_button_label': " + label + ",'evt_button_url': " + $(this).attr('href') + "});");
705	});
706	
707	
708	
709	
710	// SOCIAL CLICK //
711	
712	$(".tc_event_social a").click(function(event) { 
713		var label = $(this).text().trim();
714		var button = '';
715		if(typeof $(this).data('label') != 'undefined' ) {
716			var label = $(this).data('label');
717		}
718		if(typeof $(this).data('button') != 'undefined' ) {
719			var button = $(this).data('button');
720		}
721		custom_tc_events_global(this, 'social_click', {'evt_category': 'social','evt_button_label': button,'evt_social_label': label});
722		if(showEventsInConsole) console.log("tc_events_global(this, 'social_click', {'evt_category': 'social','evt_button_label': " + button + ",'evt_social_label': " + label + "});");
723	});
724
725	
726	// DOWNLOAD CLICK //
727			
728	$(".tc_event_download").click(function(event) {
729		var evt_button_label = $(this).text();
730		if( $(this).data('filename') != "" ) {
731			var evt_button_label = $(this).attr('data-filename');
732		}
733		var evt_button_url = $(this).attr('href');
734		custom_tc_events_global(this, 'download', {'evt_category': 'download','evt_button_label': evt_button_label,'evt_button_url': $(this).attr('href')});
735		if(showEventsInConsole) console.log("tc_events_global(this, 'download', {'evt_category': 'download','evt_button_label': " + evt_button_label + ",'evt_button_url': " + $(this).attr('href') + "});");
736	});
737	
738	//DEALER LOCATOR
739	$(".dealer-list .dealer .tc_event_dealerlocator a").click(function(event) {
740		if(typeof $(this).attr('data-action') !== 'undefined') {
741			custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': $(this).attr('data-action'),'evt_partner_id': $(this).parent().parent().attr("partnerid"),'evt_partner_name': $(this).parent().parent().attr("partnername")});
742			if(showEventsInConsole) console.log("tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': " + $(this).attr('data-action') + ",'evt_partner_id': " + $(this).parent().parent().attr("partnerid") + ",'evt_partner_name': " + $(this).parent().parent().attr("partnername") + "});");
743		}
744	});	
745	$('#ajaxSearchResult').on('click', '.tc_event_dealerlocator a', function (event) {
746		dl_click($(this));
747	});
748	$('.dealers-locator-content').on('click', '.tc_event_dealerlocator_element', function (event) {
749		dl_click($(this));
750	});
751	
752	//DEALER LOCATOR MINISITE
753	$(".tc_event_dealerlocator_minisite a, .tc_event_dealerlocator_element").click(function(event) {
754		if(typeof $(this).attr('data-action') !== 'undefined') {
755			var $elParent = $(this).parents('.tc_event_dealerlocator_minisite');
756			custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': $(this).attr('data-action'),'evt_partner_id': $elParent.attr("partnerid"),'evt_partner_name': $elParent.attr("partnername")});
757			if(showEventsInConsole) console.log("tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': " + $(this).attr('data-action') + ",'evt_partner_id': " + $(this).parent().attr("partnerid") + ",'evt_partner_name': " + $(this).parent().attr("partnername") + "});");
758		}
759	});
760
761	$('.minisites button#content-phone-title').on('click', function(){ 
762		var $elParent = $(this).closest('.minisites-header');
763		if($(this).attr('aria-expanded') === "true" ) {
764			custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': 'phoneto_click','evt_partner_id': $elParent.attr("partnerid"),'evt_partner_name': $elParent.attr("partnername")});
765		}
766		
767	});
768
769	$('.minisites-map').on('click', '.tc_event_dealerlocator_element', function (event) {
770		dl_click($(this));
771	});
772	
773	// DL by partnership
774	$(".tc_event_dl_partnerships").submit(function(event) {
775		custom_tc_events_global(this, "dealerlocator", {"evt_category":"dealerlocator", "evt_button_action":"searchbutton_click", "evt_search_country":$(this).attr('data-country') });
776	});
777		
778	// DEALER LIST (templates v6_dealerlist et v6_dealerlist_by_state) : OPEN IN GOOGLE MAP 
779	$('.tc_open_in_google_maps_listing_click').click(function(){
780		custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': 'open_in_google_maps_listing_click' ,'evt_partner_id': $(this).attr('data-partner-id'), 'evt_partner_name': $(this).attr('data-partner-name')});
781		if(showEventsInConsole) console.log("tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': 'open_in_google_maps_listing_click','evt_partner_id':" +  $(this).attr('data-partner-id') + ",'evt_partner_name': " + '' + $(this).attr('data-partner-name') + "});");
782	});	
783	
784	//VIDEO
785	$(".tc_event_play,.image-product-container .icon-play").click(function(event) {
786		var video_label = '';
787		var video_button_action = 'play';
788		var video_url = '';
789		var video_title = '';
790		var video_id = '';
791		/*if(typeof $(this).data('videosource') !== 'undefined' && $(this).data('videosource') != ""){
792			switch ($(this).data('videosource')) {
793				case 'teester' : {
794					video_button_action = 'Teester_play';
795					break;
796				}
797				case 'youtube' : {
798					video_button_action = 'YouTube_play';
799					break;
800				}
801						
802			}
803		}*/
804		if(typeof $(this).data('videotype') !== 'undefined' && $(this).data('videotype') != ""){
805			video_button_action = $(this).data('videotype');
806		}
807		if(typeof $(this).data('src') !== 'undefined' && $(this).data('src') != ""){
808			video_url = $(this).data('src');
809		}
810		if(typeof $(this).data('url') !== 'undefined' && $(this).data('url') != ""){
811			video_url = $(this).data('url');
812		}
813		if(typeof $(this).data('filename') !== 'undefined' && $(this).data('filename') != "") {
814			video_label = $(this).data('filename');
815			video_title = video_label;
816		}
817		if(typeof $(this).data('titlevideo') !== 'undefined' && $(this).data('titlevideo') != "") {
818			video_title = $(this).data('titlevideo');
819		}
820		if(typeof $(this).data('videoid') !== 'undefined' && $(this).data('videoid') != ""){
821			video_id = $(this).data('videoid');
822		}
823		custom_tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action': video_button_action ,'evt_button_label': video_label, 'evt_video_url': video_url, 'evt_video_title' : video_title, 'evt_video_id' : video_id });
824		if(showEventsInConsole) console.log("tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action':"+ video_button_action +",'evt_button_label': " + video_label + "'evt_video_url':" +video_url+ ",'evt_video_title' :" +video_title+"});");
825	});
826	
827	$(".tc_event_video").on('play', function(){
828		var video_label = '';
829		if( $(this).data('filename') != "" ) {
830			var video_label = $(this).attr('data-filename');
831		}
832		custom_tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action': 'play','evt_button_label': video_label});
833		if(showEventsInConsole) console.log("tc_events_global(this, 'video', {'evt_category': 'video','evt_button_action': 'play','evt_button_label': " + video_label + "});");
834	});
835
836	//PRESS RELEASES
837	$("select.tc-event-pr-filter").on("change", function(){
838		var _value = $(this).find("option:selected").text();
839		custom_tc_events_global(this, 'pressrelease_filter', {'evt_category': 'pressrelease','evt_filter_button': $(this).data('type'),'evt_filter_label': _value});
840	});
841	$('.press-items').on('click', '.tc-event-pr-article', function(){
842		custom_tc_events_global(this, 'pressrelease_click', {'evt_category': 'pressrelease','evt_pressrelease_action': 'article_click','evt_button_label': $(this).data('title')}
842);
843	});
844	$(".tc-event-pr-contact-us").on('click', function(){
845		custom_tc_events_global(this, 'pressrelease_click', {'evt_category': 'pressrelease','evt_pressrelease_action': 'contactus_click','evt_button_label': $(this).data('title')});
846	});
847
848	//RP BLOC CONVERSION
849	$(".tc-rp-bloc-conversion").on("click", function(){
850		if( $(this).parents('.bloc').hasClass('-products') || $(this).hasClass('tc-type-eshop') ) {
851			_tc_type = 'eshop';
852		} else {
853			_tc_type = 'global';
854		}
855		setBlocConverstionEvents( _tc_type, $(this), "", "", "", "", $(this).attr("href") );
856	});
857	
858	//block_click
859	block_click();
860	/*$("a.tc_block_click").click(function(event) {
861		custom_tc_events_global(this, 'block_click', {'evt_category': 'UX','evt_button_action': $(this).attr('data-action'),'evt_button_url': $(this).attr('href')});
862		if(showEventsInConsole) console.log("tc_events_global(this, 'UX', {'evt_category': 'block_click','evt_button_action': " + $(this).attr('data-action') + ",'evt_button_url': " + $(this).attr('href') + "});");
863	});*/
864	
865	//promo_offer
866	$("a.tc_promo_offer").click(function(event) {
867		custom_tc_events_global(this, 'promo_offer', {'evt_category': 'promo','evt_button_action': $(this).attr('data-action'),'evt_promo_label': $(this).attr('data-label')});
868		if(showEventsInConsole) console.log("tc_events_global(this, 'promo', {'evt_category': 'block_click','evt_button_action': " + $(this).attr('data-action') + ",'evt_promo_label': " + $(this).attr('data-label') + "});");
869	});
870	
871	// Search results from AfterVision
872	$(".afterVisionContent + .container-fluid .products a.productResult").click(function(event) {
873		custom_tc_events_global(this, 'ImageSearch', {'evt_category': 'ImageSearch','evt_button_action': 'imagesearch_productclick','evt_product_id': '' + $(this).attr('data-ref')});
874	});
875
876	// FAQ
877	$(document).on("change", '.faq-search select', function(event) {
878		if($(event.target).attr('id') == 'categories-select') {
879			evt_filter_button = "faq_category1";
880		} else if($(event.target).attr('id') == 'categories-select2') {
881			evt_filter_button = "faq_category2";
882		} else if($(event.target).attr('id') == 'categories-select3') {
883			evt_filter_button = "faq_category3";
884		}
885		evt_filter_label = $(event.target).find('option:selected').text();
886		custom_tc_events_global(this, 'faq_filter', {'evt_category': 'FAQ','evt_filter_button': evt_filter_button,'evt_filter_label': evt_filter_label});
887	});	
888	$(document).on("click", '.faq-search #filter-button', function(event) {
889		evt_search_keyword = $(event.target).parent().parent().find('#search-input').val();
890		custom_tc_events_global(this, 'faq_search', {'evt_category': 'FAQ','evt_button_action': 'faq_searchClick','evt_search_keyword': evt_search_keyword});
891	});	
892	$(document).on("keypress", '.faq-search #search-input', function(event) {
893		//search by pressing enter on search input
894		if (event.keyCode == 13) {
895			evt_search_keyword = $(event.target).val();
896			custom_tc_events_global(this, 'faq_search', {'evt_category': 'FAQ','evt_button_action': 'faq_searchClick','evt_search_keyword': evt_search_keyword});
897		}
898	});	
899	$(document).on("click", '.tc_event_faq_click_list', function(event) {
900		evt_button_url = $(event.currentTarget).attr('href');
901		custom_tc_events_global(this, 'faq_listClick', {'evt_category': 'FAQ','evt_button_action': 'faq_listClick','evt_button_url': evt_button_url});
902	});		
903
904	// MENU
905	$('.somfy > #header .menu_entries_navbar a, .somfy > header .header-nav-list a, .somfy > header .header-nav-list button').click(function() {
906		$entry = $(this);
907		evt = {};
908		data_tracking_section = $($entry.closest('*[data-tracking-section]')[0]).attr('data-tracking-section');
909			
910		if(typeof $(this).attr('href') === 'undefined' || $(this).attr('href') === false || $entry.attr('href') == '#' || $entry.attr('href').indexOf("javascript:void") > -1) {
911			evt.id = "main_menu_levels";
912			evt.button_action = "menuLevel" + $entry.attr('data-tracking-level') + "_click";
913			evt.button_label = data_tracking_section;
914
915			custom_tc_events_global(this, evt.id, {'evt_category': 'main_menu','evt_button_action': evt.button_action,'evt_button_label': evt.button_label});
916		} else {
917			evt.id = "main_menu_click";
918			if($entry.attr('data-tracking-button-action')) {
919				evt.button_action = $entry.attr('data-tracking-button-action');
920			} else {
921				evt.button_action = "Main" + capitalizeFirstLetter(data_tracking_section) + "_click";
922			}
923
924			evt.button_url = $entry.attr('href');
925
926			custom_tc_events_global(this, evt.id, {'evt_category': 'main_menu','evt_button_action': evt.button_action,'evt_button_url': evt.button_url});
927		}
928	});
929
930
931
932	$('.mobilebar .navbar-toggler, #somfyHeader .header-nav-toggle').click(function(e) {
933		if(($('.mobilebar .navbar-toggler').length && $(this).hasClass('collapsed')) || ($('#somfyHeader .header-nav-toggle').length && $(this).hasClass('-open'))) {
934			custom_tc_events_global(this, 'main_menu_open', {'evt_category': 'main_menu','evt_button_action': 'menu_open'});
935		}
936	});
937
938	// NEWS
939	$('a[data-news-type]').click(function(){
940		custom_tc_events_global(this, 'news', {'evt_category': 'news','evt_button_action': $(this).attr('data-news-type') + '_click','evt_button_url': $(this).attr('href')});
941	});
942
943	// ADD TO CART
944	$('.tc_event_clickcart').click(function(e){
945		console.log($(this).hasClass('cart-show') && $(this).find('.cart-items').text() != '' && parseInt($(this).find('.cart-items').text()) > 0 && !$(this).parent().find('.cart').hasClass('-hide'));
946		if($(this).hasClass('cart-show') && $(this).find('.cart-items').text() != '' && parseInt($(this).find('.cart-items').text()) > 0 && !$(this).parent().find('.cart').hasClass('-hide')) {
947			// detect if real click on cart link or click simulated with js when clicking on "go to cart" after adding a product to the cart
948			if(e.hasOwnProperty('originalEvent')) {
949				custom_tc_events_global(this, 'header_click', {'evt_category': 'header','evt_button_action': 'open_miniCart'});
950			}
951		} else {
952			custom_tc_events_global(this, 'header_click', {'evt_category': 'header','evt_button_label': 'eshop','evt_button_url': $(this).attr('href')});
953		}
954	});		
955	$(".somfy").on("click",".tc_event_addtocart_comparator, .tc_event_addtocart, .tc_event_addtocart_sticky, .tc_event_addtocart_sticky_mobile, .tc_event_continue_modal, .tc_event_gotocart_modal, .tc_event_customize, .tc_event_addbundletocart, .tc_event_oney", function(event) {
956		if($(this).hasClass('tc_event_addtocart_comparator')) {
957			id_event = "comparison_table_click";
958			evt_category = "product_comparison";
959			evt_button_action = "addto_cart";
960		} else if($(this).hasClass('tc_event_addtocart')) {
961			id_event = "product_addto_cart";
962			evt_category = "product";
963			evt_button_action = "addto_cart";
964		} else if($(this).hasClass('tc_event_addtocart_sticky') || $(this).hasClass('tc_event_addtocart_sticky_mobile')) {
965			id_event = "product_addto_cart";
966			evt_category = "product";
967			evt_button_action = "addto_cart_buy";
968		} else if($(this).hasClass('tc_event_continue_modal')) {
969			id_event = "eshop_funnel";
970			evt_category = "eshop_funnel";
971			evt_button_action = "continueShopping_click";
972		} else if($(this).hasClass('tc_event_gotocart_modal')) {
973			id_event = "eshop_funnel";
974			evt_category = "eshop_funnel";
975			evt_button_action = "goToCheckout_click";
976		} else if($(this).hasClass('tc_event_customize')) {
977			id_event = "product_configuration_click";
978			evt_category = "product";
979			evt_button_action = "product_configuration_click";
980		} else if($(this).hasClass('tc_event_addbundletocart')) {
981			id_event = "product_addto_cart";
982			evt_category = "product";
983			evt_button_action = "addto_cart";
984		} else if($(this).hasClass('tc_event_oney')) {
985			id_event = "view_pay_later_plans";
986			evt_category = "product";
987			evt_button_action = "view_pay_later_plans";
988		}
989		$main_bt_buy = $('.mainBuyButton');
990		attr_data_product_price = $main_bt_buy.attr('data-product-price');
991		if (typeof attr_data_product_price === 'undefined' || attr_data_product_price === false) {
992			data_product_price = "";
993		} else {
994			data_product_price = attr_data_product_price.replace(/[^0-9.,]+/, '');
995		}
996		_evt_product_id = '';
997		if(typeof $main_bt_buy.data('ref') !== 'undefined' ) {
998			_evt_product_id = $main_bt_buy.data('ref');
999		} else if(typeof $main_bt_buy.data('reference') !== 'undefined' ) {
1000			_evt_product_id = $main_bt_buy.data('reference');
1001		} else if(typeof $main_bt_buy.data('product-sku') !== 'undefined' ) {
1002			_evt_product_id = $main_bt_buy.data('product-sku');
1003		}
1004		_product_promotion = 'false';
1005		_product_promotion_discount = 0;
1006		_product_category = '';
1007		_product_name = '';
1008		_product_id_ecommerce = 'false';
1009		_product_stock = 'Outofstock';
1010		_product_classification = 'simple';
1011		_product_bundle = '';
1012		if(typeof  $main_bt_buy.data("promotion") !== 'undefined') 		_product_promotion =  $main_bt_buy.data("promotion");
1013		if(typeof  $main_bt_buy.data("promotion_discount") !== 'undefined') 		_product_promotion_discount =  $main_bt_buy.data("promotion_discount");
1014		if(typeof  $main_bt_buy.data("product_category") !== 'undefined') 		_product_category =  $main_bt_buy.data("product_category");
1015		if(typeof  $main_bt_buy.data("product_name") !== 'undefined') 		_product_name =  $main_bt_buy.data("product_name");
1016		if(typeof  $main_bt_buy.data("category") !== 'undefined') 		evt_category =  $main_bt_buy.data("category");
1017		if(typeof  $main_bt_buy.data("product_id_ecommerce") !== 'undefined') 		_product_id_ecommerce =  $main_bt_buy.data("product_id_ecommerce");
1018		if(typeof  $main_bt_buy.data("product_stock") !== 'undefined') 		_product_stock =  $main_bt_buy.data("product_stock");
1019		if(typeof  $main_bt_buy.data("product_classification") !== 'undefined') 		_product_classification =  $main_bt_buy.data("product_classification");		
1020		if(typeof  $main_bt_buy.data("product_bundle") !== 'undefined') 		_product_bundle =  $main_bt_buy.data("product_bundle");
1021		
1022		//products open bundle
1023		if($(this).hasClass('tc_event_addbundletocart')) {
1024			bundleOptions = JSON.parse(getBundleOptions($('#aside-panel-product .product-perso').data('sku'), true));
1025			array_products_bundle = [];
1026			for(productOption of bundleOptions) {
1027				product_bundle = {
1028					"evt_product_bundle_id" : productOption.product_sku,
1029					"evt_product_bundle_name" : productOption.product_name,
1030					"evt_product_bundle_unit_sale_price_ati" : displayPrice(productOption.product_price),
1031					"evt_product_bundle_stock" : "Instock",
1032					"evt_product_bundle_quantity" : parseInt(productOption.option_qty)
1033				}
1034				array_products_bundle.push(product_bundle);
1035			}
1036			_product_bundle = array_products_bundle;
1037		}
1038		
1039		_product_quantity = "";
1040		if($(".product-main-info #product-qty").length) {
1041			_product_quantity = $(".product-main-info #product-qty").val();
1042		}
1043
1044		tc_datas = {
1045			'evt_category': evt_category,
1046			'evt_button_action': evt_button_action, 
1047			'evt_product_id': '' + _evt_product_id, 
1048			'evt_value': displayPrice(data_product_price), 
1049			'evt_product_name': _product_name, 
1050			'evt_product_category': _product_category, 
1051			'evt_product_type': $main_bt_buy.attr('data-product-type'),
1052			'evt_product_promotion':_product_promotion,
1053			'evt_product_promotion_discount': displayPrice(_product_promotion_discount), 
1054			'evt_product_id_ecommerce':_product_id_ecommerce, 
1055			'evt_product_stock':_product_stock, 
1056			'evt_product_classification':_product_classification, 
1057			'evt_product_quantity':parseInt(_product_quantity), 
1058			'evt_product_bundle':_product_bundle
1059		}
1060
1061		if(typeof $(this).attr('data-payment_provider') !== 'undefined') {
1062			tc_datas["payment_provider"] = $(this).attr('data-payment_provider');
1063		}
1064
1065		custom_tc_events_global(this, id_event, tc_datas);
1066	});	
1067	$('.tc_event_gotocheckout, .tc_event_clickcart_mobile').click(function(){
1068		if($(this).hasClass('tc_event_gotocheckout')) {
1069			id_event = "mini_cart_checkout";
1070			evt_category = "mini_cart";
1071		} else {
1072			id_event = "cart_checkout";
1073			evt_category = "header";
1074		}
1075
1076		array_ref_products = [];
1077		$('.cart .cart-body .product').each(function(){
1078			array_ref_products.push($(this).attr('data-product-ref'));
1079		});
1080		list_ref_products = array_ref_products.join(",");
1081		custom_tc_events_global(this, id_event, {'evt_category': evt_category,'evt_button_action': 'goTo_checkout','evt_product_id': '' + list_ref_products, 'evt_value': Math.round($('.cart-total .cart-amount').text().replace(/[^0-9.,]+/, ''))});
1082	});
1083
1084	// PRODUCT PDP
1085	$('.tc_event_product_pdp').click(function(){
1086		_id = $(this).data("action");
1087		tc_datas = {
1088			'evt_category':   'product',
1089			'evt_button_action':   $(this).data("action")
1090		}
1091		if(typeof $(this).data("subnav_entry") !== 'undefined') 		tc_datas.evt_subnav_entry = $(this).data("subnav_entry");
1092		$pdp_presentation = $(".product-main-info");
1093		if(typeof $pdp_presentation.data("product_ref") !== 'undefined') 		tc_datas.evt_product_id = '' + $pdp_presentation.data("product_ref");
1094		if(typeof $pdp_presentation.data("product_price") !== 'undefined') 		tc_datas.evt_value = displayPrice($pdp_presentation.data("product_price"));
1095		if(typeof $pdp_presentation.data("product_name") !== 'undefined') 		tc_datas.evt_product_name = $pdp_presentation.data("product_name");
1096		if(typeof $pdp_presentation.data("product_promotion") !== 'undefined') 		tc_datas.evt_product_promotion = $pdp_presentation.data("product_promotion");
1097		if(typeof $pdp_presentation.data("product_promotion_discount") !== 'undefined') 		tc_datas.evt_product_promotion_discount = displayPrice($pdp_presentation.data("product_promotion_discount"));
1098		if(typeof $pdp_presentation.data("product_category") !== 'undefined') 		tc_datas.evt_product_category = $pdp_presentation.data("product_category");
1099		if(typeof $pdp_presentation.data("product_stock") !== 'undefined') 		tc_datas.evt_product_stock = $pdp_presentation.data("product_stock");
1100		if(typeof $pdp_presentation.data("product_classification") !== 'undefined') 		tc_datas.evt_product_classification = $pdp_presentation.data("product_classification");
1101		if(typeof $pdp_presentation.data("product_id_ecommerce") !== 'undefined') 		tc_datas.evt_product_id_ecommerce = $pdp_presentation.data("product_id_ecommerce");
1102		if(typeof $pdp_presentation.data("product_bundle") !== 'undefined') 		tc_datas.evt_product_bundle = $pdp_presentation.data("product_bundle");
1103		custom_tc_events_global(this, _id, tc_datas);
1104	});
1105
1106	// ACT FOR GREEN : LOGO THUMBNAIL PDP CLICK + LINK BLOCK ACT FOR GREEN CLICK //
1107	$(".tc_event_afg_logo, .tc_event_afg_link").click(function(event) { 
1108		$pdp_presentation = $(".product-main-info");
1109		if(typeof $pdp_presentation.data("product_ref") !== 'undefined') {
1110			evt_product_id = '' + $pdp_presentation.data("product_ref");
1111		} else {
1112			evt_product_id = ''
1113		}
1114		if(typeof $pdp_presentation.data("product_name") !== 'undefined') {
1115			evt_product_name = $pdp_presentation.data("product_name");
1116		} else {
1117			evt_product_name = '';
1118		}
1119		if($(this).hasClass("tc_event_afg_link")) {
1120			evt_button_action = 'pep_ecopassport_click';
1121			evt_button_url = $(this).attr('href');
1122		} else {
1123			evt_button_action = 'go_to_act_for_green_block_click';
1124			evt_button_url = '';
1125		}
1126
1127		custom_tc_events_global(this, 'act_for_green_click', {'evt_category': 'product','evt_button_action': evt_button_action,'evt_product_id': evt_product_id,'evt_product_name': evt_product_name,'evt_button_url': evt_button_url});
1128		if(showEventsInConsole) console.log("tc_events_global(this, 'act_for_green_click', {'evt_category': 'product','evt_button_action': "+evt_button_action+",'evt_product_id': "+evt_product_id+",'evt_product_name': "+evt_product_name+",'evt_button_url': "+evt_button_url+"});");
1129	});
1130
1131	// NOSTO PRODUCT
1132	//$('.nosto-list-item a').click(function(){
1133	//$(".nosto-list-item a").on('click', function() {
1134	/*$(".somfy").on("click",".nosto-list-item a", function(event) {
1135		_id = "product_cross_sell_click";
1136		tc_datas = {
1137			'evt_category':   "product_cross_sell",
1138			'evt_button_action':   "product_cross_sell_click",
1139			'evt_product_id':	'' + $(this).attr('href').match(/refSrc=([^&]+)/)[1],
1140			'evt_product_quantity': 1,
1141			'evt_product_id_ecommerce': "true",
1142			'evt_cross_sell_type': "recommendation_nosto"
1143		}
1144		if($(this).closest('.nosto-list-item').find('.nosto-oldprice')) {
1145			tc_datas.evt_product_promotion = "true";
1146			tc_datas.evt_product_promotion_discount = displayPrice(parseFloat($(this).closest('.nosto-list-item').find('.nosto-oldprice').text()) - parseFloat($(this).closest('.nosto-list-item').find('.nosto-newprice').text()));
1147			tc_datas.evt_value = $(this).closest('.nosto-list-item').find('.nosto-newprice').text();
1148		} else {
1149			tc_datas.evt_product_promotion = "false";
1150			tc_datas.evt_product_promotion_discount = 0;
1151			tc_datas.evt_value = $(this).closest('.nosto-list-item').find('.nosto-product-price').text();
1152		}
1153		custom_tc_events_global(this, _id, tc_datas);
1154	});*/
1155
1156	// PRODUCT COMPARATOR
1157	$('.tc_event_comparator').click(function(){
1158		custom_tc_events_global(this, 'productComparator_click', {'evt_category': 'productComparator','evt_button_action': 'productComparator_click' ,'evt_button_url': $(this).attr('href'), 'evt_product_id': '' + $(this).attr('product_ref')});
1159		if(showEventsInConsole) console.log("tc_events_global(this, 'productComparator_click', {'evt_category': 'productComparator','evt_button_action': 'productComparator_click','evt_button_url':" +  $(this).attr('href') + ",'evt_product_id': " + '' + $(this).attr('product_ref') + "});");
1160	});	
1161	
1162	// 360 VIEW PRODUCT
1163	$('.tc_event_product_360view_click').click(function(){
1164		attr_data_product_price = $(this).attr('data-product-price');
1165		if (typeof attr_data_product_price === 'undefined' || attr_data_product_price === false) {
1166			data_product_price = "";
1167		} else {
1168			data_product_price = attr_data_product_price.replace(/[^0-9.,]+/, '').replace(",", ".");
1169		}
1170		custom_tc_events_global(this, 'product_360view_click', {'evt_category': 'product','evt_button_action': '360view_click' ,'evt_product_id': '' + $(this).attr('data-product-ref'), 'evt_value': displayPrice(data_product_price), 'product_name': $(this).attr('data-product-name'), 'product_promotion': $(this).attr('data-product-promotion'), 'product_promotion_discount': $(this).attr('data-product-promotion-discount'), 'product_category': $(this).attr('data-product-category'), 'product_type': $(this).attr('data-product-type'), 'product_id_ecommerce': $(this).attr('data-product-id-ecommerce')});
1171		if(showEventsInConsole) console.log("tc_events_global(this, 'product_360view_click', {'evt_category': 'product','evt_button_action': '360view_click' ,'evt_product_id': " + '' + $(this).attr('data-product-ref')+", 'evt_value': "+displayPrice(data_product_price)+", 'product_name': "+$(this).attr('data-product-name')+", 'product_promotion': "+$(this).attr('data-product-promotion')+", 'product_promotion_discount': "+$(this).attr('data-product-promotion-discount')+", 'product_category': "+$(this).attr('data-product-category')+", 'product_type': "+$(this).attr('data-product-type')+", 'product_id_ecommerce': "+$(this).attr('data-product-id-ecommerce')+"});");
1172	});	
1173	
1174	// selfcare tutorial
1175	$("a.help_me-card").click(function(event) { 
1176		tc_datas = {
1177		'evt_category':   'product',
1178		'id':   'selfcare_tutorial',
1179		'evt_button_action':   'open_selfcare_tutorial',
1180		'evt_tutorial_label': $(this).data('title'),
1181		'evt_product_id' : '' + $(this).data('reference')
1182		};
1183		custom_tc_events_global(this, 'selfcare_tutorial', tc_datas);		
1184	});
1185	
1186	// breadcrumb
1187	$(".breadcrumb li a").click(function(event) { 
1188		tc_datas = {
1189			'evt_category':   'UX',
1190			'evt_button_action':   'breadcrumb_click',
1191			'evt_button_url': $(this).attr('href'),
1192			'evt_button_label' : $(this).find('span').text()
1193		};
1194		custom_tc_events_global(this, 'breadcrumb_click', tc_datas);		
1195	});
1196	//Zoom image click
1197	$('.product-main-info .product-visuals-new-slide button').click(function(){
1198		_id = 'product_interaction_click';
1199		tc_datas = {
1200			'evt_category':   'product',
1201			'evt_button_action':   'zoom_on_image_click'
1202		}
1203		
1204		$pdp_presentation = $(".product-main-info");
1205		if(typeof $pdp_presentation.data("product_ref") !== 'undefined') 		tc_datas.evt_product_id = '' + $pdp_presentation.data("product_ref");
1206		if(typeof $pdp_presentation.data("product_price") !== 'undefined') 		tc_datas.evt_value = displayPrice($pdp_presentation.data("product_price"));
1207		if(typeof $pdp_presentation.data("product_name") !== 'undefined') 		tc_datas.evt_product_name = $pdp_presentation.data("product_name");
1208		if(typeof $pdp_presentation.data("product_promotion") !== 'undefined') 		tc_datas.evt_product_promotion = $pdp_presentation.data("product_promotion");
1209		if(typeof $pdp_presentation.data("product_promotion_discount") !== 'undefined') 		tc_datas.evt_product_promotion_discount = displayPrice($pdp_presentation.data("product_promotion_discount"));
1210		if(typeof $pdp_presentation.data("product_category") !== 'undefined') 		tc_datas.evt_product_category = $pdp_presentation.data("product_category");
1211		if(typeof $pdp_presentation.data("product_stock") !== 'undefined') 		tc_datas.evt_product_stock = $pdp_presentation.data("product_stock");
1212		if(typeof $pdp_presentation.data("product_classification") !== 'undefined') 		tc_datas.evt_product_classification = $pdp_presentation.data("product_classification");
1213		if(typeof $pdp_presentation.data("product_id_ecommerce") !== 'undefined') 		tc_datas.evt_product_id_ecommerce = $pdp_presentation.data("product_id_ecommerce");
1214
1215		custom_tc_events_global(this, _id, tc_datas);
1216	});
1217
1218	//privates sales click 
1219	$('#privatesales a').click(function(){ 
1220		_id = 'product_interaction_click';
1221		tc_datas = {
1222			'evt_category':   'product',
1223			'evt_button_action':   'private_sales_click'
1224		}
1225		
1226		$pdp_presentation = $(".product-main-info");
1227		if(typeof $pdp_presentation.data("product_ref") !== 'undefined') 		tc_datas.evt_product_id = '' + $pdp_presentation.data("product_ref");
1228		if(typeof $pdp_presentation.data("product_price") !== 'undefined') 		tc_datas.evt_value = displayPrice($pdp_presentation.data("product_price"));
1229		if(typeof $pdp_presentation.data("product_name") !== 'undefined') 		tc_datas.evt_product_name = $pdp_presentation.data("product_name");
1230		if(typeof $pdp_presentation.data("product_promotion") !== 'undefined') 		tc_datas.evt_product_promotion = $pdp_presentation.data("product_promotion");
1231		if(typeof $pdp_presentation.data("product_promotion_discount") !== 'undefined') 		tc_datas.evt_product_promotion_discount = displayPrice($pdp_presentation.data("product_promotion_discount"));
1232		if(typeof $pdp_presentation.data("product_category") !== 'undefined') 		tc_datas.evt_product_category = $pdp_presentation.data("product_category");
1233		if(typeof $pdp_presentation.data("product_stock") !== 'undefined') 		tc_datas.evt_product_stock = $pdp_presentation.data("product_stock");
1234		if(typeof $pdp_presentation.data("product_classification") !== 'undefined') 		tc_datas.evt_product_classification = $pdp_presentation.data("product_classification");
1235		if(typeof $pdp_presentation.data("product_id_ecommerce") !== 'undefined') 		tc_datas.evt_product_id_ecommerce = $pdp_presentation.data("product_id_ecommerce");
1236		tc_datas.evt_button_url = $(this).attr('href');
1237
1238		custom_tc_events_global(this, _id, tc_datas);
1239	});
1240
1241	//marketplaces click 
1242	$('.product-marketplace-link').click(function(){ 
1243		_id = 'product_interaction_click';
1244		tc_datas = {
1245			'evt_category':   'product',
1246			'evt_button_action':   'purchase_on_marketplace'
1247		}
1248		
1249		$pdp_presentation = $(".product-main-info");
1250		if(typeof $pdp_presentation.data("product_ref") !== 'undefined') 		tc_datas.evt_product_id = '' + $pdp_presentation.data("product_ref");
1251		if(typeof $pdp_presentation.data("product_price") !== 'undefined') 		tc_datas.evt_value = displayPrice($pdp_presentation.data("product_price"));
1252		if(typeof $pdp_presentation.data("product_name") !== 'undefined') 		tc_datas.evt_product_name = $pdp_presentation.data("product_name");
1253		if(typeof $pdp_presentation.data("product_promotion") !== 'undefined') 		tc_datas.evt_product_promotion = $pdp_presentation.data("product_promotion");
1254		if(typeof $pdp_presentation.data("product_promotion_discount") !== 'undefined') 		tc_datas.evt_product_promotion_discount = displayPrice($pdp_presentation.data("product_promotion_discount"));
1255		if(typeof $pdp_presentation.data("product_category") !== 'undefined') 		tc_datas.evt_product_category = $pdp_presentation.data("product_category");
1256		if(typeof $pdp_presentation.data("product_stock") !== 'undefined') 		tc_datas.evt_product_stock = $pdp_presentation.data("product_stock");
1257		if(typeof $pdp_presentation.data("product_classification") !== 'undefined') 		tc_datas.evt_product_classification = $pdp_presentation.data("product_classification");
1258		if(typeof $pdp_presentation.data("product_id_ecommerce") !== 'undefined') 		tc_datas.evt_product_id_ecommerce = $pdp_presentation.data("product_id_ecommerce");
1259		tc_datas.evt_button_url = $(this).attr('href');
1260		tc_datas.evt_marketplace_name = $(this).data("marketplace_name");
1261
1262		custom_tc_events_global(this, _id, tc_datas);
1263	});
1264
1265	//tracking lead 2026
1266	$(".somfy").on("click",".tc_event_start_request, .tc_event_add_details.-active, .tc_event_add_new_equipment, .tc_event_next_button_1, .tc_event_next_button_2, .tc_event_my_ongoing_quotes", function(event) {
1267		var tc_datas = {
1268		'evt_category':  'lead',
1269		'id':   'lead',
1270		};
1271		tc_datas.evt_form_label ='';
1272		if(typeof $('.devis').data('projecttype') !== 'undefined') {
1273			if($('.devis').data('projecttype') == "quote") {
1274				var project_type = "project_lead";
1275			} else {
1276				var project_type = 'assistance_lead';
1277			}
1278			tc_datas.evt_form_label = project_type;
1279		}
1280
1281		if($(this).hasClass('tc_event_start_request')) {
1282			tc_datas.evt_button_label = "step_0";
1283			tc_datas.evt_button_action = "lead_form_progress";
1284		} else if($(this).hasClass('tc_event_add_details')) {
1285			tc_datas.evt_button_label = "step_1";
1286			tc_datas.evt_button_action = "add_details";
1287		} else if($(this).hasClass('tc_event_add_new_equipment')) {
1288			tc_datas.evt_button_label = "step_1";
1289			tc_datas.evt_button_action = "add_equipments";
1290		} else if($(this).hasClass('tc_event_next_button_1')) {
1291			tc_datas.evt_button_label = "step_1";
1292			tc_datas.evt_button_action = "lead_form_progress";
1293		} else if($(this).hasClass('tc_event_next_button_2')) {
1294			tc_datas.evt_button_label = "step_2";
1295			tc_datas.evt_button_action = "lead_form_progress";
1296		} else if($(this).hasClass('tc_event_my_ongoing_quotes')) {
1297			tc_datas.evt_button_label = "step_4";
1298			tc_datas.evt_button_action = "track_my_quotes_click";
1299		}
1300
1301		custom_tc_events_global(this, 'lead', tc_datas);	
1302		if(showEventsInConsole) console.log("tc_events_global called with data:" , tc_datas);
1303	});
1304
1305	//tracking lead - select equipment
1306	$(".somfy .devis select[name='equipment']").on("change", function(event) {
1307		var tc_datas = {
1308			'evt_category':  'lead',
1309			'id':   'lead',
1310			};
1311		tc_datas.evt_form_label ='';
1312		if(typeof $('.devis').data('projecttype') !== 'undefined') {
1313			if($('.devis').data('projecttype') == "quote") {
1314				var project_type = "project_lead";
1315			} else {
1316				var project_type = 'assistance_lead';
1317			}
1318			tc_datas.evt_form_label = project_type;
1319		}
1320		tc_datas.evt_button_label = "step_1",
1321		tc_datas.evt_button_action = "select_equipment"
1322		
1323		custom_tc_events_global(this, 'lead', tc_datas);
1324		if(showEventsInConsole) console.log("tc_events_global called with data:" , tc_datas);
1325	});
1326	
1327}
1328
1329function tc_product_event_click($this) {
1330	var _id = "product_click";
1331	var _category = "product_listing";
1332	if(typeof $this.data('id') !== 'undefined' ) {
1333		_id =  $this.data('id');
1334	}
1335	if(typeof $this.data('category') !== 'undefined' ) {
1336		_category =  $this.data('category');
1337	}
1338	if($this.closest('.tc_section_accessories').length) {
1339		_cross_sell_type = "accessories";
1340	} else if($this.closest('.tc_section_spare_parts').length) {
1341		_cross_sell_type = "spare_parts";
1342	} else if($this.closest('.tc_section_last_product_visited').length) {
1343		_cross_sell_type = "last_visited_products";
1344	} else if($this.closest('.tc_section_nosto').length) {
1345		_cross_sell_type = "recommendation_nosto";
1346	}
1347	tc_datas = {
1348		'evt_category':  _category
1349	}
1350	if(typeof _cross_sell_type !== 'undefined' ) {
1351		tc_datas.evt_cross_sell_type = _cross_sell_type;
1352	} 
1353	if(typeof $this.data('url') !== 'undefined' ) {
1354		tc_datas.evt_button_url = $this.data('url');
1355	} else if( typeof $this.attr('href') !== 'undefined') {
1356		tc_datas.evt_button_url = $this.attr('href');
1357	}
1358	if(typeof $this.data('ref') !== 'undefined' ) {
1359		tc_datas.evt_product_id = '' + $this.data('ref');
1360	} else if(typeof $this.data('reference') !== 'undefined' ) {
1361		tc_datas.evt_product_id = '' + $this.data('reference');
1362	} else if(typeof $this.data('product-sku') !== 'undefined' ) {
1363		tc_datas.evt_product_id = '' + $this.data('product-sku');
1364	}
1365	if(typeof $this.data("label") !== 'undefined') 		tc_datas.evt_button_label = $this.data("label");
1366	if(typeof $this.data("action") !== 'undefined') 		tc_datas.evt_button_action = $this.data("action");
1367	if(typeof $this.data("retailer") !== 'undefined') 	tc_datas.evt_retailer_name = $this.data("retailer");
1368	if(typeof $this.data("price") !== 'undefined') 		tc_datas.evt_value = displayPrice($this.data("price"));
1369	if(typeof $this.data("promotion") !== 'undefined') 		tc_datas.evt_product_promotion = $this.data("promotion");
1370	if(typeof $this.data("promotion_discount") !== 'undefined') 		tc_datas.evt_product_promotion_discount = displayPrice($this.data("promotion_discount"));
1371	if(typeof $this.data("product_category") !== 'undefined') 		tc_datas.evt_product_category = $this.data("product_category");
1372	if(typeof $this.data("product_name") !== 'undefined') 		tc_datas.evt_product_name = $this.data("product_name");
1373	if(typeof $this.data("product_type") !== 'undefined') 		tc_datas.evt_product_type = $this.data("product_type");
1374	if(typeof $this.data("product_id_ecommerce") !== 'undefined') 		tc_datas.evt_product_id_ecommerce = $this.data("product_id_ecommerce");
1375	if(typeof $this.data("product_stock") !== 'undefined') 		tc_datas.evt_product_stock = $this.data("product_stock");
1376	if(typeof $this.data("product_classification") !== 'undefined') 		tc_datas.evt_product_classification = $this.data("product_classification");
1377	if(typeof $this.data("product_quantity") !== 'undefined') 		tc_datas.evt_product_quantity = parseInt($this.data("product_quantity"));
1378	if(typeof $this.data("product_bundle") !== 'undefined') 		tc_datas.evt_product_bundle = $this.data("product_bundle");
1379	
1380	custom_tc_events_global($this, _id, tc_datas);
1381}
1382
1383
1384function lead_form_next_button_click($next_button) {
1385	if(typeof $next_button.attr('data-current-step') !== 'undefined' && $next_button.attr('data-current-step') !== false && $.isNumeric($next_button.attr('data-current-step'))) {
1386		next_step_number = parseInt($next_button.attr('data-current-step')) + 1;
1387		data_lead_type = $next_button.attr('data-lead-type');
1388		custom_tc_events_global(this, 'lead_stepClick', {'evt_category': 'lead','evt_button_action': 'goToStep' + next_step_number + '_click', 'evt_form_label': data_lead_type});
1389	}	
1390}
1391
1392function dl_click(el) {
1393	/* console.log(">>>dl_click"); */
1394	if(typeof el.attr('data-action') !== 'undefined') {
1395		tc_datas = {
1396				'evt_category':   'dealerlocator',
1397				'evt_button_action': el.attr('data-action')
1398			}
1399		if(typeof el.data('partnerid') !== 'undefined') {
1400			tc_datas.evt_partner_id = el.data('partnerid');
1401		} else if ( typeof el.parents('.dealer-container').attr("partnerid") !== 'undefined') {
1402			tc_datas.evt_partner_id = el.parents('.dealer-container').attr("partnerid");
1403		}
1404		if(typeof el.data('partnername') !== 'undefined') {
1405			tc_datas.evt_partner_name = el.data('partnername');
1406		} else if ( typeof el.parents('.dealer-container').attr("partnername") !== 'undefined') {
1407			tc_datas.evt_partner_name = el.parents('.dealer-container').attr("partnername");
1408		}
1409		if(typeof el.data('url') !== 'undefined' ) {
1410			tc_datas.evt_button_url = el.data('url');
1411		}
1412		if(typeof el.data('eventid') !== 'undefined') {
1413			eventID = el.data('eventid');
1414		} else {
1415			eventID = 'dealerlocator';
1416		}
1417		custom_tc_events_global(this, eventID, tc_datas);
1418	}
1419}
1420function block_click(){	
1421	$("a.tc_block_click").bind("click",function(event) {
1422		custom_tc_events_global(this, 'block_click', {'evt_category': 'UX','evt_button_action': $(this).attr('data-action'),'evt_button_url': $(this).attr('href')});
1423		if(showEventsInConsole) console.log("tc_events_global(this, 'UX', {'evt_category': 'block_click','evt_button_action': " + $(this).attr('data-action') + ",'evt_button_url': " + $(this).attr('href') + "});");
1424	});
1425}
1426
1427function unbind_block_click(){	
1428	$("a.tc_block_click").unbind("click",function(event) {
1429		custom_tc_events_global(this, 'block_click', {'evt_category': 'UX','evt_button_action': $(this).attr('data-action'),'evt_button_url': $(this).attr('href')});
1430	});
1431}
1432
1433/*function dealerLocatorTracking(event) {
1434	// DL
1435	if($(event).parents('.dealer-content-more-infos').length > 0) {
1436		var $elParent = $(event).parents('.dealer-content-more-infos');
1437	} else {
1438		var $elParent = $(event).parent().parent();
1439	}
1440	custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': $(event).attr('data-action'),'evt_partner_id': $elParent.attr("partnerid"),'evt_partner_name': $elParent.attr("partnername")});
1441}*/
1442
1443function evtsearch(event){
1444	var evt_category = "";
1445	if(typeof $(event).data('origin') !== 'undefined' && ($(event).data('origin') == "search_products" || $(event).data('origin') == "search_other")) {
1446		var evt_category = "search";
1447	}
1448	custom_tc_events_global(this, 'search_click', {'evt_button_label': $(event).data('label'),'evt_button_url': $(event).attr('href'),'evt_button_action': $(event).data('origin'),'evt_category': evt_category});
1449}
1450
1451function mapClickEvents(obj,source){
1452	if(typeof(source) === 'undefined') {
1453		console.log('mapClickEvents(undefined)');
1454	} else {
1455		var partner_id = $("#"+ obj).attr("partnerid");
1456		var partner_name = $("#"+ obj).attr("partnername");
1457		custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': s
1457ource,'evt_partner_id': partner_id,'evt_partner_name': partner_name});
1458	}
1459}
1460
1461function noResultsClickEvents(){
1462	var error_url = window.location.href;
1463	custom_tc_events_global(this, 'error_dealerlocator', {'evt_category': 'error','evt_error_code': 'search_unsuccess','evt_error_url': error_url});
1464}
1465
1466//RP BLOC CONVERSION
1467function setBlocConverstionEvents(_type, _element, _label, _id, _country, _postcode, _url){
1468
1469	switch(_type){
1470		case "lead":
1471			custom_tc_events_global(_element, "lead", {"evt_form_label":_label, "evt_form_id":_id});
1472			break;
1473		case "dealerlocator":
1474			custom_tc_events_global(_element, "dealerlocator", {"evt_category":"dealerlocator", "evt_button_action":"searchbutton_click", "evt_search_country":_country, "evt_search_postcode":_postcode});
1475			break;
1476		case "eshop":
1477			custom_tc_events_global(_element, "shopblock", {"evt_category":"UX", "evt_button_action":"shopblock_click", "evt_button_url":_url});
1478			break;
1479		case "global":
1480			custom_tc_events_global(_element, "formconversion_block", {"evt_category":"UX", "evt_button_action":"conversionblock_click", "evt_button_url":_url});
1481			break;
1482	}
1483
1484}
1485
1486//DEALER LOCATOR SEARCH
1487function setDealerLocatorSearchEvents(){
1488	var evt_search_city = $('#findCustomersForm #cityField').val();
1489	var evt_search_postcode = $('#findCustomersForm #zipCodeField').val().trim();
1490	var evt_search_product = tc_vars["search_product"];
1491	if($('#findCustomersForm #selectCountry').is('select')) {
1492		var evt_search_country = $('#findCustomersForm #selectCountry option:selected').attr('isocode').toUpperCase();
1493	} else {
1494		var evt_search_country = $('#findCustomersForm #selectCountry').data('country').toUpperCase();
1495	}
1496	
1497	custom_tc_events_global(this, 'dealerlocator', {'evt_category': 'dealerlocator','evt_button_action': 'searchbutton_click','evt_search_city': evt_search_city,'evt_search_postcode': evt_search_postcode,'evt_search_product': evt_search_product,'evt_search_country': evt_search_country});
1498}
1499
1500function setTagCommanderJSVars(_form){
1501	if(typeof _form.data('label') != 'undefined' ) {
1502		var evt_form_label = _form.data('label');
1503		var mail = _form.find("input[name=email4newsletter]").val();
1504	}else if(typeof _form.parents(".form_assembly").data('label') != 'undefined'){
1505		var evt_form_label = _form.parents(".form_assembly").data('label');;
1506		var mail = _form.find("#tfa_1").val();
1507	}else{
1508		var evt_form_label = _form.find("input[name=form_type]").val();
1509		var mail = _form.find("input[name=email]").val();
1510	}
1511	
1512	var evt_category_form = '';
1513	if (evt_form_label == 'perfoweb-aftersales') {
1514		var label = 'assistance_lead';
1515		var formlab = 'lead'
1516	} else if (evt_form_label == 'leadmanagement') {
1517		var label = 'project_lead';
1518		var formlab = 'lead'
1519		var evt_category_form = 'lead';
1520	} else if (evt_form_label == 'perfoweb-project') {
1521		var label = 'project_lead';
1522		var formlab = 'lead'
1523		var evt_category_form = 'lead';
1524	} else if (evt_form_label == 'myaccount_susbcription') {
1525		var label = 'myaccount_susbcription';
1526		var formlab = 'form'
1527		var mail = _form.find("input[name=user_email]").val()
1528	} else if (evt_form_label == 'newsletter' || evt_form_label == 'newsletter_subscription') {
1529		var label = 'newsletter_subscription';
1530		var formlab = 'form';
1531		var evt_form_name = _form.find("input[name=lname]").val();
1532		var evt_form_firstname = _form.find("input[name=fname]").val();
1533		var evt_newsletter_email = _form.find("input[name=email4newsletter]").val();
1534	} else if (evt_form_label == 'dealerlocator') {
1535		var label = 'contactdealer_sent';
1536		var formlab = 'form_dealer';
1537		var formProduct = tc_vars['page_cat_name'];
1538		var evt_category_form = 'dealerlocator';
1539	}else {
1540		var label = 'contactus_sent';
1541		var formlab = 'form'
1542	}
1543	var email = md5(mail).toUpperCase();
1544	var _marketing_optin = _form.find("input[name=marketing_optin]");
1545	var form_marketing_optin = _marketing_optin.length > 0 && _marketing_optin.is(":checked");
1546	
1547	if(typeof formProduct != 'undefined') {
1548		custom_tc_events_global(this, formlab, {
1549			'evt_form_label': label,
1550			'evt_form_product': formProduct,
1551			'evt_form_id': email,
1552			'evt_category': evt_category_form
1553		});
1554	} else if(typeof evt_newsletter_email != 'undefined') {
1555		custom_tc_events_global(this, formlab, {'evt_form_label': label,'evt_form_id': email, 'evt_newsletter_email': evt_newsletter_email, 'evt_form_firstname': evt_form_firstname, 'evt_form_name': evt_form_name,'evt_category': evt_category_form, 'form_marketing_optin': true});
1556	} else {
1557		custom_tc_events_global(this, formlab, {'evt_form_label': label,'evt_form_id': email,'evt_category': evt_category_form,'form_marketing_optin': form_marketing_optin});
1558		// Also send event to GTM
1559		try {
1560			dataLayer.push({'event':'GTM-'+formlab, 'evt_form_label': label, 'evt_form_id': email});
1561			console.log('GTM event sent:');
1562			console.log("dataLayer.push({'event':'GTM-"+formlab+"', 'evt_form_label': '"+label+"', 'evt_form_id': '"+email+"'});");
1563		}
1564		catch(error) {
1565			console.log('Error with GTM event:');
1566		  console.log(error);
1567		}
1568	}
1569	/*
1570	var tagRequest = {dataType:"json", url: pageAjaxURL + "?targetFunction=GetEncodedStringMD5&targetComponent=ajax&sitename="+pageSitename+"&stringToHash="+mail+"&plugin=TagCommander",method:"POST",async:false};
1571	tagRequest.success = function(data) {
1572		if(data) {
1573			var email = data.encodedvalue;
1574			if(typeof formProduct != 'undefined') {
1575				custom_tc_events_global(this, formlab, {'evt_form_label': label,'evt_form_product': formProduct,'evt_form_id': email});
1576			} else {
1577				custom_tc_events_global(this, formlab, {'evt_form_label': label,'evt_form_id': email});
1578    			// Also send event to GTM
1579    			try {
1580    				dataLayer.push({'event':'GTM-'+formlab, 'evt_form_label': label, 'evt_form_id': email});
1581					console.log('GTM event sent:');
1582					console.log("dataLayer.push({'event':'GTM-"+formlab+"', 'evt_form_label': '"+label+"', 'evt_form_id': '"+email+"'});");
1583				}
1584				catch(error) {
1585  				  console.log('Error with GTM event:');
1586				  console.log(error);
1587				}
1588			}
1589		}
1590	};
1591	tagRequest.error = function(data) { };
1592	jQuery.ajax(tagRequest);
1593	*/
1594}
1595
1596function capitalizeFirstLetter(string) {
1597	return string.charAt(0).toUpperCase() + string.slice(1);
1598}
1599
1600!function(n){"use strict";function d(n,t){var r=(65535&n)+(65535&t);return(n>>16)+(t>>16)+(r>>16)<<16|65535&r}function f(n,t,r,e,o,u){return d(function(n,t){return n<<t|n>>>32-t}(d(d(t,n),d(e,u)),o),r)}function l(n,t,r,e,o,u,c){return f(t&r|~t&e,n,t,o,u,c)}function g(n,t,r,e,o,u,c){return f(t&e|r&~e,n,t,o,u,c)}function v(n,t,r,e,o,u,c){return f(t^r^e,n,t,o,u,c)}function m(n,t,r,e,o,u,c){return f(r^(t|~e),n,t,o,u,c)}function i(n,t){var r,e,o,u,c;n[t>>5]|=128<<t%32,n[14+(t+64>>>9<<4)]=t;var f=1732584193,i=-271733879,a=-1732584194,h=271733878;for(r=0;r<n.length;r+=16)i=m(i=m(i=m(i=m(i=v(i=v(i=v(i=v(i=g(i=g(i=g(i=g(i=l(i=l(i=l(i=l(o=i,a=l(u=a,h=l(c=h,f=l(e=f,i,a,h,n[r],7,-680876936),i,a,n[r+1],12,-389564586),f,i,n[r+2],17,606105819),h,f,n[r+3],22,-1044525330),a=l(a,h=l(h,f=l(f,i,a,h,n[r+4],7,-176418897),i,a,n[r+5],12,1200080426),f,i,n[r+6],17,-1473231341),h,f,n[r+7],22,-45705983),a=l(a,h=l(h,f=l(f,i,a,h,n[r+8],7,1770035416),i,a,n[r+9],12,-1958414417),f,i,n[r+10],17,-42063),h,f,n[r+11],22,-1990404162),a=l(a,h=l(h,f=l(f,i,a,h,n[r+12],7,1804603682),i,a,n[r+13],12,-40341101),f,i,n[r+14],17,-1502002290),h,f,n[r+15],22,1236535329),a=g(a,h=g(h,f=g(f,i,a,h,n[r+1],5,-165796510),i,a,n[r+6],9,-1069501632),f,i,n[r+11],14,643717713),h,f,n[r],20,-373897302),a=g(a,h=g(h,f=g(f,i,a,h,n[r+5],5,-701558691),i,a,n[r+10],9,38016083),f,i,n[r+15],14,-660478335),h,f,n[r+4],20,-405537848),a=g(a,h=g(h,f=g(f,i,a,h,n[r+9],5,568446438),i,a,n[r+14],9,-1019803690),f,i,n[r+3],14,-187363961),h,f,n[r+8],20,1163531501),a=g(a,h=g(h,f=g(f,i,a,h,n[r+13],5,-1444681467),i,a,n[r+2],9,-51403784),f,i,n[r+7],14,1735328473),h,f,n[r+12],20,-1926607734),a=v(a,h=v(h,f=v(f,i,a,h,n[r+5],4,-378558),i,a,n[r+8],11,-2022574463),f,i,n[r+11],16,1839030562),h,f,n[r+14],23,-35309556),a=v(a,h=v(h,f=v(f,i,a,h,n[r+1],4,-1530992060),i,a,n[r+4],11,1272893353),f,i,n[r+7],16,-155497632),h,f,n[r+10],23,-1094730640),a=v(a,h=v(h,f=v(f,i,a,h,n[r+13],4,681279174),i,a,n[r],11,-358537222),f,i,n[r+3],16,-722521979),h,f,n[r+6],23,76029189),a=v(a,h=v(h,f=v(f,i,a,h,n[r+9],4,-640364487),i,a,n[r+12],11,-421815835),f,i,n[r+15],16,530742520),h,f,n[r+2],23,-995338651),a=m(a,h=m(h,f=m(f,i,a,h,n[r],6,-198630844),i,a,n[r+7],10,1126891415),f,i,n[r+14],15,-1416354905),h,f,n[r+5],21,-57434055),a=m(a,h=m(h,f=m(f,i,a,h,n[r+12],6,1700485571),i,a,n[r+3],10,-1894986606),f,i,n[r+10],15,-1051523),h,f,n[r+1],21,-2054922799),a=m(a,h=m(h,f=m(f,i,a,h,n[r+8],6,1873313359),i,a,n[r+15],10,-30611744),f,i,n[r+6],15,-1560198380),h,f,n[r+13],21,1309151649),a=m(a,h=m(h,f=m(f,i,a,h,n[r+4],6,-145523070),i,a,n[r+11],10,-1120210379),f,i,n[r+2],15,718787259),h,f,n[r+9],21,-343485551),f=d(f,e),i=d(i,o),a=d(a,u),h=d(h,c);return[f,i,a,h]}function a(n){var t,r="",e=32*n.length;for(t=0;t<e;t+=8)r+=String.fromCharCode(n[t>>5]>>>t%32&255);return r}function h(n){var t,r=[];for(r[(n.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var e=8*n.length;for(t=0;t<e;t+=8)r[t>>
16005]|=(255&n.charCodeAt(t/8))<<t%32;return r}function e(n){var t,r,e="0123456789abcdef",o="";for(r=0;r<n.length;r+=1)t=n.charCodeAt(r),o+=e.charAt(t>>>4&15)+e.charAt(15&t);return o}function r(n){return unescape(encodeURIComponent(n))}function o(n){return function(n){return a(i(h(n),8*n.length))}(r(n))}function u(n,t){return function(n,t){var r,e,o=h(n),u=[],c=[];for(u[15]=c[15]=void 0,16<o.length&&(o=i(o,8*n.length)),r=0;r<16;r+=1)u[r]=909522486^o[r],c[r]=1549556828^o[r];return e=i(u.concat(h(t)),512+8*t.length),a(i(c.concat(e),640))}(r(n),r(t))}function t(n,t,r){return t?r?u(t,n):function(n,t){return e(u(n,t))}(t,n):r?o(n):function(n){return e(o(n))}(n)}"function"==typeof define&&define.amd?define(function(){return t}):"object"==typeof module&&module.exports?module.exports=t:n.md5=t}(this);
1601
1602
1603function custom_tc_events_global(_this, _actiontype, _datas) {
1604	try {
1605			if (typeof tc_events_global === "function") {
1606				tc_events_global(_this, _actiontype , _datas);
1607			}
1608		} catch(error) {
1609			console.log('Error on custom_tc_events_global');
1610			console.log(error);
1611		}
1612}

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.