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

@thspian/circuul-core

v0.1.3

Published

Circuul install attribution core client — framework-agnostic

Downloads

55

Readme

@thspian/circuul-core

Framework-agnostic Circuul HTTP client for Thspian UGC CPA attribution (app install + web visit).

Used by @thspian/circuul-react and @thspian/circuul-react-native. You can also call it directly from Node or plain browser JS.


Before you install

  1. On thspian.com, create a UGC campaign with app install (or web visit) CPA enabled.
  2. Sync / open Circuul settings for that campaign and copy your app token (cat_…).
  3. Pass that token into createClient({ appToken: 'cat_…' }).

Without a campaign and cat_… token, attribution will not work.


Install

npm install @thspian/circuul-core

Requires Node 18+ (uses global fetch).


Quick start

import { createClient, extractCodeFromSearch } from '@thspian/circuul-core';

const circuul = createClient({
  appToken: 'cat_…', // from your Thspian campaign — only required field
});

// Web visit (landing page)
const visit = await circuul.visitConfirm({
  code: extractCodeFromSearch(window.location.search),
});

// App install (native / RN first open)
const match = await circuul.match({
  platform: 'ios',
  install_id: 'persistent-device-uuid',
});

Both match and visitConfirm always resolve — they never throw. Check result.attributed.


API

createClient({ appToken, env?, apiBase? })

| Option | Required | Description | |--------|----------|-------------| | appToken | yes | Campaign token from Thspian (cat_…) | | env | no | 'prod' (default) or 'dev' | | apiBase | no | Explicit override — wins over env. Local/custom only. |

Returns:

| Method | Use | |--------|-----| | match(payload) | First open after install — credits install CPA | | visitConfirm(payload) | Landing page load — credits web-visit CPA (sends app_token) | | recordClick(payload) | Optional explicit click record |

DEFAULT_API_BASE / API_BASES / resolveApiBase()

Production default, known env hosts, and helper to resolve the API URL.

extractCodeFromSearch(search)

Reads circuul_ref, ref, circuul, code, or utm_content from a query string.

shouldPersistMatched(result)

Helper for SDKs: whether a result is terminal (safe to mark “already tried”).


Environment

// Production (default)
createClient({ appToken: 'cat_…' });

// Dev
createClient({ appToken: 'cat_…', env: 'dev' });

| env | API base | |-------|----------| | 'prod' | https://dashboard.thspian.com/api/v1 | | 'dev' | https://dev-api.thspian.com/api/v1 |


Custom / local override

createClient({
  appToken: 'cat_…',
  apiBase: 'http://localhost:3000/api/v1',
});

apiBase overrides env when both are set.

Production apps should omit both unless you need dev or local testing.


Related packages

Docs: thspian.com · GitHub