1(function () { 2 'use strict'; 3 4 var DEFAULT_CALLBACK_URL = 'https://www.finni.com.au/'; 5 var DEFAULT_BOOK_URL = 'https://www.finni.com.au/book'; 6 var UTM = { 7 utm_source: 'spi', 8 utm_medium: 'referral', 9 utm_campaign: 'article_lending_lead_module', 10 }; 11 12 var trackedUrl = function (base, intent, content, callback) { 13 var url = new URL(base, window.location.href); 14 15 Object.keys(UTM).forEach(function (key) { 16 url.searchParams.set(key, UTM[key]); 17 }); 18 19 url.searchParams.set('utm_term', intent); 20 url.searchParams.set('utm_content', content); 21 22 if (callback) { 23 url.searchParams.set('spi_callback', '1'); 24 } 25 26 return url.toString(); 27 }; 28 29 var emitClick = function (module, link, intent) { 30 var detail = { 31 intent: intent, 32 destination: link.href, 33 placement: module.dataset.placement || 'article_inline', 34 }; 35 36 if (Array.isArray(window.dataLayer)) { 37 window.dataLayer.push({ 38 event: 'spi_finance_module_click', 39 lead_intent: detail.intent, 40 link_url: detail.destination, 41 interaction_area: detail.placement, 42 }); 43 } 44 45 module.dispatchEvent(new CustomEvent('spi:finance-module-click', { 46 bubbles: true, 47 detail: detail, 48 })); 49 }; 50 51 var init = function () { 52 document.querySelectorAll('[data-spi-lead-module]').forEach(function (module) { 53 var callbackUrl = module.dataset.callbackUrl || DEFAULT_CALLBACK_URL; 54 var bookUrl = module.dataset.bookUrl || DEFAULT_BOOK_URL; 55 56 module.querySelectorAll('[data-spi-intent]').forEach(function (link) { 57 var intent = link.dataset.spiIntent; 58 link.href = trackedUrl(callbackUrl, intent, 'inline_goal_selector', true); 59 link.addEventListener('click', function () { 60 emitClick(module, link, intent); 61 }); 62 }); 63 64 var bookLink = module.querySelector('[data-spi-book]'); 65 66 if (bookLink) { 67 bookLink.href = trackedUrl(bookUrl, 'book_time', 'inline_booking_link', false); 68 bookLink.addEventListener('click', function () { 69 emitClick(module, bookLink, 'book_time'); 70 }); 71 } 72 }); 73 }; 74 75 if (document.readyState === 'loading') { 76 document.addEventListener('DOMContentLoaded', init); 77 } else { 78 init(); 79 } 80}());
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.