New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

traaaction

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

traaaction

TypeScript/JavaScript SDK for Traaaction affiliate tracking and management

latest
Source
npmnpm
Version
1.3.0
Version published
Maintainers
1
Created
Source

traaaction

Official TypeScript/JavaScript SDK for Traaaction — the affiliate SaaS platform connecting startups and sellers.

Installation

npm install traaaction
# or
yarn add traaaction
# or
pnpm add traaaction

Quick Start

import { Traaaction } from 'traaaction'

const trac = new Traaaction({
  apiKey: process.env.TRAAACTION_API_KEY,  // trac_live_xxx
})

Tracking

Track affiliate events from your server. Use the public key (pk_xxx) or secret key.

// After a user signs up
await trac.track.lead({
  customerId: user.id,
  clickId: request.cookies.get('trac_click_id')?.value,
  eventName: 'sign_up',
  customerEmail: user.email,
})

// Manual sale (if not using Stripe webhooks)
await trac.track.sale({
  customerId: user.id,
  amount: 5900,  // €59 in cents
  currency: 'EUR',
})

Management API

All management methods require a secret key (trac_live_xxx).

// List links
const { data: links, meta } = await trac.links.list({ page: 1, limit: 50 })

// Create a link
const { data: link } = await trac.links.create({
  destination: 'https://example.com/landing',
  missionId: 'mission_id_here',
})

// Update a link
await trac.links.update(link.id, { channel: 'email' })

// Delete a link
await trac.links.delete(link.id)

Missions

const { data: missions } = await trac.missions.list({ status: 'ACTIVE' })
const { data: mission } = await trac.missions.get('mission_id')

Sellers

const { data: sellers } = await trac.sellers.list({ status: 'APPROVED' })
const { data: seller } = await trac.sellers.get('seller_id')
// seller.balance includes { pending, due, paid_total }

Customers

const { data: customers } = await trac.customers.list()
// Lookup by your app's user ID
const { data: customer } = await trac.customers.get(user.id)

Commissions

const { data: commissions } = await trac.commissions.list({
  status: 'PROCEED',
  sellerId: 'seller_id',
})

Payouts

const { data: payouts } = await trac.payouts.list()

Analytics

const { data: stats } = await trac.analytics.retrieve({ interval: '30d' })
// stats.clicks, stats.leads, stats.sales, stats.revenue, stats.timeseries

Error Handling

import { Traaaction, TraaactionAPIError, TraaactionAuthError } from 'traaaction'

try {
  const { data } = await trac.links.get('invalid_id')
} catch (error) {
  if (error instanceof TraaactionAuthError) {
    console.error('Invalid API key')
  } else if (error instanceof TraaactionAPIError) {
    console.error(`API error ${error.statusCode}: ${error.code}`)
  }
}

Requirements

  • Node.js 18+ (uses native fetch)
  • Works in Edge Runtime (Vercel, Cloudflare Workers)

License

MIT

Keywords

affiliate

FAQs

Package last updated on 08 Mar 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