1function getUTMParameters() { 2 let utms = ['utm_content', 'utm_medium', 'utm_campaign', 'utm_source', 'utm_term', 'referral', 'org', 'tripid', 'partner', 'season', 'interestId', 'country', 'goTo']; 3 let existingParams = JSON.parse(sessionStorage.getItem('utmParams')) || {}; 4 let queryString = window.location.search.substring(1); 5 let queryParams = queryString.split('&'); 6 for (let i = 0; i < queryParams.length; i++) { 7 let pair = queryParams[i].split('='); 8 if (utms.includes(pair[0]) && !existingParams[pair[0]]) { 9 existingParams[pair[0]] = pair[1]; 10 } 11 } 12 13 sessionStorage.setItem('utmParams', JSON.stringify(existingParams)); 14} 15 16function appendUTMParametersToLinks() { 17 let utmParams = JSON.parse(sessionStorage.getItem('utmParams')); 18 if (!utmParams) return; 19 20 let links = document.getElementsByTagName('a'); 21 for (let i = 0; i < links.length; i++) { 22 let link = links[i]; 23 let originalUrl = link.href; 24 let url = new URL(originalUrl, window.location.origin); 25 26 for (let key in utmParams) { 27 if (!url.searchParams.has(key)) { 28 url.searchParams.set(key, utmParams[key]); 29 } 30 } 31 32 link.href = url.toString(); 33 } 34} 35 36$(document).ready(function () { 37 getUTMParameters(); 38 appendUTMParametersToLinks(); 39})
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.