Overview
This guide explains how to set up geo-targeting so the correct compliance template is automatically shown to users based on their location.
Why Geo-Targeting?
- EU Visitors → See GDPR-compliant banner
- California Visitors → See CCPA template
- Brazil Visitors → See LGPD template
- Other Regions → See simple template or your choice
- Automatic → No manual configuration per visitor
- Consent Management module enabled
- Banner already configured
- Admin access
- Visitor IP address detected
- Geo_Service looks up IP location
- Returns country/region
- GeoRuleMatcher finds matching rule
- Correct template determined
- If server-side fails, uses API
/wp-json/slos/v1/geo/regionendpoint- Browser sends visitor IP
- Returns detected region
- JavaScript selects template
- Server detection
- API detection
- Region mapping
- Default template
- Go to SLOS → Consent Management
- Click Settings tab
- Scroll to Geo-Targeting
- Check “Enable Geo-Targeting”
- Click Save Changes
- Go to Consent Management → Geo Rules
- Click Add Rule
- Rule Name: “GDPR – EU”
- Countries: Select all EU countries (or bulk select “EU”)
- Template: Select “GDPR Template”
- Set Effective: Immediately
- Set Priority: High (executed first)
- Click Save Rule
- Click Add Rule
- Rule Name: “CCPA – California”
- Countries: United States
- States/Provinces: California
- Template: Select “CCPA Template”
- Priority: High
- Click Save Rule
- Click Add Rule
- Rule Name: “LGPD – Brazil”
- Countries: Brazil
- Template: Select “LGPD Template” (or Advanced)
- Priority: High
- Click Save Rule
- Click Add Rule
- Rule Name: “Default Template”
- Countries: All others
- Template: Select “Simple Template”
- Priority: Low (lowest priority)
- Click Save Rule
- From VPN in EU:
- From California IP:
- Browser Dev Tools:
- Go to SLOS → Settings → Advanced
- Check “Debug Logging”
- Console will show:
- EU Detection:
- CCPA Detection:
- Default Detection:
- Go to Consent Management → Consents
- Look for recent entries
- Check
georuleidfield - Verify rule ID matches expected rule
- VPN users
- Proxy users
- Corporate networks
- ISP non-standard routing
- Add fallback detection
- Allow manual region selection
- Use secondary detection methods
- Edit banner text to add:
- Link changes browser selection
- User selects correct region
- Browser stores preference
- Go to Geo Rules → Settings
- Whitelist: Countries that MUST use specific template
- Blacklist: Countries excluded from rules
- High priority enforced
- Save settings
- Regional distribution of consents
- Template impressions by region
- Acceptance rate by template
- Geo-detection accuracy
- Go to Reports → Geo Analysis
- Select date range
- View by region, country, template
- Download CSV report
- Share with compliance team
- Consents per region
- Template impressions by region
- Acceptance rates by template
- A/B variant distribution by region
- Time-to-decision by region
- Verify rule is enabled
- Check rule priority
- Verify template exists
- Clear browser cookies
- Check console logs for errors
- Increase rule priority
- Disable conflicting rules
- Update template settings
- Verify geolocation service enabled
- Test API endpoint manually
- Check server logs
- Verify user IP visible to server
- Enable debug logging
- Check WordPress logs
- Verify server permissions
- Test with different IPs
- User on VPN
- Proxy server
- ISP location mismatch
- Geolocation database outdated
- Allow manual override
- Use multiple detection methods
- Update geolocation database
- Document as known issue
- ✓ Template has GDPR language
- ✓ Consent is explicit
- ✓ Rejection easy as acceptance
- ✓ Granular control available
- ✓ Consent recorded with geo data
- ✓ Template shows CCPA language
- ✓ “Do Not Sell” clearly displayed
- ✓ Rights explained
- ✓ Opt-out possible
- ✓ Consent tracked
- ✓ Portuguese language preferred
- ✓ LGPD rights displayed
- ✓ Consent explicit
- ✓ Data storage explained
- ✓ International transfer notice
- Test Thoroughly – Use VPNs to test all regions
- Keep Rules Simple – Don’t over-complicate
- Prioritize Correctly – Specific rules first
- Monitor Accuracy – Check for misdetections
- Document Rules – Keep notes on setup
- Review Regularly – Update rules quarterly
- Get Legal Review – Ensure compliance
- Have Fallback – Default rule for unknowns
- Go to Geo Rules → Advanced
- Custom Rule Name – Describe the rule
- Conditions:
- Action: Select template
- Priority: Set priority
- Save Rule
- Enable geo-targeting
- Create rules for your regions
- Test with VPNs
- Monitor detection accuracy
- Adjust rules as needed
- Review compliance quarterly
- Setup Cookie Banner
- A/B Testing Guide
- Analytics Integration
Prerequisites
How Geo-Detection Works
Server-Side Detection (Primary)
Frontend Fallback (Secondary)
Multi-Layer Fallback
Step 1: Enable Geo-Targeting
Step 2: Set Up Geo Rules
EU (GDPR) Rule
Location: Austria, Belgium, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Estonia, Finland, France, Germany, Greece, Hungary, Ireland, Italy, Latvia, Lithuania, Luxembourg, Malta, Netherlands, Poland, Portugal, Romania, Slovakia, Slovenia, Spain, Sweden
California (CCPA) Rule
Location: United States – California
Brazil (LGPD) Rule
Location: Brazil
Default Rule
For all other locations:
Step 3: Verify Detection Accuracy
Test Detection
– Connect to EU VPN
– Clear cookies
– Visit site
– GDPR banner should show
– Connect to California VPN
– Clear cookies
– Visit site
– CCPA banner should show
– Open Console
– Look for logs like: “Geo region: EU”
– Verify template selection
Check Console Logs
Enable debug logging:
– Detected region
– Matched rule
– Selected template
– Fallback steps
Manually Test API
In browser console:
`javascript
fetch(‘/wp-json/slos/v1/geo/region’)
.then(r => r.json())
.then(d => console.log(‘Region:’, d));
`
Returns: {"region": "EU"} or similar
Step 4: Test All Templates
Visual Verification
Test each scenario:
– GDPR-specific text
– “More options” button
– Cookie category explanations
– “Do Not Sell” language
– California-specific rights
– CCPA terminology
– Simple accept/reject
– Basic information
– Minimal text
Verify Consent Recording
After interacting with each template:
Step 5: Handle Special Cases
IP Geolocation Limitations
Some IPs are hard to detect:
Solution:
Adding Manual Region Override
Allow users to override detected region:
“Not from [Region]? [Change Region]”
Whitelist/Blacklist Countries
Create country lists:
Step 6: Monitor Geo Detection
Dashboard Metrics
In Consent Management → Dashboard:
Create Report
Export geo data:
Common Metrics
Step 7: Troubleshooting Geo Rules
Banner Still Shows Wrong Template
Check:
Solution:
Geo Detection Not Working
Check:
Solution:
Wrong Region Detected
Likely Causes:
Solutions:
Step 8: Compliance Verification
GDPR Compliance
For EU rule:
CCPA Compliance
For California rule:
LGPD Compliance
For Brazil rule:
Best Practices
Advanced: Custom Geo Rules
Create custom rules beyond pre-built:
– Country codes
– Region/state codes
– IP ranges
– Custom parameters
Example: Japan-specific rule
`
Condition: Country = JP
Template: Detailed template (heavy tracking)
Priority: High
`
Next Steps
Related Articles
Share this article
Still need help?
Our support team is ready to assist you with personalized guidance for your workspace.