npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

taapit-sdk

v1.0.4

Published

Taapit Conversion Tracking SDK - Track leads and sales from your short links

Readme

taapit-sdk

Official Taapit SDK for conversion tracking. Track leads and sales from your short links.

Installation

npm install taapit-sdk
# or
yarn add taapit-sdk
# or
pnpm add taapit-sdk

Quick Start

Server-Side (Node.js)

Use this for secure, server-side tracking that can't be blocked by ad blockers.

import { Taapit } from 'taapit-sdk';

const taapit = new Taapit({
  apiKey: process.env.TAAPIT_API_KEY, // Secret API key (never expose!)
});

// Get tracking ID from cookie (ta_tid)
const trackingId = req.cookies['ta_tid'];

// Track a lead (e.g., after user sign up)
await taapit.track.lead({
  trackingId,
  customer: {
    externalId: 'user_123',
    email: '[email protected]',
    name: 'John Doe',
  },
  eventName: 'Sign up',
  metadata: { source: 'landing-page' },
});

// Track a sale (e.g., after purchase)
await taapit.track.sale({
  trackingId,
  customer: { externalId: 'user_123' },
  amount: 2999, // Amount in cents (29.99)
  currency: 'eur',
  invoiceId: 'inv_123',
});

React (Client-Side) - Recommended

For React applications with client-side tracking. Just add the Analytics component - no provider wrapper needed!

// app/layout.tsx
import { Analytics } from 'taapit-sdk/react';

export default function RootLayout({ children }) {
  return (
    <html>
      <body>
        {children}
        <Analytics publishableKey="taapit_pk_xxx" />
      </body>
    </html>
  );
}
// In your components - Option 1: Use the hook
import { useTaapitAnalytics } from 'taapit-sdk/react';

function SignUpForm() {
  const { trackLead, isReady, trackingId } = useTaapitAnalytics();

  const handleSubmit = async (formData) => {
    const user = await createUser(formData);
    
    trackLead({
      customer: { externalId: user.id, email: formData.email },
    });
  };

  return <form onSubmit={handleSubmit}>...</form>;
}
// Option 2: Use the global taapit object (works anywhere)
import { taapit } from 'taapit-sdk/react';

function handleSignUp(userId: string) {
  taapit.trackLead({
    customer: { externalId: userId },
  });
}

React (Provider-based) - Legacy

If you prefer the provider pattern:

import { TaapitProvider, useTaapit } from 'taapit-sdk/react';

// In layout
<TaapitProvider publishableKey="taapit_pk_xxx">
  {children}
</TaapitProvider>

// In components
const { trackLead } = useTaapit();

Vanilla JavaScript (Browser)

For non-React websites.

<script src="https://unpkg.com/taapit-sdk/dist/browser/index.js"></script>
<script>
  // Configure with your publishable key
  taapit.configure({ publishableKey: 'taapit_pk_xxx' });
  
  // Track lead
  document.getElementById('signup-form').addEventListener('submit', (e) => {
    taapit.trackLead({
      customer: {
        externalId: 'user_123',
        email: '[email protected]',
      },
      eventName: 'Sign up',
    });
  });
  
  // Track sale
  taapit.trackSale({
    customer: { externalId: 'user_123' },
    amount: 2999,
    currency: 'eur',
  });
</script>

Or with ES modules:

import { taapit } from 'taapit-sdk/browser';

taapit.configure({ publishableKey: 'taapit_pk_xxx' });
taapit.trackLead({ customer: { externalId: 'user_123' } });

API Reference

Taapit (Server-Side)

const taapit = new Taapit(config);

Config Options: | Option | Type | Description | |--------|------|-------------| | apiKey | string | Secret API key (from dashboard) | | baseUrl | string | API base URL (default: https://api.taap.it) |

Methods:

  • taapit.track.lead(params) - Track a lead conversion
  • taapit.track.sale(params) - Track a sale conversion

Analytics (React - Recommended)

<Analytics publishableKey="taapit_pk_xxx" baseUrl="..." />

Props: | Prop | Type | Description | |------|------|-------------| | publishableKey | string | Publishable key (safe for client) | | baseUrl | string | API base URL (optional) |

useTaapitAnalytics() Hook

const { isReady, trackingId, trackLead, trackSale } = useTaapitAnalytics();

Returns: | Property | Type | Description | |----------|------|-------------| | isReady | boolean | SDK initialized | | trackingId | string \| undefined | Current tracking ID | | trackLead | function | Track lead event | | trackSale | function | Track sale event |

taapit Global Object

import { taapit } from 'taapit-sdk/react';

taapit.isReady;      // boolean
taapit.trackingId;   // string | undefined
taapit.trackLead(data);
taapit.trackSale(data);

TaapitProvider (React - Legacy)

<TaapitProvider publishableKey="taapit_pk_xxx">
  {children}
</TaapitProvider>

useTaapit() Hook (Legacy)

const { isLoaded, trackingId, trackLead, trackSale } = useTaapit();

Track Lead Parameters

interface TrackLeadParams {
  trackingId?: string;        // Auto-detected in client SDK
  customer: {
    externalId: string;       // Required: Your internal user ID
    email?: string;
    firstname?: string;
    lastname?: string;
    phoneNumber?: string;
    avatarUrl?: string;
  };
  metadata?: Record<string, unknown>;
}

Track Sale Parameters

interface TrackSaleParams {
  trackingId?: string;        // Auto-detected in client SDK
  customer: {
    externalId: string;       // Required: Your internal user ID
    email?: string;
    firstname?: string;
    lastname?: string;
    phoneNumber?: string;
    avatarUrl?: string;
  };
  amount: number;             // Amount in cents (2999 = 29.99)
  currency: string;           // e.g., "eur", "usd"
  metadata?: Record<string, unknown>;
}

How Tracking Works

  1. User clicks a Taapit link → Landing page URL includes ?ta_tid=xxx
  2. SDK stores tracking ID → Saved to ta_tid cookie (365 days)
  3. User converts → You call trackLead() or trackSale()
  4. Attribution recorded → Conversion linked to original link click

Security

  • API Key (TAAPIT_API_KEY): Secret, server-side only. Never expose in client code.
  • Publishable Key (taapit_pk_xxx): Safe for client-side. Can only send events, not read data.

TypeScript Support

Full TypeScript support with exported types:

import type {
  TaapitConfig,
  TaapitCustomer,
  TrackLeadParams,
  TrackSaleParams,
} from 'taapit-sdk';

License

MIT