PageSourceSearch

https://www.fonic.de/etc.clientlibs/raittcore/components/page/v1/p…r.lc-4609ce6b4006cd4f0be8c8d2efd4c223-lc.js

js fonic.de collected 2026-09-30 21:08:06 UTC 41,990 bytes, 771 lines download raw bytes

1var teasersLoadTriggered = [];
2function getLoadIsTriggered(teaser) {
3  return teasersLoadTriggered.indexOf(teaser) > -1;
4}
5
6function checkVisible(elm) {
7  var rect = elm.getBoundingClientRect();
8  var elmQuarterHeight = Math.floor(elm.offsetHeight / 4);
9  var viewHeight = Math.max(document.documentElement.clientHeight, window.innerHeight);
10  return !(rect.bottom - elmQuarterHeight < 0 || rect.top - viewHeight + elmQuarterHeight >= 0);
11}
12
13function isInsideSlider(elm) {
14  return jQuery(elm).closest('one-carousel').length > 0;
15}
16
17//One-Carousel available or not check
18function isInsideCarousel(elm) {
19  return jQuery(elm).closest('one-carousel').length > 0;
20}
21
22function initializeHandlers() {
23  if(document.querySelectorAll('.data-layer') && document.querySelectorAll('.data-layer').length > 0) {
24    Array.from(document.querySelectorAll('.data-layer')).forEach((dataL) => {
25      const buttonClass = document.querySelectorAll('.targetClass_teaser-button')
26      var el = document.getElementsByClassName('targetClass_teaser-button')
27      const dataLayerClass = document.querySelectorAll('.data-layer')
28      for (var j = 0; j < dataLayerClass.length; j++) {
29        if(buttonClass && buttonClass.length > 0) {
30          for (var i = 0; i < buttonClass.length; i++) {
31            if (dataLayerClass[j]) {
32              if (dataLayerClass[j].getAttribute("data-ctatext") == buttonClass[i].getAttribute("datalayertext")) {
33                const clickFunctionName = dataLayerClass[j].getAttribute('data-clickEvent');
34                const loadFunctionName = dataLayerClass[j].getAttribute('data-onload');
35                var productRelation = dataLayerClass[j].getAttribute('data-product-relation');
36                const teaser = document.querySelector('.targetClass_teaser-container');
37                const buttonsTarget = teaser.querySelectorAll('.targetClass_teaser-button');
38                const buttonCount = buttonsTarget.length;
39                let dataLayerSpecific = '';
40                const pageName = $("#gtm-page-prop").attr("data-pagename");
41                Array.from(document.querySelectorAll('.targetClass_teaser-container')).forEach((teaserButton) => {
42                  const buttons = teaserButton.querySelectorAll('.targetClass_teaser-button');
43                  const buttLeng = buttons.length;
44                  Array.from(buttons).forEach((button) => {
45                    jQuery(button).off('click.btn').on('click.btn', () => {
46                      if (clickFunctionName) {
47                        const datalayerButtonName = button.getAttribute('datalayertext');
48                        for (var i = 0; i < dataLayerClass.length; i++) {
49                          if (dataLayerClass[i].getAttribute("data-ctatext") === datalayerButtonName) {
50                            productRelation = dataLayerClass[i].getAttribute('data-product-relation');
51                            dataLayerSpecific = dataLayerClass[i];
52                          }
53                        }
54                        window[clickFunctionName].call(this, buttonClass, dataLayerSpecific, buttonCount, productRelation, datalayerButtonName, pageName, buttLeng);
55                      }
56                    });
57                  });
58                });
59                if (document.querySelectorAll('one-carousel') || checkVisible(teaser)) {
60                  if (loadFunctionName && !getLoadIsTriggered(teaser)) {
61                    let dataLength;
62                    if (isInsideSlider(teaser)) {
63                      Array.from(document.querySelectorAll('one-carousel')).forEach((teaser) => {
64                        const carousel = jQuery(teaser).closest('one-carousel')[0];
65                        $('one-carousel .nds-carousel:first').addClass('carousel-active');
66                        var leng = $(".carousel-active").find(".targetClass_teaser-button").length;
67                        $('one-carousel .nds-carousel:first').attr("data-button-count", leng);
68                        dataLength = $('.carousel-active').attr("data-button-count");
69                        $(".nds-carousel .targetClass_teaser-button").each(function(index) {
70                          $(this).attr("data-button-index", index + 1);
71                        });
72                        $(".targetClass_teaser-container").each(function(index) {
73                          $(this).attr("data-teaser-index", index);
74                        });
75
76						$(carousel).on('focus', function(e) {
77							  setTimeout(()=> {
78								  let dataSlide = '';
79								  dataSlide = e.target.__currentPage;
80								  var myInt = parseInt(dataSlide) + 1;
81								  $('one-carousel .nds-carousel:nth-child(' + myInt + ')').toggleClass('carousel-active').siblings().removeClass('carousel-active');
82								  dataLength = $('.carousel-active').prev().attr("data-length");
83								  for (var i = 1; i <= document.querySelectorAll('.targetClass_teaser-container').length; i++) {
84									$(".carousel-active").attr("data-button-count", $(".carousel-active").find(".targetClass_teaser-button").length);
85								  }
86
87								  window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
88								  teasersLoadTriggered.push(teaser);
89                                }, 1000)
90						});
91                      })
92                      window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
93                      teasersLoadTriggered.push(teaser);
94                    } else if (isInsideCarousel(teaser)) {
95                        Array.from(document.querySelectorAll('one-carousel')).forEac
95h((teaser) => {
96                          const carousel = jQuery(teaser).closest('one-carousel')[0];
97                          $('one-carousel > .cmp-container:first').addClass('carousel-active');
98                          var leng = $(".carousel-active").find(".targetClass_teaser-button").length;
99                          $('one-carousel > .cmp-container:first').attr("data-button-count", leng);
100                          dataLength = $('.carousel-active').attr("data-button-count");
101                          $('.cmp-container .targetClass_teaser-button').each(function(index) {
102                              $(this).attr("data-button-index", index + 1);
103                          });
104
105                          $(".targetClass_teaser-container").each(function(index) {
106                            $(this).attr("data-teaser-index", index);
107                          });
108
109                          //One Carousel on slide to trigger datalayer
110                          $(carousel).on('slide', function(e){
111                            setTimeout(()=> {
112                              let dataSlide = '';
113							  dataSlide = e.target.__currentPage;
114                              var myInt = parseInt(dataSlide) + 1;
115                              $('one-carousel > .cmp-container:nth-child(' + myInt + ')').toggleClass('carousel-active').siblings().removeClass('carousel-active');
116                              dataLength = $('.carousel-active').prev().attr("data-length");
117                              for (var i = 1; i <= document.querySelectorAll('.targetClass_teaser-container').length; i++) {
118                                $(".carousel-active").attr("data-button-count", $(".carousel-active").find(".targetClass_teaser-button").length);
119                              }
120
121                              window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
122                              teasersLoadTriggered.push(teaser);
123                            }, 1000)
124                          });
125                      })
126                      window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
127                      teasersLoadTriggered.push(teaser);
128                    } else {
129                      $(".targetClass_teaser-container").addClass('carousel-active');
130                      var leng = $(".targetClass_teaser-container").find(".targetClass_teaser-button").length;
131                      $('.targetClass_teaser-container').attr("data-button-count", leng);
132                      dataLength = $('.targetClass_teaser-container').attr("data-button-count");
133                      $(".targetClass_teaser-container .targetClass_teaser-button").each(function(index) {
134                        $(this).attr("data-button-index", index + 1);
135                      });
136                      $(".targetClass_teaser-container").each(function(index) {
137                        $(this).attr("data-teaser-index", index);
138                      });
139                      if (dataLength == undefined) {
140                        window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName);
141                        teasersLoadTriggered.push(teaser);
142                      } else {
143                        window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
144                        teasersLoadTriggered.push(teaser);
145                      }
146                    }
147                  }
148                }
149              }
150            }
151          }
152        } else {
153          const clickFunctionName = dataLayerClass[j].getAttribute('data-clickEvent');
154          const loadFunctionName = dataLayerClass[j].getAttribute('data-onload');
155          var productRelation = dataLayerClass[j].getAttribute('data-product-relation');
156          const teaser = document.querySelector('.targetClass_teaser-container');
157          const buttonsTarget = teaser.querySelectorAll('.targetClass_teaser-button');
158          const buttonCount = buttonsTarget.length;
159          let dataLayerSpecific = '';
160          const pageName = $("#gtm-page-prop").attr("data-pagename");
161          if (document.querySelectorAll('one-carousel') || checkVisible(teaser)) {
162            if (loadFunctionName && !getLoadIsTriggered(teaser)) {
163              let dataLength;
164              if (isInsideSlider(teaser)) {
165                Array.from(document.querySelectorAll('one-carousel')).forEac
165h((teaser) => {
166                  const carousel = jQuery(teaser).closest('one-carousel')[0];
167                  $('one-carousel .nds-carousel:first').addClass('carousel-active');
168                  var leng = $(".carousel-active").find(".targetClass_teaser-button").length;
169                  $('one-carousel .nds-carousel:first').attr("data-button-count", leng);
170                  dataLength = $('.carousel-active').attr("data-button-count");
171                  $(".nds-carousel .targetClass_teaser-button").each(function(index) {
172                    $(this).attr("data-button-index", index + 1);
173                  });
174                  $(".targetClass_teaser-container").each(function(index) {
175                    $(this).attr("data-teaser-index", index);
176                  });
177
178				  $(carousel).on('focus', function(e) {
179							  setTimeout(()=> {
180								  let dataSlide = '';
181								  dataSlide = e.target.__currentPage;
182								  var myInt = parseInt(dataSlide) + 1;
183								  $('one-carousel .nds-carousel:nth-child(' + myInt + ')').toggleClass('carousel-active').siblings().removeClass('carousel-active');
184								  dataLength = $('.carousel-active').prev().attr("data-length");
185								  for (var i = 1; i <= document.querySelectorAll('.targetClass_teaser-container').length; i++) {
186									$(".carousel-active").attr("data-button-count", $(".carousel-active").find(".targetClass_teaser-button").length);
187								  }
188
189								  window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
190								  teasersLoadTriggered.push(teaser);
191                                }, 1000)
192						});
193                })
194                window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
195                teasersLoadTriggered.push(teaser);
196              } else if (isInsideCarousel(teaser)) {
197                  Array.from(document.querySelectorAll('one-carousel')).forEach((teaser) => {
198                    const carousel = jQuery(teaser).closest('one-carousel')[0];
199                    $('one-carousel > .cmp-container:first').addClass('carousel-active');
200                    var leng = $(".carousel-active").find(".targetClass_teaser-button").length;
201                    $('one-carousel > .cmp-container:first').attr("data-button-count", leng);
202                    dataLength = $('.carousel-active').attr("data-button-count");
203                    $('.cmp-container .targetClass_teaser-button').each(function(index) {
204                        $(this).attr("data-button-index", index + 1);
205                    });
206
207                    $(".targetClass_teaser-container").each(function(index) {
208                      $(this).attr("data-teaser-index", index);
209                    });
210
211                    //One Carousel on slide to trigger datalayer
212                    $(carousel).on('slide', function(e){
213                      setTimeout(()=> {
214                        let dataSlide = '';
215						dataSlide = e.target.__currentPage;
216                        var myInt = parseInt(dataSlide) + 1;
217                        $('one-carousel > .cmp-container:nth-child(' + myInt + ')').toggleClass('carousel-active').siblings().removeClass('carousel-active');
218                        dataLength = $('.carousel-active').prev().attr("data-length");
219                        for (var i = 1; i <= document.querySelectorAll('.targetClass_teaser-container').length; i++) {
220                          $(".carousel-active").attr("data-button-count", $(".carousel-active").find(".targetClass_teaser-button").length);
221                        }
222
223                        window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
224                        teasersLoadTriggered.push(teaser);
225                      }, 1000)
226                    });
227                })
228                window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
229                teasersLoadTriggered.push(teaser);
230              } else {
231                $(".targetClass_teaser-container").addClass('carousel-active');
232                var leng = $(".targetClass_teaser-container").find(".targetClass_teaser-button").length;
233                $('.targetClass_teaser-container').attr("data-button-count", leng);
234                dataLength = $('.targetClass_teaser-container').attr("data-button-count");
235                $(".targetClass_teaser-container .targetClass_teaser-button").each(function(index) {
236                  $(this).attr("data-button-index", index + 1);
237                });
238                $(".targetClass_teaser-container").each(function(index) {
239                  $(this).attr("data-teaser-index", index);
240                });
241                if (dataLength == undefined) {
242                  window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName);
243                  teasersLoadTriggered.push(teaser);
244                } else {
245                  window[loadFunctionName].call(this, buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength);
246                  teasersLoadTriggered.push(teaser);
247                }
248              }
249            }
250          }
251        }
252      }
253    })
254  }
255}
256
257function onClick(buttonClass, dataLayerSpecific, buttonCount, productRelation, dataLayerText, pageName, buttLeng) {
258  var dataLayer = window.dataLayer || [];
259  var ecommerceClick;
260  var product_relation;
261  var prod;
262  var buttonIndex = $('.carousel-active .targetClass_teaser-button').attr("data-button-index");
263  var myInt = parseInt(buttonIndex);
264  var teaserButtonLength = $(".carousel-active .targetClass_teaser-button").length;
265  var activeButtonCount = $('.carousel-active').attr("data-button-count");
266  if (activeButtonCount != undefined && activeButtonCount  != "0") {
267    for (var i = myInt - 1; i < myInt + teaserButtonLength - 1; i++) {
268      if (productRelation === "true") {
269        product_relation = "true";
270        ecommerceClick = clickEventProd(buttonClass, dataLayerSpecific, dataLayerText, pageName, activeButtonCount);
271        ecommerceClick.forEach(function(e) {
272          if (e.productRelation === "true") {
273            product_relation = "true";
274          }
275        });
276      } else {
277        product_relation = "false";
278        ecommerceClick = clickEvent(buttonClass, dataLayerSpecific, dataLayerText, pageName, activeButtonCount);
279      }
280    }
281  } else {
282    if (productRelation === "true") {
283      product_relation = "true";
284      ecommerceClick = clickEventProd(buttonClass, dataLayerSpecific, dataLayerText, pageName, activeButtonCount);
285    } else {
286      product_relation = "false";
287      ecommerceClick = clickEvent(buttonClass, dataLayerSpecific, dataLayerText, pageName, activeButtonCount);
288    }
289  }
290  if (activeButtonCount != undefined && activeButtonCount  != "0") {
291    dataLayer.push({
292      event: "eec_select_promotion",
293      event_name: "select_promotion",
294      eec_select_promotion: {
295        category: 'eec',
296        action: 'click - select promotion',
297        label: 'CTAs:' + activeButtonCount + '/Product:' + product_relation,
298        non_interaction: false
299      },
300      'ecommerce': {
301        'items': ecommerceClick
302      }
303    });
304  } else {
305    dataLayer.push({
306      event: "eec_select_promotion",
307      event_name: "select_promotion",
308      eec_select_promotion: {
309        category: 'eec',
310        action: 'click - select promotion',
311        label: 'CTAs:' + buttonCount + '/Product:' + product_relation,
312        non_interaction: false
313      },
314      'ecommerce': {
315        'items': ecommerceClick
316      }
317    });
318  }
319}
320
321function clickEvent(buttonClass, dataLayerSpecific, dataLayerText, pageName, leng) {
322  var values = [];
323  var teaserButton = $(".carousel-active").find(".targetClass_teaser-container").attr("data-teaser-index");
324  var teaserButtonIndex = parseInt(teaserButton);
325  var teaserButtonn = $(".carousel-active").find(".targetClass_teaser-button").attr("data-teaser-button-index");
326  var activeButtonCount = $('.carousel-active').attr("data-button-count");
327  if (leng != undefined && leng != "0") {
328    for (var i = 0; i < buttonClass.length; i++) {
329      for (var j = 0; j < activeButtonCount; j++) {
330        if (buttonClass[i].getAttribute("datalayertext") === dataLayerText) {
331          var teaserButtonValue = buttonClass[i].getAttribute("data-teaser-button-index")
332          var k = parseInt(teaserButtonValue);
333          var obj = {
334            index: k,
335            creative_name: dataLayerSpecific.getAttribute('data-creativeName'),
336            creative_slot: "CTA-" + (k + 1) + ":" + buttonClass[i].getAttribute("buttonText"),
337            location_id: pageName + "-" + dataLayerSpecific.getAttribute('data-locationId') + "-" + (teaserButtonIndex + 1),
338            promotion_id: dataLayerSpecific.getAttribute('data-promotionId'),
339            promotion_name: dataLayerSpecific.getAttribute('data-promotionName')
340          }
341        }
342      }
343    }
344    values.push(obj);
345  } else {
346    for (var i = 0; i < buttonClass.length; i++) {
347      if (buttonClass[i].getAttribute("datalayertext") === dataLayerText) {
348        var obj = {
349          index: i,
350          creative_name: dataLayerSpecific.getAttribute('data-creativeName'),
351          creative_slot: "CTA-" + (i + 1) + ":" + buttonClass[i].getAttribute("buttonText"),
352          location_id: pageName + "-" + dataLayerSpecific.getAttribute('data-locationId'),
353          promotion_id: dataLayerSpecific.getAttribute('data-promotionId'),
354          promotion_name: dataLayerSpecific.getAttribute('data-promotionName')
355        }
356      }
357    }
358    values.push(obj);
359  }
360  return values;
361}
362
363function clickEventProd(buttonClass, dataLayerSpecific, dataLayerText, pageName, leng) {
364  var values = [];
365  var teaserButton = $(".carousel-active").find(".targetClass_teaser-container").attr("data-teaser-index")
366  var teaserButtonIndex = parseInt(teaserButton);
367  if (leng != undefined && leng != "0") {
368    for (var i = 0; i < buttonClass.length; i++) {
369      if (buttonClass[i].getAttribute("datalayertext") === dataLayerText) {
370        var teaserButtonValue = buttonClass[i].getAttribute("data-teaser-button-index")
371        var k = parseInt(teaserButtonValue);
372        if (dataLayerSpecific.getAttribute("data-product-relation") === "true") {
373          var obj = {
374            index: k,
375            creative_name: dataLayerSpecific.getAttribute('data-creativeName'),
376            creative_slot: "CTA-" + (k + 1) + ":" + buttonClass[i].getAttribute("buttonText"),
377            location_id: pageName + "-" + dataLayerSpecific.getAttribute('data-locationId') + "-" + (teaserButtonIndex + 1),
378            promotion_id: dataLayerSpecific.getAttribute('data-promotionId'),
379            promotion_name: dataLayerSpecific.getAttribute('data-promotionName'),
380            item_id: dataLayerSpecific.getAttribute("data-productId"),
381            item_name: dataLayerSpecific.getAttribute("data-productName"),
382            item_brand: dataLayerSpecific.getAttribute("data-brand"),
383            currency: dataLayerSpecific.getAttribute("data-currencyType"),
384            price: dataLayerSpecific.getAttribute("data-price"),
385            item_category: dataLayerSpecific.getAttribute("data-category"),
386            quantity: dataLayerSpecific.getAttribute("data-quantity"),
387            customer_target_group: dataLayerSpecific.getAttribute("data-targetgroup"),
388            customer_funnel_status: dataLayerSpecific.getAttribute("data-funnelstatus"),
389            runtime: dataLayerSpecific.getAttribute("data-runtime"),
390            flag: dataLayerSpecific.getAttribute("data-flag"),
391            status: dataLayerSpecific.getAttribute("data-status"),
392          }
393          values.push(obj);
394        } else {
395          var object = {
396            index: k,
397            creative_name: dataLayerSpecific.getAttribute('data-creativeName'), // source: adobe target: promotion target group or name of the promotional creative
398            creative_slot: "CTA-" + (k + 1) + ":" + buttonClass[i].getAttribute("buttonText"),
399            location_id: pageName + "-" + dataLayerSpecific.getAttribute('data-locationId') + "-" + (teaserButtonIndex + 1),
400            promotion_id: dataLayerSpecific.getAttribute('data-promotionId'),
401            promotion_name: dataLayerSpecific.getAttribute('data-promotionName'), // source: adobe target: 
401Name of a promotion associated with the event.
402            productRelation: dataLayerSpecific.getAttribute("data-product-relation")
403          }
404          values.push(object);
405        }
406      }
407    }
408  } else {
409    for (var i = 0; i < buttonClass.length; i++) {
410      if (buttonClass[i].getAttribute("datalayertext") === dataLayerText) {
411        if (dataLayerSpecific.getAttribute("data-product-relation") === "false") {
412          var object = {
413            index: i,
414            creative_name: dataLayerSpecific.getAttribute('data-creativeName'), // source: adobe target: promotion target group or name of the promotional creative
415            creative_slot: "CTA-" + (i + 1) + ":" + buttonClass[i].getAttribute("buttonText"),
416            location_id: pageName + "-" + dataLayerSpecific.getAttribute('data-locationId'),
417            promotion_id: dataLayerSpecific.getAttribute('data-promotionId'),
418            promotion_name: dataLayerSpecific.getAttribute('data-promotionName') // source: adobe target: Name of a promotion associated with the event.
419          }
420          values.push(object);
421        }
422        if (dataLayerSpecific.getAttribute("data-product-relation") === "true") {
423          var object = {
424            index: i,
425            creative_name: dataLayerSpecific.getAttribute('data-creativeName'),
426            creative_slot: "CTA-" + (i + 1) + ":" + buttonClass[i].getAttribute("buttonText"),
427            location_id: pageName + "-" + dataLayerSpecific.getAttribute('data-locationId'),
428            promotion_id: dataLayerSpecific.getAttribute('data-promotionId'),
429            promotion_name: dataLayerSpecific.getAttribute('data-promotionName'),
430            item_id: dataLayerSpecific.getAttribute("data-productId"),
431            item_name: dataLayerSpecific.getAttribute("data-productName"),
432            item_brand: dataLayerSpecific.getAttribute("data-brand"),
433            currency: dataLayerSpecific.getAttribute("data-currencyType"),
434            price: dataLayerSpecific.getAttribute("data-price"),
435            item_category: dataLayerSpecific.getAttribute("data-category"),
436            quantity: dataLayerSpecific.getAttribute("data-quantity"),
437            customer_target_group: dataLayerSpecific.getAttribute("data-targetgroup"),
438            customer_funnel_status: dataLayerSpecific.getAttribute("data-funnelstatus"),
439            runtime: dataLayerSpecific.getAttribute("data-runtime"),
440            flag: dataLayerSpecific.getAttribute("data-flag"),
441            status: dataLayerSpecific.getAttribute("data-status"),
442          }
443          values.push(object);
444        }
445      }
446    }
447  }
448  return values;
449}
450
451function loadEvent(values, buttonClass, dataLayerClass, productRelation, btnText, pageName, leng) {
452  var teaesrbuttonNumber = $(".carousel-active .targetClass_teaser-button").attr("data-teaser-button-index");
453  var index = parseInt(teaesrbuttonNumber);
454  var buttonIndex = $(".carousel-active .targetClass_teaser-button").attr("data-button-index")
455  var myInt = parseInt(buttonIndex);
456  var teaserButton = $(".carousel-active").find(".targetClass_teaser-container").attr("data-teaser-index")
457  var teaserButtonLength = $(".carousel-active .targetClass_teaser-button").length;
458  var teaserButtonIndex = parseInt(teaserButton);
459  if (leng != undefined && leng != "0") {
460    for (var i = myInt - 1; i < myInt + teaserButtonLength - 1; i++) {
461      for (var j = index; j <= index; j++) {
462        if ((productRelation === "false") && (buttonClass[i].getAttribute("datalayertext") === btnText)) {
463          for (var j = 0; j < dataLayerClass.length; j++) {
464            if (buttonClass[i].getAttribute("datalayertext") === dataLayerClass[j].getAttribute("data-ctatext")) {
465              var obj = {
466                index: index,
467                creative_name6: dataLayerClass[j].getAttribute('data-creativeName'), // source: adobe target: promotion target group or name of the promotional creative
468                creative_slot: "CTA-" + (index + 1) + ":" + buttonClass[i].getAttribute("buttontext"),
469                location_id: pageName + "-" + dataLayerClass[j].getAttribute('data-locationId') + "-" + (teaserButtonIndex + 1), // source AEM: location of the promotion container
470                promotion_id: dataLayerClass[j].getAttribute('data-promotionId'),
471                promotion_name: dataLayerClass[j].getAttribute('data-promotionName') // source: adobe target: 
471Name of a promotion associated with the event.
472              }
473              values.push(obj);
474            }
475          }
476        }
477      }
478      ++index;
479    }
480  } else {
481    for (var i = 0; i < buttonClass.length; i++) {
482      if (productRelation && (buttonClass[i].getAttribute("datalayertext") === btnText)) {
483        for (var j = 0; j < dataLayerClass.length; j++) {
484          if (buttonClass[i].getAttribute("datalayertext") === dataLayerClass[j].getAttribute("data-ctatext")) {
485            var obj = {
486              index: i,
487              creative_name5: dataLayerClass[j].getAttribute('data-creativeName'), // source: adobe target: promotion target group or name of the promotional creative
488              creative_slot: "CTA-" + (i + 1) + ":" + buttonClass[i].getAttribute("buttontext"),
489              location_id: pageName + "-" + dataLayerClass[j].getAttribute('data-locationId'), // source AEM: location of the promotion container
490              promotion_id: dataLayerClass[j].getAttribute('data-promotionId'),
491              promotion_name: dataLayerClass[j].getAttribute('data-promotionName') // source: adobe target: Name of a promotion associated with the event.
492            }
493            values.push(obj);
494          }
495        }
496      }
497    }
498  }
499  return values;
500}
501
502function loadEventProd(values, buttonClass, dataLayerClass, productRelation, btnText, pageName, leng) {
503  var teaesrbuttonNumber = $(".carousel-active .targetClass_teaser-button").attr("data-teaser-button-index");
504  var index = parseInt(teaesrbuttonNumber);
505  var buttonIndex = $(".carousel-active .targetClass_teaser-button").attr("data-button-index")
506  var myInt = parseInt(buttonIndex);
507  var teaserButton = $(".carousel-active").find(".targetClass_teaser-container").attr("data-teaser-index")
508  var teaserButtonLength = $(".carousel-active .targetClass_teaser-button").length;
509  var teaserButtonIndex = parseInt(teaserButton);
510  if (leng != undefined && leng != "0") {
511    for (var i = myInt - 1; i < myInt + teaserButtonLength - 1; i++) {
512      for (var j = index; j <= index; j++) {
513        if (productRelation && (buttonClass[i].getAttribute("datalayertext") === btnText)) {
514          for (var j = 0; j < dataLayerClass.length; j++) {
515            if (buttonClass[i].getAttribute("datalayertext") === dataLayerClass[j].getAttribute("data-ctatext")) {
516              var obj = {
517                index: j,
518                creative_name1: dataLayerClass[j].getAttribute('data-creativeName'),
519                creative_slot: "CTA-" + (j + 1) + ":" + buttonClass[i].getAttribute("buttontext"),
520                location_id: pageName + "-" + dataLayerClass[j].getAttribute('data-locationId') + "-" + (teaserButtonIndex + 1),
521                promotion_id: dataLayerClass[j].getAttribute('data-promotionId'),
522                promotion_name: dataLayerClass[j].getAttribute('data-promotionName'),
523                item_id: dataLayerClass[j].getAttribute("data-productId"),
524                item_name: dataLayerClass[j].getAttribute("data-productName"),
525                item_brand: dataLayerClass[j].getAttribute("data-brand"),
526                currency: dataLayerClass[j].getAttribute("data-currencyType"),
527                price: dataLayerClass[j].getAttribute("data-price"),
528                item_category: dataLayerClass[j].getAttribute("data-category"),
529                quantity: dataLayerClass[j].getAttribute("data-quantity"),
530                customer_target_group: dataLayerClass[j].getAttribute("data-targetgroup"),
531                customer_funnel_status: dataLayerClass[j].getAttribute("data-funnelstatus"),
532                runtime: dataLayerClass[j].getAttribute("data-runtime"),
533                flag: dataLayerClass[j].getAttribute("data-flag"),
534                status: dataLayerClass[j].getAttribute("data-status"),
535                productRelation: dataLayerClass[j].getAttribute("data-product-relation")
536              }
537              values.push(obj);
538            }
539          }
540        }
541      }
542      ++index;
543    }
544  } else {
545    let buttonAvailable = false;
546    for (var i = 0; i < buttonClass.length; i++) {
547      if (productRelation === "true" && (buttonClass[i].getAttribute("datalayertext") === btnText)) {
548        for (var j = 0; j < dataLayerClass.length; j++) {
549          if (buttonClass[i].getAttribute("datalayertext") === dataLayerClass[j].getAttribute("data-ctatext")) {
550            buttonAvailable = true;
551
552            var object = {
553              index: i,
554              creative_name4: dataLayerClass[j].getAttribute('data-creativeName'),
555              creative_slot: "CTA-" + (i + 1) + ":" + buttonClass[i].getAttribute("buttontext"),
556              location_id: pageName + "-" + dataLayerClass[j].getAttribute('data-locationId'),
557              promotion_id: dataLayerClass[j].getAttribute('data-promotionId'),
558              promotion_name: dataLayerClass[j].getAttribute('data-promotionName'),
559              item_id: dataLayerClass[j].getAttribute("data-productId"),
560              item_name: dataLayerClass[j].getAttribute("data-productName"),
561              item_brand: dataLayerClass[j].getAttribute("data-brand"),
562              currency: dataLayerClass[j].getAttribute("data-currencyType"),
563              price: dataLayerClass[j].getAttribute("data-price"),
564              item_category: dataLayerClass[j].getAttribute("data-category"),
565              quantity: dataLayerClass[j].getAttribute("data-quantity"),
566              customer_target_group: dataLayerClass[j].getAttribute("data-targetgroup"),
567              customer_funnel_status: dataLayerClass[j].getAttribute("data-funnelstatus"),
568              runtime: dataLayerClass[j].getAttribute("data-runtime"),
569              flag: dataLayerClass[j].getAttribute("data-flag"),
570              status: dataLayerClass[j].getAttribute("data-status"),
571            }
572            values.push(object);
573          }
574        }
575      }
576    }
577
578    if(buttonAvailable == false && productRelation === "true") {
579      let dataLayersActive =  $(".carousel-active .data-layer");
580      if(dataLayersActive && dataLayersActive.length > 0) {
581        for(slideIndex = 0; slideIndex < dataLayersActive.length; slideIndex++) {
582          for(slideDataLayerIndex = 0; slideDataLayerIndex < dataLayerClass.length; slideDataLayerIndex++) {
583            if(dataLayerClass[slideDataLayerIndex] == dataLayersActive[slideIndex]) {
584              var object = {
585                index: i,
586                creative_name4: dataLayerClass[slideDataLayerIndex].getAttribute('data-creativeName'),
587                creative_slot: "CTA-" + (slideDataLayerIndex + 1) + ":" + '0',
588                location_id: pageName + "-" + dataLayerClass[slideDataLayerIndex].getAttribute('data-locationId'),
589                promotion_id: dataLayerClass[slideDataLayerIndex].getAttribute('data-promotionId'),
590                promotion_name: dataLayerClass[slideDataLayerIndex].getAttribute('data-promotionName'),
591                item_id: dataLayerClass[slideDataLayerIndex].getAttribute("data-productId"),
592                item_name: dataLayerClass[slideDataLayerIndex].getAttribute("data-productName"),
593                item_brand: dataLayerClass[slideDataLayerIndex].getAttribute("data-brand"),
594                currency: dataLayerClass[slideDataLayerIndex].getAttribute("data-currencyType"),
595                price: dataLayerClass[slideDataLayerIndex].getAttribute("data-price"),
596                item_category: dataLayerClass[slideDataLayerIndex].getAttribute("data-category"),
597                quantity: dataLayerClass[slideDataLayerIndex].getAttribute("data-quantity"),
598                customer_target_group: dataLayerClass[slideDataLayerIndex].getAttribute("data-targetgroup"),
599                customer_funnel_status: dataLayerClass[slideDataLayerIndex].getAttribute("data-funnelstatus"),
600                runtime: dataLayerClass[slideDataLayerIndex].getAttribute("data-runtime"),
601                flag: dataLayerClass[slideDataLayerIndex].getAttribute("data-flag"),
602                status: dataLayerClass[slideDataLayerIndex].getAttribute("data-status"),
603              }
604              values.push(object);
605            }
606          }
607        }
608      }
609    }
610  }
611  return values;
612}
613
614//Load Event Without Button and Product
615function loadEventWithoutButtonAndProduct(values, activeDataLayer, pageName) {
616  var teaesrbuttonNumber = $(".carousel-active .targetClass_teaser-button").attr("data-teaser-button-index");
617  var index;
618  if(teaesrbuttonNumber) {
619    index = parseInt(teaesrbuttonNumber)
620  } else {
621    index = 0;
622  }
623  var buttonIndex = $(".carousel-active .targetClass_teaser-button").attr("data-button-index")
624  var myInt = parseInt(buttonIndex);
625  var teaserButton = $(".carousel-active").find(".targetClass_teaser-container").attr("data-teaser-index")
626  var teaserButtonLength = $(".carousel-active .targetClass_teaser-button").length;
627  var teaserButtonIndex = parseInt(teaserButton);
628  var obj = {
629    index: index,
630    creative_name6: activeDataLayer.getAttribute('data-creativeName'), // source: adobe target: promotion target group or name of the promotional creative
631    creative_slot: "CTA-" + (index + 1) + ":" + '0',
632    location_id: pageName + "-" + activeDataLayer.getAttribute('data-locationId') + (teaserButtonIndex && "-" + (teaserButtonIndex + 1)), // source AEM: location of the promotion container
633    promotion_id: activeDataLayer.getAttribute('data-promotionId'),
634    promotion_name: activeDataLayer.getAttribute('data-promotionName') // source: adobe target: 
634Name of a promotion associated with the event.
635  }
636  values.push(obj);
637  return values;
638}
639
640function onLoad(buttonClass, dataLayerClass, buttonCount, productRelation, pageName, dataLength, teaserClass) {
641  var values = [];
642  var dataLayer = window.dataLayer || [];
643  $(".carousel-active .targetClass_teaser-button").each(function(index) {
644    $(this).attr("data-teaser-button-index", index);
645  });
646  var ecommerce;
647  var btnText;
648  var product_relation;
649  var activeButtonCount = $('.carousel-active').attr("data-button-count");
650  var buttonIndex = $('.carousel-active .targetClass_teaser-button').attr("data-button-index");
651  var myInt = parseInt(buttonIndex);
652  var teaserButtonLength = $(".carousel-active .targetClass_teaser-button").length;
653  if (activeButtonCount != undefined && activeButtonCount  != "0") {
654    var activeButtonCountInt = parseInt(activeButtonCount);
655    if(activeButtonCount == "1" || activeButtonCount == 1) {
656
657        let dataLayersActiveLength =  $(".carousel-active .data-layer");
658      if(dataLayersActiveLength && dataLayersActiveLength.length) {
659        dataLayersActiveLength.each((index, dataLayerNew) => {
660          let i = $(".carousel-active").index();
661          if (dataLayerNew.getAttribute("data-product-relation") === "true") {
662            productRelation = "true";
663          }
664
665          if (dataLayerNew.getAttribute("data-product-relation") === "true") {
666            btnText = dataLayerNew.getAttribute("data-ctatext");
667            ecommerce = loadEventProd(values, buttonClass, dataLayerClass, productRelation, btnText, pageName, activeButtonCount);
668            ecommerce.forEach(function(e) {
669              if (e.productRelation === "true") {
670                product_relation = "true";
671              }
672            });
673          } else {
674            btnText = dataLayerNew.getAttribute("data-ctatext");
675            ecommerce = loadEvent(values, buttonClass, dataLayerClass, productRelation = "false", btnText, pageName, activeButtonCount);
676          }
677        });
678      }
679
680      //}
681    } else {
682      let dataLayersActiveLength =  $(".carousel-active .data-layer");
683      if(dataLayersActiveLength && dataLayersActiveLength.length) {
684        dataLayersActiveLength.each((index, dataLayerNew) => {
685          if (dataLayerNew.getAttribute("data-product-relation") === "true") {
686            productRelation = "true";
687          }
688          if (dataLayerNew.getAttribute("data-product-relation") === "true") {
689            btnText = dataLayerNew.getAttribute("data-ctatext");
690            ecommerce = loadEventProd(values, buttonClass, dataLayerClass, productRelation, btnText, pageName, activeButtonCount);
691            ecommerce.forEach(function(e) {
692              if (e.productRelation === "true") {
693                product_relation = "true";
694              }
695            });
696          } else {
697            btnText = dataLayerNew.getAttribute("data-ctatext");
698            ecommerce = loadEvent(values, buttonClass, dataLayerClass, productRelation = "false", btnText, pageName, activeButtonCount);
699          }
700        });
701      }
702    }
703  } else {
704      let loadData;
705      let dataLayersActive =  $(".carousel-active .data-layer");
706      if(dataLayersActive && dataLayersActive.length > 0) {
707        for(slideIndex = 0; slideIndex < dataLayersActive.length; slideIndex++) {
708          if (dataLayersActive[slideIndex].getAttribute("data-product-relation") === "true") {
709            productRelation = "true";
710          }
711          if (dataLayersActive[slideIndex].getAttribute("data-product-relation") === "true") {
712            btnText = dataLayersActive[slideIndex].getAttribute("data-ctatext");
713            ecommerce = loadEventProd(values, buttonClass, dataLayerClass, productRelation, btnText, pageName, activeButtonCount);
714          } else {
715            productRelation = "false";
716            btnText = dataLayersActive[slideIndex].getAttribute("data-ctatext");
717            loadData = loadEventWithoutButtonAndProduct(values, dataLayersActive[slideIndex], pageName);
718          }
719
720          if(slideIndex == ( dataLayersActive.length - 1 )) {
721            ecommerce = loadData;
722          }
723        }
724
725      }
726  }
727  if (activeButtonCount != undefined && activeButtonCount  != "0") {
728    if (product_relation === undefined) {
729      product_relation = "false";
730    }
731    dataLayer.push({
732      event: "eec_view_promotion",
733      event_name: "view_promotion",
734      eec_view_promotion: {
735        category: 'eec',
736        action: 'display - view promotion',
737        label: 'CTAs:' + activeButtonCount + '/Product:' + product_relation,
738        non_interaction: false
739      },
740      'ecommerce': {
741        'items': ecommerce
742      }
743    });
744  } else {
745    if (product_relation === undefined) {
746      product_relation = "false";
747    }
748    dataLayer.push({
749      event: "eec_view_promotion",
750      event_name: "view_promotion",
751      eec_view_promotion: {
752        category: 'eec',
753        action: 'display - view promotion',
754        label: 'CTAs:' + activeButtonCount + '/Product:' + productRelation,
755        non_interaction: false
756      },
757      'ecommerce': {
758        'items': ecommerce
759      }
760    });
761  }
762}
763//Calling functions
764let initializeInterval = setInterval(function(){
765  if (jQuery('.targetClass_teaser-container').length > 0 && jQuery('.data-layer').length > 0) {
766    clearInterval(initializeInterval);
767    setTimeout(()=> {
768      initializeHandlers();
769    }, 2000)
770  }
771});

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.