@3halves-labs/score-tracker
v1.0.13
Published
Lightweight React-friendly website tracking SDK for Score platform. Batching, session/UTM, SPA route, scroll, video, and custom events.
Downloads
3
Readme
@3halveslabs/score-tracker
React-friendly tracking SDK for the Score platform.
- ✅ Batching & retry
- ✅ Session/anonymous IDs
- ✅ UTM & referrer capture
- ✅ SPA route + pageviews
- ✅ Scroll thresholds
- ✅ Video events (play/pause/end)
- ✅ Simple PII scrubbing (denylist)
- ✅ React provider + hook
Install
npm i @3halveslabs/score-tracker
# or
pnpm add @3halveslabs/score-trackerQuick start
import { ScoreTracker } from '@3halveslabs/score-tracker';
import { ScoreProvider, useScore } from '@3halveslabs/score-tracker/react';
const tracker = new ScoreTracker({
publishableKey: 'pub_abc123',
endpoint: 'https://middleware.example.com/api/tracking/website',
siteId: 'mysite',
batch: { max: 20, intervalMs: 2500 },
respectDNT: true,
autoPageviews: true,
autoRouteChange: true,
autoScroll: [25,50,75,100],
autoVideo: true,
debug: false
});
function App() {
return (
<ScoreProvider tracker={tracker}>
{/* your app */}
</ScoreProvider>
);
}CI: Publish from Gitea to npm
- Create a secret in your Gitea repo → Actions secrets:
NPM_TOKEN(from npmjs.com with publish rights). - Push this repo. Tag a release matching
package.json.version:git tag v1.0.0 git push origin v1.0.0 - The workflow at
.gitea/workflows/publish.ymlbuilds and publishes to npm if the tag equalsv<version>.....
