@@ -7,6 +7,11 @@ document.addEventListener('DOMContentLoaded', function () {
77 }
88 }
99
10+ // add a class to the banner link for tracking
11+ document . querySelectorAll ( '.banner a' ) . forEach ( function ( a ) {
12+ a . classList . add ( 'banner-link' )
13+ } )
14+
1015 // if a card is 'selectable' then make it a click target
1116 // by taking the link from the card and wrapping the whole card in an anchor tag with that link
1217 // if the card contains more than one link, the first link is used
@@ -17,14 +22,19 @@ document.addEventListener('DOMContentLoaded', function () {
1722 var target = link . querySelector ( 'a' ) . getAttribute ( 'href' )
1823 var card = link . parentElement
1924 card . classList . add ( 'selectable' )
20- const cardLink = createElement ( 'a' , 'link' )
25+ const cardLink = createElement ( 'a' , 'link card-link ' )
2126 cardLink . setAttribute ( 'href' , target )
2227 moveElements ( card , cardLink )
2328 card . appendChild ( cardLink )
2429 card . addEventListener ( 'click' , function ( e ) {
2530 e . preventDefault ( )
2631 window . location . href = target
2732 } )
33+
34+ // add a class to the link itself for tracking
35+ link . querySelectorAll ( 'a' ) . forEach ( function ( a ) {
36+ a . classList . add ( 'card-link' )
37+ } )
2838 } )
2939 }
3040
0 commit comments