Socket
Socket
Sign inDemoInstall

@amplitude/analytics-browser

Package Overview
Dependencies
Maintainers
21
Versions
161
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


Version published
Weekly downloads
452K
decreased by-7.69%
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

FAQs

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