
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@aircall/tracker
Advanced tools
The tracker package, @aircall/tracker, serves as a common implementation for tracking events across Aircall frontend applications. This module is essentially a wrapper around the RudderStack JavaScript SDK, providing a simplified interface for tracking user activity in our applications.
The @aircall/tracker promotes the use of a unified tracking implementation across all Aircall frontend teams. This ensures consistency, reduces redundancy, and gives us the flexibility to switch to another tracking solution with minimal effort if the need arises.
To use the @aircall/tracker package in your project, follow the steps below:
Using npm:
npm install @aircall/tracker
Using yarn:
yarn add @aircall/tracker
import tracker from '@aircall/tracker';
tracker.init({ key: 'YOUR_RUDDERSTACK_WRITE_KEY' });
Replace 'YOUR_RUDDERSTACK_WRITE_KEY'
with the actual Rudderstack write key provided by the data team for your application.
After initializing the tracker module, you can use it for tracking events in your application. The tracker instance exposes four main methods: identify
, track
, addContext
, and reset
.
The identify
method allows for user identification. It takes an identification object as an argument, which includes the user ID and any other relevant information you want to associate with the user.
tracker.identify({
created_at: "2022-09-05T11:05:45.000Z"
device: "web"
email: 'test@example.com',
environment: "production",
is_admin: false,
language: "en_US"
name: 'Test User',
os_version: "OS X 10.15.7 64-bit"
platform: 'phone',
release: "v2.85.2"
user_id: 123, // The user ID
});
The TrackerIdentification
TypeScript interface outlines the necessary payload properties for tracking identification, as required by the data team. You can refer to the interface definition for more details, or import it from the package and use it as a type for your identification object.
import { TrackerIdentification } from '@aircall/tracker';
const identificationObject: TrackerIdentification = {
user_id: 123,
/* ... */
};
For additional information on the identify
method, please refer to the Identify | RudderStack JavaScript SDK API docs.
The addContext
method is used to add context to the tracker instance, which will be sent along with all subsequent tracking events. It accepts a context object as an argument.
We use it on the phone app to add the cti_from_application
property, which indicates the CTI application from which the event was sent.
tracker.addContext({ cti_from_application: 'salesforce' });
The track
method is used for tracking user events. It accepts the tracking event name and an optional event properties object as arguments. This method also includes any context properties that were previously set via the addContext
method in the event payload.
tracker.track('event_name', {
property1: 'value1',
property2: 'value2',
property3: 'value3',
});
For additional information on the track
method, please refer to the Track | RudderStack JavaScript SDK API docs.
The page
method is used to record a page view event. It accepts an optional properties object as an argument. This method also includes any context properties that were previously set via the addContext
method in the event payload.
tracker.page({
property1: 'value1',
property2: 'value2',
property3: 'value3',
});
For additional information on the page
method, please refer to the Page | RudderStack JavaScript SDK API docs.
The reset
method is used to reset the information related to the previously identified user. It is used when a user logs out of the application.
tracker.reset();
For additional information on the reset
method, please refer to the Track | RudderStack JavaScript SDK API docs.
FAQs
## Introduction
The npm package @aircall/tracker receives a total of 42 weekly downloads. As such, @aircall/tracker popularity was classified as not popular.
We found that @aircall/tracker demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.