Script Generator
Your AffRank tracking script is unique to your account. The Script Generator page shows it, lets you copy it, and provides installation instructions for common platforms.
Finding your script
Go to Dashboard → Domain & Script. Your script tag is shown at the top:
<script src="https://api.affrank.ai/api/affiliate/engine/YOUR_USER_ID.js"></script>Click Copy to copy it to your clipboard.
What the script does
When a page on your site loads:
- The script fetches your active affiliate links from AffRank
- It scans the page’s text content for your configured keywords
- It wraps matching keywords in affiliate links with proper
relattributes - It listens for clicks and sends click data to AffRank for tracking
The script loads asynchronously. It won’t block your page from rendering and has no measurable impact on Core Web Vitals or page speed scores. The script itself is approximately 4KB gzipped.
One script for all your domains
Your script tag is the same regardless of how many domains you have. The same YOUR_USER_ID.js script works on all your verified domains — AffRank serves the correct affiliate links for each domain automatically.
Verifying the script is working
After installing the script:
- Open your website in Chrome or Firefox
- Press F12 to open Developer Tools
- Click the Network tab
- Refresh the page
- Search for
enginein the network requests - You should see a request to
api.affrank.aireturning a 200 status
If you see the 200 response, the script is loading correctly.
Troubleshooting
Script returns a non-200 status
- Double-check your User ID in the script URL — it should match exactly what’s shown in your dashboard
- Make sure your AffRank account is active (check Settings → Billing)
Script loads but links don’t appear
- Verify your affiliate links are set to Active in the Affiliate Links dashboard
- Confirm the keyword appears in your page’s visible text content (not in navigation or menus)
- Check that your domain is verified — unverified domains won’t inject links
Nothing in the Network tab
- The script tag may not be in the
<head>— check your site’s page source (right-click → View Page Source) - A browser extension may be blocking the request — try in incognito mode
For full platform-specific installation instructions, see Installing the Script.