New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

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.

Source
npmnpm
Version
0.1.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 25 May 2026

Related posts