sentalong
v0.2.0
Published
Sentalong affiliate tracking for web apps and Node backends — capture partner clicks, attribute signups.
Maintainers
Readme
sentalong
Affiliate tracking for web apps and Node backends, on the Sentalong
platform: capture partner clicks (?via=handle), persist the click id, and
attribute signups. The npm sibling of the <script src="…/t.js"> snippet —
use this when you'd rather import than paste a script tag.
npm install sentalongBrowser (SPA) quickstart
import { configure, capture, identify } from "sentalong";
// Once, at app startup:
configure("https://YOUR-SENTALONG-HOST", "prg_XXXXXXXX");
// On page load / route change — records a click when ?via= is present:
capture();
// At signup — ties the click to the new account and returns the referral id:
const referralId = await identify(user.email, { externalId: user.id });The click id is persisted in localStorage for the program's cookie window
(first-click programs keep the original; last-click overwrites, matching the
server's attribution model). Visiting with ?via=test pings the server as a
dry run — it logs Sentalong: test click received, records nothing, stores
nothing, and lets Settings → Tracking's Run checks confirm the install.
Node backend
If your signup happens server-side, forward the click id from the browser
(getClickId()) with the signup request and attribute it there:
import { identifyClick, qualifyClick } from "sentalong";
const referralId = await identifyClick({
baseUrl: "https://YOUR-SENTALONG-HOST",
cid, // sent by your frontend
email: newUser.email,
externalId: newUser.id,
});
// Pay-per-lead programs — mark the lead qualified when it actually is:
await qualifyClick({ baseUrl, cid, stage: "onboarded" });Store the returned referralId on your billing customer (Stripe metadata
key via_referral_id) for the strongest invoice matching.
Behavior notes
- Every call is fail-safe: network errors return
null/false, never throw (except calling beforeconfigure, which throws immediately by design). - No fingerprinting, no device identifiers, no third-party cookies — the SDK sends only the fields you see above.
- Ad-click ids (
gclid,fbclid,ttclid,twclid,li_fat_id,msclkid) and partner campaign tags (sub_id) are picked up from the URL automatically when present.
MIT — see LICENSE. Mobile apps: see the Sentalong SDKs for React Native, Flutter, Android, and iOS.
