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:

  1. Check browser console for errors
  2. Verify the script tag is in the <head> section
  3. Verify your API key is correct and active
  4. Enable debug mode: debug: true in init config
  5. 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:

  1. Move the PrivacyPact script to the very top of your <head> section
  2. Delay loading third-party scripts until after consent is given
  3. Use the consent event listener to load scripts conditionally
  4. 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:

  1. Verify your API key in the dashboard
  2. Check that the API key starts with pk_live_ or pk_test_
  3. Ensure the API key is correctly passed in the widget initialization
  4. Check that your account is active and not suspended

Issue: 429 Too Many Requests

Cause: Rate limit exceeded

Solution:

  1. Check the rate limit headers in the response
  2. Wait for the rate limit window to reset
  3. Implement exponential backoff in your integration
  4. Contact support if you need higher rate limits

Issue: CORS Errors

Cause: Cross-origin request blocked by browser

Solution:

  1. Verify your domain is added to allowed origins in your dashboard
  2. Check that you're using the correct API endpoint URL
  3. 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:

  1. For testing, use testState: "CA" to override detection
  2. Location detection uses multiple methods (IP, timezone) for accuracy
  3. 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

Still Need Help?

Can't find a solution? Our support team is here to help.

Related Documentation