🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

affitor-sdk

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

affitor-sdk

Affitor browser tracking SDK — typed init()/signup() for affiliate attribution.

latest
Source
npmnpm
Version
0.2.0
Version published
Maintainers
1
Created
Source

affitor-sdk

Affitor browser tracking SDK — typed init() / signup() for affiliate attribution.

Wraps the Affitor tracker: captures ?aff= attribution, stores the click id in a first-party cookie (affitor_click_id), and reports click + lead (signup) events. Same endpoints and payloads as the legacy affitor-tracker.js script.

Install

npm i affitor-sdk

Usage

import { init, signup } from 'affitor-sdk';

// On app load (client-side):
init({ programId: 123 });

// At signup / checkout:
await signup('customer_123', 'user@example.com');

SSR-safe: init() is a no-op on the server, so importing it anywhere in a Next.js / SSR app is safe.

Options

OptionTypeDescription
programIdnumber | stringAffiliate program id.
debugbooleanVerbose console logging.
cookieDomainstringForce a cookie domain (e.g. .example.com). Auto-detected otherwise.
apiBasestringOverride the tracking API base (default https://api.affitor.com).

API

  • init(options) — start attribution (captures ?aff=, loads/sets the cookie).
  • signup(customerKey, email?) — track a lead/signup.
  • trackClick(affiliateUrl?, existingClickId?) — track a click manually.
  • getClickId() — current click id, or null.
  • getData(){ clickId, programId, hasAttribution, affiliateUrl }.

A class export (AffitorTracker) is also available for multi-instance use.

Keywords

affiliate

FAQs

Package last updated on 10 Jun 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts