Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bcp-analytics

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bcp-analytics

## Installation

  • 1.0.0-alpha.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

BCP-Analytics

Installation

Install with yarn

yarn add bcp-analytics

Install with npm

npm install bcp-analytics

Usage

Start collecting page and copy events with Segment:

const BcpAnalytics = require("bcp-analytics");

new BcpAnalytics().registerSegment({ url: $SEGMENT_URL }).start();

Define a custom user ID

Since the user ID can be anything you can define your own method of retrieving it. Simply set the get user id method so it can be used by this tool. Example:

const BcpAnalytics = require("bcp-analytics");

new BcpAnalytics()
  .registerSegment({ url: $SEGMENT_URL })
  .setGetUserId(async () => "my custom user id")
  .start();

Configuration

Manage the tracking of page and copy events by overwriting the default config. Example:

const BcpAnalytics = require("bcp-analytics");

new BcpAnalytics({
  trackPages: true,
  trackCopies: false,
  debug: true,
})
  .registerSegment({ url: $SEGMENT_URL })
  .start();

OptIn & OptOut

By default opt in is enabled. To opt out simply add it in the constructor:

const BcpAnalytics = require("bcp-analytics");

new BcpAnalytics({
  optOut: true,
})
  .registerSegment({ url: $SEGMENT_URL })
  .start();

or opt out anytime with

const BcpAnalytics = require("bcp-analytics");

const analytics = new BcpAnalytics()
  .registerSegment({ url: $SEGMENT_URL })
  .start();

// opt out
analytics.optOut();

// opt in again
analytics.optIn();

FAQs

Package last updated on 16 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc