Installing the Script
AffRank runs from a single script tag. There are no plugins, no extensions, and no code to maintain. Add the tag once and every page on your site is covered.
Your script tag
Find your personal script in Dashboard → Domain & Script. It looks like this:
<script src="https://api.affrank.ai/api/affiliate/engine/YOUR_USER_ID.js"></script>Add it inside your site’s <head> tag. That’s all that’s required.
Platform-by-platform instructions
WordPress
- Install the Insert Headers and Footers plugin (or use your theme’s header.php)
- Go to Settings → Insert Headers and Footers
- Paste your AffRank script tag into the Scripts in Header box
- Click Save
The script will now appear on every page of your WordPress site.
Shopify
- Go to Online Store → Themes → Actions → Edit Code
- Open
layout/theme.liquid - Paste your script tag just before the closing
</head>tag - Click Save
Webflow
- Go to Project Settings → Custom Code
- Paste your script tag into the Head Code box
- Click Save and publish your site
Squarespace
- Go to Settings → Advanced → Code Injection
- Paste your script tag into the Header box
- Click Save
Wix
- Go to Settings → Custom Code
- Click + Add Custom Code
- Paste your script tag, set placement to Head, and apply to All Pages
- Click Apply
Next.js / React
Add the script tag to your _document.tsx (Pages Router) or root layout.tsx (App Router):
// app/layout.tsx (App Router)export default function RootLayout({ children }) { return ( <html> <head> <script src="https://api.affrank.ai/api/affiliate/engine/YOUR_USER_ID.js" /> </head> <body>{children}</body> </html> );}Google Tag Manager
- In GTM, go to Tags → New → Custom HTML
- Paste your script tag into the HTML field
- Set the trigger to All Pages
- Click Save and Submit
Works with Segment, Tealium, and any other tag manager the same way.
Any other platform
If your platform lets you edit the site’s HTML <head> — it works. The script is plain HTML and has no platform dependencies.
After installation
Once the script is on your site:
- Visit your website so the script fires at least once
- Return to the AffRank dashboard within 10 minutes
- Click Verify next to your domain
The verify step confirms AffRank can see your domain. If you miss the 10-minute window, just visit your site again and try verifying.
What the script does
- Fetches your active affiliate links from AffRank
- Scans page text for your configured keywords
- Wraps matching text in affiliate links with
rel="nofollow sponsored noopener" - Fires a click event to AffRank’s servers when a visitor clicks
The script runs after your page content loads. It never modifies your HTML source and never blocks page rendering.