Skip to content

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

  1. Install the Insert Headers and Footers plugin (or use your theme’s header.php)
  2. Go to Settings → Insert Headers and Footers
  3. Paste your AffRank script tag into the Scripts in Header box
  4. Click Save

The script will now appear on every page of your WordPress site.

Shopify

  1. Go to Online Store → Themes → Actions → Edit Code
  2. Open layout/theme.liquid
  3. Paste your script tag just before the closing </head> tag
  4. Click Save

Webflow

  1. Go to Project Settings → Custom Code
  2. Paste your script tag into the Head Code box
  3. Click Save and publish your site

Squarespace

  1. Go to Settings → Advanced → Code Injection
  2. Paste your script tag into the Header box
  3. Click Save

Wix

  1. Go to Settings → Custom Code
  2. Click + Add Custom Code
  3. Paste your script tag, set placement to Head, and apply to All Pages
  4. 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

  1. In GTM, go to Tags → New → Custom HTML
  2. Paste your script tag into the HTML field
  3. Set the trigger to All Pages
  4. 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:

  1. Visit your website so the script fires at least once
  2. Return to the AffRank dashboard within 10 minutes
  3. 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.


Next: Add your affiliate links →