1import ga4ControllerAction from "../ga4-action.js"; 2import DatalayerHelper from "../helpers/datalayer.helper.js"; 3 4export default class OnProductCrossSellingAction extends ga4ControllerAction { 5 trigger() { 6 7 const crossSellingElement = document.querySelector('.tab-menu--cross-selling'); 8 9 if (crossSellingElement) { 10 this._onTabActive(crossSellingElement); 11 const tabs = crossSellingElement.querySelectorAll('.tab--link'); 12 13 if (tabs) { 14 tabs.forEach(tab => tab.addEventListener('click', this._onTabActive.bind(this))); 15 } 16 } 17 } 18 19 _onLoad(action) { 20 if (!this.actionEnabled) { 21 return; 22 } 23 24 let closestSlider = action.querySelector('.product-slider--container'); 25 if (!closestSlider) { 26 return; 27 } 28 29 DatalayerHelper.viewItemList("lastSeenProducts", closestSlider); 30 31 } 32 _onTabActive(action) { 33 if (!this.actionEnabled) { 34 return; 35 } 36 37 let closestSlider = document.querySelector('.tab-menu--cross-selling .tab--container.has--content.is--active'); 38 if (!closestSlider) { 39 return; 40 } 41 42 DatalayerHelper.viewItemList("productCrossSelling", closestSlider); 43 44 } 45 46}
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.