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

@dawdlo/sdk

v0.1.0

Published

Dawdlo advertiser SDK — campaign management plus dwref conversion tracking (capture + postback).

Downloads

52

Readme

@dawdlo/sdk

Advertiser SDK for Dawdlo — manage campaigns and track conversions without hand-rolling HTTP calls. It wraps the dwref attribution flow end to end: capture the token on your landing page, then post back the conversion you care about (signup, activation, purchase).

npm install @dawdlo/sdk

Zero runtime dependencies. Ships ESM + CJS + types, plus a browser drop-in.

The flow

  1. A developer clicks your sponsor line → Dawdlo redirects to your landing page with ?dwref=<token>.
  2. Capture the token and store it against the visitor.
  3. When that visitor converts, post the token back. Dawdlo bills your CPA and credits the developer's cashback — once, idempotently.

1. Capture the dwref

Server-side (Express):

import { expressCapture, readStoredDwref } from '@dawdlo/sdk';

app.use(expressCapture()); // sets a `dwref` cookie from ?dwref on any request

Server-side (Next.js / fetch handlers):

import { captureFromRequest } from '@dawdlo/sdk';

export function middleware(request: Request) {
  const { setCookie } = captureFromRequest(request);
  const res = NextResponse.next();
  if (setCookie) res.headers.set('Set-Cookie', setCookie);
  return res;
}

Browser drop-in (no server capture available):

<script src="https://unpkg.com/@dawdlo/sdk/dist/dawdlo-capture.global.js"></script>
<!-- auto-captures ?dwref on load; read later with Dawdlo.getStoredDwref() -->

2. Report the conversion

import { DawdloAdvertiser, readStoredDwref } from '@dawdlo/sdk';

const dawdlo = new DawdloAdvertiser({ apiKey: process.env.DAWDLO_ADV_KEY! });

app.post('/signup', async (req, res) => {
  const user = await createUser(req.body);
  const dwref = readStoredDwref(req);
  if (dwref) {
    await dawdlo.reportConversion({
      dwref,
      dedupeKey: user.id,      // idempotency — safe to retry
      eventType: 'signup',
    });
  }
  res.json({ ok: true });
});

Idempotent: a duplicate dedupeKey (or replayed token) returns { duplicate: true } and never double-charges. An expired (7-day) or forged token throws a DawdloApiError (err.isExpired, err.isInvalidToken).

3. Manage & track campaigns

// Create a CPC campaign (advertiser billed per click).
const { id } = await dawdlo.createCampaign({
  creativeText: 'Acme — ship faster',
  url: 'https://acme.dev',
  budgetUsd: 500,
  pricingModel: 'cpc',
  cpcUsd: 0.5,
});

// Or pay per conversion (CPA) with a developer cashback share.
await dawdlo.createCampaign({
  creativeText: 'Acme — ship faster',
  url: 'https://acme.dev',
  budgetUsd: 500,
  pricingModel: 'cpa',
  cpaUsd: 50,
  cashbackPct: 55,
});

// Track performance.
const { balanceUsd, campaigns } = await dawdlo.listCampaigns();
for (const c of campaigns) {
  console.log(c.id, c.status, c.clicks, c.conversions, `$${c.spentUsd}`);
}

await dawdlo.updateCampaign(id, { status: 'paused' });

Pricing models

| pricingModel | Advertiser pays… | Required field | | --- | --- | --- | | cpm | per 1,000 impressions | bidCpmUsd | | cpa | per confirmed conversion | cpaUsd (+ cashbackPct) | | cpc | per click | cpcUsd | | hybrid | impressions and conversions | bidCpmUsd + cpaUsd |

Configuration

new DawdloAdvertiser({
  apiKey: 'advk_…',            // required
  host: 'https://dawdlo-api.fly.dev', // default
  timeoutMs: 10_000,           // per request
  fetch: customFetch,          // optional injection
});

License

MIT