Server-side SDKs

Scoby Analytics Node.js SDK

Welcome to the official documentation for the Scoby Analytics Node.js SDK. Here, you'll find everything you need to get started and make the most of our analytics tool.


You need your License Key and Salt to use our Node.js SDK.


To bnode-js.mdegin with, you'll need to install the SDK from the NPM registry. Depending on your package manager, you can use one of the following commands:

npm install @scoby/analytics-ts --save


yarn add @scoby/analytics-ts


Logging Page Views

Firstly, initiate the Scoby Analytics client using your License Key and salt:

import { Client } from '@scoby/analytics-ts';
const client = new Client('INSERT_YOUR_API_KEY_HERE', 'INSERT_YOUR_SALT_HERE');

Now, you can log page views asynchronously:

await client.logPageView({
  ipAddress: [IP_ADDRESS],
  requestedUrl: [REQUESTED_URL],
  referringUrl: [REFERRING_URL],
  userAgent: [USER_AGENT]

Segmenting Visitors

Segmenting visitors allows you to group them based on shared characteristics or behaviors. This in turn helps you analyze behavior patterns, which can be invaluable for your website design or marketing strategies.

When using visitor segments, you'd identify various characteristics or behaviors, like age, gender, location, etc., to segment your audience. Here's how you can use it in your TypeScript code:

await client.logPageView({
  visitorSegments: ['Subscribers', 'Women', 'Young Adults']

Please remember that Scoby Analytics emphasizes privacy. We use k-Anonymity of 25 for visitor segments to ensure each segment has at least 25 unique visitors before inclusion in any report, thereby maintaining anonymity.

Using your own Visitor ID

For precise visitor counting, you can provide a custom identifier. This identifier gets hashed before being sent to our servers for added privacy. Consult with your data protection officer before using this feature.

await client.logPageView({
  visitorId: [YOUR_VISITOR_ID]

IP Blacklisting

By default, Scoby doesn't exclude any traffic. However, if needed, you can blacklist IP ranges. The SDK supports both wildcard patterns and CIDR subnet notation.


For instance, if you want to exclude a specific IP from your data:


await client.logPageView({
  ipAddress: '',
}); // this will return false


Encountering difficulties? We're always here to assist. Reach out at