Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
@snowplow/browser-tracker-core
Advanced tools
@snowplow/browser-tracker-core is a core library for Snowplow's browser tracking. It provides the essential functionalities to track user interactions and events on web pages, enabling detailed analytics and insights.
Initialize Tracker
This feature allows you to initialize a new Snowplow tracker instance. You need to provide a tracker namespace, the collector endpoint, and optional configuration settings such as the application ID.
const { newTracker } = require('@snowplow/browser-tracker-core');
const tracker = newTracker('sp1', 'my-collector.com', { appId: 'my-app-id' });
Track Page View
This feature enables tracking of page views. It sends an event to the collector whenever a page is viewed, which is essential for understanding user navigation and engagement.
tracker.trackPageView();
Track Custom Events
This feature allows you to track custom events by defining a self-describing event schema and data. It is useful for capturing specific user interactions that are not covered by standard event types.
tracker.trackSelfDescribingEvent({
schema: 'iglu:com.acme/event/jsonschema/1-0-0',
data: {
eventCategory: 'category',
eventAction: 'action',
eventLabel: 'label',
eventValue: 'value'
}
});
Track Structured Events
This feature enables tracking of structured events, which are predefined event types with specific properties. It is useful for capturing common user interactions like clicks, form submissions, and more.
tracker.trackStructEvent({
category: 'category',
action: 'action',
label: 'label',
property: 'property',
value: 'value'
});
Google Analytics is a widely-used web analytics service that tracks and reports website traffic. It offers similar functionalities to @snowplow/browser-tracker-core, such as tracking page views, custom events, and user interactions. However, Google Analytics is a hosted service with a different data ownership model compared to Snowplow, which allows for more control over data.
Mixpanel is an advanced analytics platform that focuses on tracking user interactions and engagement. The mixpanel-browser package provides functionalities similar to @snowplow/browser-tracker-core, including tracking events and user properties. Mixpanel also offers powerful segmentation and analysis tools, but it is a hosted service with different pricing and data control compared to Snowplow.
Browser Core module to be used by Snowplow Browser based trackers.
It should rarely be used alone, you probably want @snowplow/browser-tracker
.
Part of the Snowplow JavaScript Tracker monorepo.
Build with Node.js (12 LTS or 14 LTS) and Rush.
npm install -g @microsoft/rush
git clone https://github.com/snowplow/snowplow-javascript-tracker.git
rush update
cd libraries/browser-tracker-core
rushx build
rushx test
With npm:
npm install @snowplow/browser-tracker-core
import { addTracker, createSharedState, getTracker } from '@snowplow/browser-tracker-core';
const sharedState = createSharedState();
const tracker = addTracker('snowplow_sp1', 'sp1', 'js-3.0.0', '{{collector}}', sharedState, {}); // Also stores reference at module level
const sameTracker = getTracker('snowplow_sp1');
const domainUserId = tracker.getDomainUserId();
This package contains a number of helper functions for tracking events in the browser as well as the core functionality of the Snowplow JavaScript Tracker.
Licensed and distributed under the BSD 3-Clause License (An OSI Approved License).
Copyright (c) 2022 Snowplow Analytics Ltd, 2010 Anthon Pang.
All rights reserved.
FAQs
Core functionality for Snowplow Browser trackers
The npm package @snowplow/browser-tracker-core receives a total of 262,090 weekly downloads. As such, @snowplow/browser-tracker-core popularity was classified as popular.
We found that @snowplow/browser-tracker-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.