/* Shared tracker for firememecoins.com: pageviews + outbound pump.fun clicks. Two jobs, deliberately guarded separately. 1. PAGEVIEW (dest:'pageview') - fires once per page load with the path and where the visitor came from. Until now we could count referral clicks but not arrivals, so a drop from "X profile clicks" to "site visits" to "tool use" was invisible. This is the missing middle of the funnel. Uses its own guard (window.__fmcView) because the homepage's radar script claims window.__fmcClick before this file runs. 2. CLICK (dest:'pumpfun') - one fire-and-forget beacon per outbound click, no redirect, no dependency on the endpoint, all inside try/catch so a dead API can never break the affiliate link. No cookies, no fingerprinting: a random per-session id in sessionStorage, the path, the referrer hostname only, and the user agent the browser already sends. */ (function () { var API = 'https://superagent-ab39abf3.base44.app/functions/pumpClick'; function sid() { try { var k = 'fmc_sid', v = sessionStorage.getItem(k); if (!v) { v = Math.random().toString(36).slice(2, 10) + Date.now().toString(36); sessionStorage.setItem(k, v); } return v; } catch (e) { try { var v2 = sessionStorage.getItem('lr_sid'); if (v2) return v2; } catch (e2) {} return ''; } } function refHost() { try { if (!document.referrer) return 'direct'; var a = document.createElement('a'); a.href = document.referrer; if (a.hostname === location.hostname) return 'internal'; return (a.hostname || '').replace(/^www\./, '') || 'direct'; } catch (e) { return 'direct'; } } /* First touch wins for the session: a visitor who arrives from X and then browses to three pages still counts as an X visit in the click attribution. */ function source() { try { var v = sessionStorage.getItem('fmc_ref'); if (!v) { v = refHost(); sessionStorage.setItem('fmc_ref', v); } return v; } catch (e) { return refHost(); } } /* Campaign tag (LR-CAMP-R21): the X automations append ?s= to the link they post. First tag seen in the session wins, so a visitor who lands on a tagged page and then browses three more pages is still attributed to that post. */ function camp() { try { var v = sessionStorage.getItem('fmc_camp'); if (v) return v; } catch (e0) {} var out = ''; try { var q = new URLSearchParams(location.search); /* never 's': WordPress treats ?s= as a search and renders an empty results page */ var raw = q.get('c') || q.get('camp') || q.get('utm_source') || q.get('utm_campaign') || ''; out = String(raw).toLowerCase().replace(/[^a-z0-9._-]/g, '').slice(0, 48); } catch (e) { out = ''; } try { if (out) sessionStorage.setItem('fmc_camp', out); } catch (e2) {} return out; } function send(payload) { try { var json = JSON.stringify(payload); if (navigator.sendBeacon) navigator.sendBeacon(API, new Blob([json], { type: 'text/plain' })); else fetch(API, { method: 'POST', headers: { 'Content-Type': 'text/plain' }, body: json, keepalive: true, mode: 'no-cors' }); } catch (e) {} } if (!window.__fmcView) { window.__fmcView = 1; send({ src: 'view', path: location.pathname, dest: 'pageview', ref: source(), camp: camp(), session: sid() }); } /* One H1 per page. The theme renders the site logo as an

twice on the front page (desktop header and the sticky/mobile header), which leaves four H1s on the one page that matters most for search. Demote both to

, copying the computed font and box so the header looks identical. Inner pages already have one H1 and are untouched. */ function demoteLogoH1s() { try { var hs = document.querySelectorAll('header h1.logo-title, .logo-wrap h1.logo-title'); for (var i = 0; i < hs.length; i++) { var h = hs[i]; if (!h.parentNode) continue; var p = document.createElement('p'); p.className = h.className; try { var c = window.getComputedStyle(h); p.style.display = c.display; p.style.margin = c.margin; p.style.fontSize = c.fontSize; p.style.fontWeight = c.fontWeight; p.style.lineHeight = c.lineHeight; p.style.letterSpacing = c.letterSpacing; p.style.color = c.color; } catch (e2) {} p.innerHTML = h.innerHTML; h.parentNode.replaceChild(p, h); } } catch (e) {} } if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', demoteLogoH1s); else demoteLogoH1s(); /* The newsletter form is Fluent Forms' stock styling: a stock blue Subscribe button on a near-black, amber-accented page, in both the inline block and the theme's scroll popup. Restyle both to the site's own button. Injected as a style tag rather than added to page content because wpautop mangles CSS appended to a page's