Troubleshooting
Common issues and solutions for PrivacyPact
Widget Not Appearing
Issue: Widget doesn't show up
Possible causes:
- Script not loaded correctly
- API key is invalid or missing
- User is in a location that doesn't require consent (e.g., US state without privacy law)
- JavaScript errors preventing initialization
Solutions:
- Check browser console for errors
- Verify the script tag is in the
<head>section - Verify your API key is correct and active
- Enable debug mode:
debug: truein init config - Test with a forced state:
testState: "CA"to see if it's a location issue
Cookie Blocking Issues
Issue: Cookies are still being set before consent
Possible causes:
- Cookies are set before the widget initializes
- Third-party scripts are loading too quickly
- Cookies are set server-side
Solutions:
- Move the PrivacyPact script to the very top of your
<head>section - Delay loading third-party scripts until after consent is given
- Use the consent event listener to load scripts conditionally
- For server-side cookies, implement server-side consent checking
Example: Listen for consent events before loading analytics:
window.addEventListener('privacypact:consent-updated', (event) => {
if (event.detail.categories.includes('analytics')) {
// Load Google Analytics here
loadGoogleAnalytics();
}
});API Errors
Issue: 401 Unauthorized
Cause: Invalid or missing API key
Solution:
- Verify your API key in the dashboard
- Check that the API key starts with
pk_live_orpk_test_ - Ensure the API key is correctly passed in the widget initialization
- Check that your account is active and not suspended
Issue: 429 Too Many Requests
Cause: Rate limit exceeded
Solution:
- Check the rate limit headers in the response
- Wait for the rate limit window to reset
- Implement exponential backoff in your integration
- Contact support if you need higher rate limits
Issue: CORS Errors
Cause: Cross-origin request blocked by browser
Solution:
- Verify your domain is added to allowed origins in your dashboard
- Check that you're using the correct API endpoint URL
- Ensure your domain matches exactly (including www/non-www)
Location Detection Issues
Issue: Wrong location detected
Possible causes:
- VPN or proxy affecting IP geolocation
- Browser timezone detection is inaccurate
- User is traveling or using a different network
Solutions:
- For testing, use
testState: "CA"to override detection - Location detection uses multiple methods (IP, timezone) for accuracy
- Users can manually select their location in the widget if needed
Debug Mode
Enable debug mode to see detailed logging in the browser console:
PrivacyPactPortal.init({
apiKey: "pk_live_your_api_key_here",
debug: true // Enable debug logging
});Debug mode will log:
- Initialization status
- Detected location and jurisdiction
- API requests and responses
- Consent decisions
- Cookie blocking status