Overview #
TrafficShield offers a simple JavaScript-based integration that allows users to cloak their landing pages dynamically. This method is ideal for scenarios where direct server-side manipulation is not required.
Steps to Integrate JavaScript Cloaking #
- Generate Your JavaScript Code
- Log in to your TrafficShield account.
- Navigate to the Integration section.
- Select JavaScript Method and copy the generated script.
- Add the Script to Your Website
- Open your website’s HTML file or CMS editor.Paste the JavaScript snippet inside the
<head>
section or just before the closing</body>
tag.
<script src="https://yourdomain.com/cloak.js"></script>
- Open your website’s HTML file or CMS editor.Paste the JavaScript snippet inside the
- Verify the Implementation
- Open your website in an incognito window and test different IPs using VPNs or proxies.
- Check if blacklisted traffic is redirected properly while allowed traffic sees the original page.
- Advanced Customization
- Modify the script to check user agents, IP addresses, and referrers dynamically.
- Example of custom implementation:
<script>fetch('https://yourdomain.com/cloak-check') .then(response => response.json()) .then(data => { if (data.redirect) { window.location.href = data.url; } }); </script>