1const getCookie = (name) => { 2 const match = document.cookie.match(new RegExp("(^| )" + name + "=([^;]+)")); 3 return match ? decodeURIComponent(match[2]) : null; 4}; 5 6(function () { 7 const targetPath = "/get-involved/donate/other-ways-to-give/gift-in-memory"; 8 const currentPath = window.location.pathname.toLowerCase(); 9 const defaultSeg = "4AFW3F"; 10 11 if (currentPath === targetPath.toLowerCase()) { 12 13 const cookieSeg = getCookie("seg"); 14 const urlSeg = new URL(window.location.href).searchParams.get("seg"); 15 const sessionSeg = sessionStorage.getItem("seg"); 16 17 const segValue = cookieSeg || sessionSeg || urlSeg || defaultSeg; 18 19 if (cookieSeg || urlSeg) { 20 sessionStorage.setItem("seg", cookieSeg || urlSeg); 21 } 22 23 const links = document.querySelectorAll('a[href*="donations.britishlegion.org.uk"]'); 24 links.forEach(link => { 25 const url = new URL(link.href); 26 url.searchParams.set("seg", segValue); 27 link.href = url.toString(); 28 }); 29 } 30})();
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.