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
mixpanel
Mixpanel is a powerful analytics tool that helps you track user interactions with web and mobile applications. It offers similar functionalities to @segment/analytics-core, such as event tracking, user identification, and segmentation. However, Mixpanel also provides advanced features like A/B testing and user retention analysis.
amplitude
Amplitude is another analytics platform that focuses on product analytics. It allows you to track user actions, identify users, and analyze user behavior. Compared to @segment/analytics-core, Amplitude offers more in-depth analysis tools and a user-friendly interface for creating custom reports and dashboards.
heap
Heap automatically captures every user interaction with your web or mobile app and provides tools for analyzing this data. It offers similar functionalities to @segment/analytics-core, such as event tracking and user identification, but stands out with its automatic data capture and retroactive analysis capabilities.