Skip to content

Installing the Script

Your AffRank script is a single <script> tag that belongs in your site’s <head>. Once it’s there, AffRank handles everything else automatically.

Your script tag

Find your unique script in Dashboard → Domain & Script:

<script src="https://api.affrank.ai/api/affiliate/engine/YOUR_USER_ID.js"></script>

Replace YOUR_USER_ID with the ID shown in your dashboard. This same script works across all your verified domains.

Platform instructions

WordPress

Use the Insert Headers and Footers plugin (free, by WPBeginner):

  1. Install and activate the plugin
  2. Go to Settings → Insert Headers and Footers
  3. Paste your script into the Scripts in Header box
  4. Click Save

Shopify

  1. Online Store → Themes → Edit code
  2. Open theme.liquid
  3. Paste the script just before </head>
  4. Click Save

Webflow

  1. Site Settings → Custom Code
  2. Paste into the Head Code field
  3. Publish your site

Squarespace

  1. Settings → Advanced → Code Injection
  2. Paste into the Header field
  3. Save

Wix

  1. Settings → Custom Code
  2. Click + Add Custom Code
  3. Paste the script, set placement to Head, apply to All Pages
  4. Save and publish

Next.js

In app/layout.tsx (App Router):

import Script from 'next/script'
export default function RootLayout({ children }) {
return (
<html>
<head>
<Script
src="https://api.affrank.ai/api/affiliate/engine/YOUR_USER_ID.js"
strategy="afterInteractive"
/>
</head>
<body>{children}</body>
</html>
)
}

Google Tag Manager

  1. Tags → New → Custom HTML
  2. Paste your script tag
  3. Triggering: All Pages
  4. Save and publish the container

GTM works with any platform — if your site already uses GTM, this is the easiest path.

Static HTML

Paste directly into the <head> of your HTML files:

<!DOCTYPE html>
<html>
<head>
<title>My Site</title>
<script src="https://api.affrank.ai/api/affiliate/engine/YOUR_USER_ID.js"></script>
</head>
<body>...</body>
</html>

Verifying the script is installed

  1. Open your website in Chrome or Firefox
  2. Press F12 → Network tab
  3. Refresh the page
  4. Search for engine in the request list
  5. You should see a request to api.affrank.ai with status 200

A 200 status means the script is loading correctly.

After installation

Go back to your AffRank dashboard, visit your website once to fire the signal, then click Verify next to your domain within 10 minutes. See Setting Up Your First Domain for the full verification steps.