Skip to content
putdotioPublic

About

Browser analytics client for the put.io Analytics System

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Repository files navigation

put.io boncuk

pas-js

Browser analytics client for the put.io Analytics System.

CI npm version license

Installation

npm install @putdotio/pas-js

Quick Start

import 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,
});

Browser Tracking

The client keeps an anonymous identifier in a browser cookie and sends 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();

pageView sends the page's origin and path, its utm_source, utm_medium, and utm_campaign values, and only the origin of the referrer. Nothing else from either URL is sent, so search terms in them stay out of PAS. When the path itself carries something PAS must not store, such as a username or an invite code, pass the path to send instead:

pas.pageView({ path: "/files/user/FILTERED" });

Requests queued for retry are stored in a cookie and replayed on the next initialization. The queue keeps at most the 20 most recent requests within 3000 bytes of percent-encoded JSON: a request too large on its own is discarded, and the oldest are dropped when either bound is reached. Malformed queue entries are discarded on initialization.

API

Method Name Parameters
alias ({ id: string/number, hash: string })
identify ({ id: string/number, hash: string, properties?: object })
track (name: string, properties?: object)
pageView ({ path?: string })

Docs

License

This project is available under the MIT License

About

Browser analytics client for the put.io Analytics System

Topics

Resources

Contributing

Security policy

Stars

2 stars

Watchers

2 watching

Forks

Releases

Used by

Contributors

Languages