1/* global dataLayer */ 2( function() { 3 4 if ( !window.gtmLoaded ) { 5 return; 6 } 7 8 var relatedPosts = document.getElementById( 'related-posts' ); 9 10 if ( !relatedPosts ) { 11 return; 12 } 13 14 var anchors = relatedPosts.querySelectorAll( '.grid-post a' ); 15 16 for ( var i = anchors.length - 1; i >= 0; i-- ) { 17 18 anchors[ i ].addEventListener( 'click', function( event ) { 19 20 event.preventDefault(); 21 22 window.dataLayer = window.dataLayer || []; 23 24 var eventLabel = this.dataset.gtmTitle; 25 var aHref = this.getAttribute( 'href' ); 26 27 dataLayer.push({ 28 event: 'AllCustomEvents', 29 EventAction: 'Click', 30 EventCategory: 'YMAL', 31 EventLabel: eventLabel, 32 eventCallback: function() { 33 window.location.href = aHref; 34 }, 35 eventTimeout: 2000 36 } ); 37 } ); 38 } 39 40} )();
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.