Socket
Book a DemoInstallSign in
Socket

@amplitude/analytics-browser

Package Overview
Dependencies
Maintainers
21
Versions
220
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@amplitude/analytics-browser

Official Amplitude SDK for Web

1.13.7
Source
npmnpm
Version published
Weekly downloads
799K
4.7%
Maintainers
21
Weekly downloads
 
Created

What is @amplitude/analytics-browser?

@amplitude/analytics-browser is an npm package that allows you to integrate Amplitude's analytics capabilities into your web applications. It provides tools for tracking user events, managing user identities, and setting up custom properties to gain insights into user behavior.

What are @amplitude/analytics-browser's main functionalities?

Initialize Amplitude

This feature allows you to initialize the Amplitude analytics instance with your API key, which is necessary to start tracking events.

const amplitude = require('@amplitude/analytics-browser');
amplitude.init('YOUR_API_KEY');

Track Events

This feature allows you to track specific events within your application. In this example, a 'Button Clicked' event is tracked with an additional property 'buttonName'.

amplitude.track('Button Clicked', { buttonName: 'Sign Up' });

Identify Users

This feature allows you to identify users and set user properties. In this example, a user with ID 'user123' is identified and a custom property 'plan' is set to 'premium'.

amplitude.identify({ userId: 'user123', userProperties: { plan: 'premium' } });

Set User Properties

This feature allows you to set custom properties for a user. In this example, the user's age and gender are set.

amplitude.setUserProperties({ age: 30, gender: 'female' });

Log Revenue

This feature allows you to log revenue events. In this example, a revenue event is logged with an amount of 10.99 for product 'product_123' with a quantity of 1.

amplitude.logRevenue(10.99, 'product_123', 1);

Other packages similar to @amplitude/analytics-browser

Keywords

analytics

FAQs

Package last updated on 14 Jan 2025

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.