1 2$(document).ready(function () { 3 4 $(document).on('click', '[data-track]', function () { 5 var data = { 6 shop: $(this).attr('data-shop'), 7 product: $(this).attr('data-product'), 8 family: $(this).attr('data-family'), 9 pagetitle: $(this).attr('data-pagetitle'), 10 gtmKey: $(this).attr('data-gtmKey') 11 }; 12 13 console.log({ 14 'Available data': data 15 }); 16 FmdProductsTracking.Track(data); 17 }); 18 19}); 20 21 22 23var FmdProductsTracking = function () { 24 25 var data = {}; 26 27 return { 28 Track: function (obj) { 29 data = obj; 30 var resGtm = TrackGoogletagmanager(); 31 var resFb = TrackFacebook(); 32 var resAdf = TrackAdform(); 33 34 console.log({ 35 'Tracked:': { 36 'TrackGoogletagmanager': resGtm, 37 'TrackFacebook': resFb, 38 'TrackAdform': resAdf 39 } 40 }); 41 } 42 } 43 44 function TrackGoogletagmanager() { 45 46 var callback = function () { 47 if (typeof (url) != 'undefined') { 48 window.location = url; 49 } 50 }; 51 52 if (typeof data.gtmKey != 'undefined') { 53 var values = { 54 'send_to': 'AW-668618318/' + data.gtmKey, 55 'event_callback': callback, 56 'event_category': data.pagetitle, 57 'event_label': 'link' 58 } 59 gtag('event', 'conversion', values); 60 } else { 61 var values = { 62 'event_category': data.pagetitle, 63 'event_label': 'link' 64 } 65 gtag('event', 'click', values); 66 } 67 68 return values; 69 } 70 71 function TrackFacebook() { 72 var values = data.shop + ' ' + data.pagetitle; 73 fbq('track', 'Purchase', { 74 content_ids: values, 75 value: 0, 76 currency: 'EUR' 77 }); 78 return values; 79 } 80 81 function TrackAdform() { 82 var values = data.shop + ' ' + data.pagetitle; 83 window.adf && adf.ClickTrack(this, 1978184, values, {}); 84 return values; 85 } 86 87}();
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.