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

@segment/analytics-core

Package Overview
Dependencies
Maintainers
286
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@segment/analytics-core

This package represents core 'shared' functionality that is shared by analytics packages. This is not designed to be used directly, but internal to analytics-node and analytics-browser.

  • 1.8.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
286
Created

What is @segment/analytics-core?

@segment/analytics-core is a core library for Segment's analytics tracking. It provides a set of tools to track user interactions, manage user identities, and send data to various analytics services.

What are @segment/analytics-core's main functionalities?

Track Events

The `track` method allows you to record any actions your users perform. It takes an event name and an optional properties object.

const Analytics = require('@segment/analytics-core');
const analytics = new Analytics();

analytics.track('User Signed Up', {
  plan: 'Pro Annual',
  accountType: 'Facebook'
});

Identify Users

The `identify` method lets you tie a user to their actions and record traits about them. It takes a user ID and an optional traits object.

const Analytics = require('@segment/analytics-core');
const analytics = new Analytics();

analytics.identify('userId123', {
  email: 'user@example.com',
  name: 'John Doe'
});

Group Users

The `group` method allows you to associate an individual user with a group, like a company or organization. It takes a group ID and an optional traits object.

const Analytics = require('@segment/analytics-core');
const analytics = new Analytics();

analytics.group('groupId123', {
  name: 'Segment',
  industry: 'Analytics'
});

Page Views

The `page` method lets you record page views on your website. It takes a page name and an optional properties object.

const Analytics = require('@segment/analytics-core');
const analytics = new Analytics();

analytics.page('Home', {
  title: 'Home Page',
  url: 'https://example.com/home'
});

Other packages similar to @segment/analytics-core

FAQs

Package last updated on 25 Sep 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