Install with npm:
npm install @putdotio/pas-jsimport createPasClient from "@putdotio/pas-js";
const pas = createPasClient();
pas.identify({
id: "42",
hash: "signed-user-hash",
properties: {
plan: "pro",
},
});
pas.track("transfer_completed", {
transfer_id: 123,
});The default client keeps an anonymous identifier in browser cookies and can send identity, event, and page-view payloads to PAS:
import createPasClient from "@putdotio/pas-js";
const pas = createPasClient();
pas.alias({ id: "42", hash: "signed-user-hash" });
pas.pageView();Invalid retry-cookie collections and entries are discarded during initialization. Valid queued requests remain eligible for replay. The retry cookie retains at most 20 recent requests within 3000 bytes of percent-encoded JSON. Requests that cannot fit individually are discarded; older requests are dropped when either bound is reached. Retained requests keep the existing replay and cookie expiry behavior.
| Method Name | Parameters |
|---|---|
| alias | ({ id: string/number, hash: string }) |
| identify | ({ id: string/number, hash: string, properties?: object }) |
| track | (name: string, properties?: object) |
| pageView | - |
See Contributing
This project is available under the MIT License
