Testing BehaviourCode on Localhost or VPN
Learn how to test BehaviourCode session recording in development environments like localhost or VPN.
Setting Up for localhost Recording
To test BehaviourCode on localhost, follow these steps:
- Add the CDN Script: Include the BehaviourCode CDN snippet in your local environment's HTML file.
- Run Your Application Locally: Start your application on localhost using your preferred method (e.g.,
npm start
,python -m http.server
, etc.). - Verify BehaviourCode Initialization: Open your browser’s developer tools and check the Console tab to ensure BehaviourCode has successfully initialized. You should see a message confirming the connection.
Testing in a VPN Environment
If you’re testing behind a VPN, follow these additional steps:
- Whitelist BehaviourCode’s CDN: Ensure the VPN allows traffic to the CDN. BehaviourCode requires access to this domain to load its resources and send recorded data.
- Access Your Local Server Through VPN: Make sure your VPN setup supports accessing your localhost server or a staging server.
- Validate Recordings: Use the BehaviourCode dashboard to check if sessions are being recorded correctly.
Common Issues and Solutions
Issue: Sessions Are Not Recorded on localhost
Solution: Ensure that the CDN script is included on all pages where recording is required. Double-check the init method for the correct project and organization IDs.
Issue: VPN Blocks the CDN
Solution: Update your VPN settings to allow traffic to BehaviourCode’s CDN URL. Alternatively, temporarily disable the VPN for testing.
Issue: JavaScript Errors During Local Testing
Solution: Open your browser console to identify any errors related to the BehaviourCode script and resolve them accordingly.
Benefits of localhost Testing
- Debug session recording configurations in real-time.
- Validate sensitive data masking and ensure your app adheres to privacy policies.
- Test different page flows and scenarios before moving to production.
Reach Out for Support
If you encounter any issues while testing BehaviourCode on localhost or behind a VPN, our support team is ready to assist. Send us your setup details and error logs, and we’ll help you resolve the problem quickly.
Empower your development process with BehaviourCode—record, test, and deploy with confidence!