SuperAPI AI Directory

click-tracking

General & other

View repository

Updated 10-15 23:25

About this skill

Click Tracking

Add the Affitor tracker to capture when visitors arrive via affiliate links (?aff=PARTNER_CODE).

Script Tag (any site)

Add to <head> on every page:

<script src="https://api.affitor.com/js/affitor-tracker.js"
  data-affitor-program-id="YOUR_PROGRAM_ID">
</script>

npm SDK (React, Next.js, any JS/TS)

npm install @affitor/tracker

React / Next.js

import { AffitorProvider } from '@affitor/tracker/react';

export default function RootLayout({ children }) {
  return (
    <AffitorProvider programId="YOUR_PROGRAM_ID">
      {children}
    </AffitorProvider>
  );
}

Any JS/TS

import { loadAffitor } from '@affitor/tracker';
const affitor = await loadAffitor('YOUR_PROGRAM_ID');

What It Does

  • Detects ?aff= parameter in URL
  • Stores affitor_click_id in a first-party cookie (60-day default)
  • Creates customer-partner relationship for attribution
  • Later signup and sale tracking use this cookie for linking

Debug Mode

Set data-affitor-debug="true" (script) or debug: true (SDK) to see tracking events in browser console.

Get Your Program ID

Run npx affitor init or find it in your Affitor dashboard under Settings.