1/** 2 * jurisdiction-adapter.js â Adapts homepage content based on detected jurisdiction. 3 * Loaded on homepage only. Detects browser locale and adapts: 4 * - Hero H1 text (GDPR vs Privacy Compliance vs LGPD) 5 * - Fine calculator (show/hide based on jurisdiction) 6 * - RGPD-specific references (generalize for non-EU) 7 * - Sidebar "ART. 83 RGPD" badge 8 * 9 * Runs after DOMContentLoaded. Does NOT redirect or create new pages. 10 * For EU languages (fr, de, es, it, pt) â no changes needed (RGPD is correct). 11 * For /en/ â adapts based on navigator.language country code. 12 */ 13 14(function() { 15 'use strict'; 16 17 // Only run on homepage (not form, not blog) 18 var path = window.location.pathname; 19 if (path.indexOf('/form') !== -1 || path.indexOf('/blog') !== -1) return; 20 21 // Don't run on jurisdiction-specific pages (they have correct static content) 22 var jurisdictionPages = ['/en-us/', '/en-gb/', '/en-ca/', '/en-au/', '/pt-br/', '/fr-ca/', '/fr-be/', '/fr-ch/', '/de-ch/', '/de-at/', '/es-mx/']; 23 for (var i = 0; i < jurisdictionPages.length; i++) { 24 if (path.indexOf(jurisdictionPages[i]) !== -1) return; 25 } 26 27 // Detect jurisdiction from browser locale 28 var browserLang = (navigator.language || navigator.userLanguage || '').toLowerCase(); 29 var pageLang = document.documentElement.lang || 'fr'; 30 31 // For non-EN pages, GDPR is always correct (FR=RGPD, DE=DSGVO, ES=RGPD, IT=GDPR, PT=RGPD) 32 // Only /en/ needs adaptation 33 if (pageLang !== 'en') return; 34 35 // Map browser locale to jurisdiction region 36 var region = 'EU'; // default 37 if (browserLang.indexOf('en-us') === 0) region = 'US'; 38 else if (browserLang.indexOf('en-ca') === 0 || browserLang.indexOf('fr-ca') === 0) region = 'CA'; 39 else if (browserLang.indexOf('en-gb') === 0) region = 'UK'; 40 else if (browserLang.indexOf('en-au') === 0) region = 'AU'; 41 else if (browserLang.indexOf('pt-br') === 0) region = 'BR'; 42 else if (browserLang.indexOf('en') === 0) region = 'GENERIC_EN'; 43 // All other locales on /en/ â keep GDPR (they're likely EU English speakers) 44 45 if (region === 'EU') return; // No changes needed 46 47 // Adaptation config per region 48 var adaptations = { 49 US: { 50 heroRegulation: 'privacy compliant', 51 heroRegulationB: 'privacy score', 52 subtitle: 'CCPA, state privacy laws & GDPR compliance. Scan your site for free.', 53 calcToggle: 'Calculate my compliance risk', 54 calcDisclaimer: 'Based on CCPA penalties up to <strong>$7,500 per violation</strong> and GDPR fines up to <strong>4% of annual turnover</strong>.', 55 sidebarBadge: 'CCPA + GDPR', 56 sidebarText: 'Up to $7,500/violation', 57 showCalculator: true, 58 }, 59 CA: { 60 heroRegulation: 'privacy compliant', 61 heroRegulationB: 'privacy score', 62 subtitle: 'PIPEDA, Quebec Law 25 & GDPR compliance. Scan your site for free.', 63 calcToggle: 'Calculate my compliance risk', 64 calcDisclaimer: 'Based on PIPEDA/Law 25 penalties up to <strong>CAD 25M or 4% of turnover</strong>.', 65 sidebarBadge: 'PIPEDA', 66 sidebarText: 'Up to CAD 25M', 67 showCalculator: true, 68 }, 69 UK: { 70 heroRegulation: 'UK GDPR compliant', 71 heroRegulationB: 'UK GDPR score', 72 subtitle: 'UK GDPR & Data Protection Act compliance. Scan your site for free.', 73 calcToggle: 'Calculate my fine risk', 74 calcDisclaimer: 'Based on UK GDPR maximum penalty of <strong>4% of annual turnover or £17.5 million</strong>, whichever is higher.', 75 sidebarBadge: 'UK GDPR', 76 sidebarText: 'Up to £17.5M', 77 showCalculator: true, 78 }, 79 AU: { 80 heroRegulation: 'privacy compliant', 81 heroRegulationB: 'privacy score', 82 subtitle: 'Privacy Act & Australian Privacy Principles compliance. Scan your site for free.', 83 calcToggle: 'Calculate my compliance risk', 84 calcDisclaimer: 'Based on Privacy Act penalties up to <strong>AUD 50 million or 30% of turnover</strong>.', 85 sidebarBadge: 'Privacy Act', 86 sidebarText: 'Up to AUD 50M', 87 showCalculator: true, 88 }, 89 BR: { 90 heroRegulation: 'LGPD compliant', 91 heroRegulationB: 'LGPD score', 92 subtitle: 'LGPD compliance for Brazilian businesses. Scan your site for free.', 93 calcToggle: 'Calculate my fine risk', 94 calcDisclaimer: 'Based on LGPD penalties up to <strong>2% of revenue or BRL 50 million</strong> per infraction.', 95 sidebarBadge: 'LGPD', 96 sidebarText: 'Up to BRL 50M', 97 showCalculator: true, 98 },
99 GENERIC_EN: { 100 heroRegulation: 'legally compliant', 101 heroRegulationB: 'compliance score', 102 subtitle: 'Privacy & data protection compliance. Scan your site for free.', 103 calcToggle: null, // hide calculator 104 sidebarBadge: 'Privacy', 105 sidebarText: 'Compliance check', 106 showCalculator: false, 107 }, 108 }; 109 110 var config = adaptations[region]; 111 if (!config) return; 112 113 document.addEventListener('DOMContentLoaded', function() { 114 // 1. Adapt Hero H1 â replace "GDPR compliant" with jurisdiction-specific text 115 var heroH1 = document.getElementById('hero-h1'); 116 if (heroH1) { 117 var gradientSpan = heroH1.querySelector('.gradient-highlight'); 118 if (gradientSpan && config.heroRegulation) { 119 gradientSpan.textContent = config.heroRegulation; 120 } 121 // Also update variant B data attributes for A/B testing 122 if (config.heroRegulationB) { 123 heroH1.setAttribute('data-b-part2', config.heroRegulationB); 124 } 125 } 126 127 // 2. Adapt subtitle 128 var subtitle = document.getElementById('hero-subtitle'); 129 if (subtitle && config.subtitle) { 130 subtitle.innerHTML = config.subtitle; 131 } 132 133 // 3. Adapt or hide fine calculator toggle 134 var calcToggle = document.getElementById('hero-calc-toggle'); 135 if (calcToggle) { 136 if (config.calcToggle === null || !config.showCalculator) { 137 calcToggle.style.display = 'none'; 138 } else if (config.calcToggle) { 139 calcToggle.textContent = config.calcToggle; 140 } 141 } 142 143 // 4. Adapt calculator disclaimer 144 var calcDisclaimer = document.querySelector('.hero-calc-result-disclaimer'); 145 if (calcDisclaimer && config.calcDisclaimer) { 146 calcDisclaimer.innerHTML = config.calcDisclaimer; 147 } 148 149 // 5. Adapt sidebar badge (form page â "ART. 83 RGPD") 150 // This appears on both homepage risk indicator and form sidebar 151 var sidebarBadges = document.querySelectorAll('.gdpr-badge-text, .risk-badge-regulation'); 152 sidebarBadges.forEach(function(el) { 153 if (config.sidebarBadge) { 154 el.textContent = config.sidebarBadge; 155 } 156 }); 157 var sidebarTexts = document.querySelectorAll('.gdpr-badge-subtext, .risk-badge-penalty');
158 sidebarTexts.forEach(function(el) { 159 if (config.sidebarText) { 160 el.textContent = config.sidebarText; 161 } 162 }); 163 164 // Track jurisdiction adaptation for analytics 165 if (typeof trackGA4Event === 'function') { 166 trackGA4Event('jurisdiction_adapted', { 167 region: region, 168 browser_locale: browserLang, 169 page_lang: pageLang, 170 }); 171 } 172 }); 173})();
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.