npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cordova-plugin-amplitude

v1.2.2

Published

Cordova plugin for Amplitude Analytics SDK (iOS and Android)

Readme

Cordova Plugin Amplitude

A Cordova plugin for integrating Amplitude Analytics SDK into iOS and Android native applications.

Installation

cordova plugin add cordova-plugin-amplitude

Or install from GitHub:

cordova plugin add https://github.com/jayseb11/cordova-plugin-amplitude.git

Supported Platforms

  • iOS (via AmplitudeSwift ~> 1.9)
  • Android (via com.amplitude:analytics-android:1.+)

Note: For web/browser support, use @amplitude/analytics-browser directly in your application instead of this Cordova plugin.

API Reference

Initialize

Initialize Amplitude with your API key. Call this once when your app starts.

window.Amplitude.initialize({
  apiKey: 'YOUR_API_KEY',
  userId: 'optional-user-id',
  trackingSessionEvents: true,
  minTimeBetweenSessionsMillis: 300000
}).then(() => {
  console.log('Amplitude initialized');
}).catch(error => {
  console.error('Amplitude init error:', error);
});

Config Options: | Parameter | Type | Required | Description | |-----------|------|----------|-------------| | apiKey | string | Yes | Your Amplitude API key | | userId | string | No | Optional user ID to set on init | | trackingSessionEvents | boolean | No | Enable session tracking | | minTimeBetweenSessionsMillis | number | No | Min time between sessions in ms |

Track Event

Track a custom event with optional properties.

window.Amplitude.track('Button Clicked', {
  buttonName: 'Submit',
  screen: 'Checkout',
  value: 99.99
}).then(() => {
  console.log('Event tracked');
});

Identify User

Identify a user with user ID and properties.

window.Amplitude.identify('user123', {
  email: '[email protected]',
  plan: 'premium',
  signupDate: '2024-01-01'
}).then(() => {
  console.log('User identified');
});

Set User ID

Set the user ID separately.

window.Amplitude.setUserId('user123').then(() => {
  console.log('User ID set');
});

Set User Properties

Set user properties without changing user ID.

window.Amplitude.setUserProperties({
  plan: 'premium',
  trialExpires: '2024-12-31'
}).then(() => {
  console.log('User properties set');
});

Log Revenue

Track a revenue event.

window.Amplitude.logRevenue(
  'product_id',      // Product ID
  1,                 // Quantity
  9.99,              // Price
  'purchase',        // Revenue type (optional)
  { currency: 'USD' } // Additional properties (optional)
).then(() => {
  console.log('Revenue logged');
});

Reset (Logout)

Reset the user session. Call this when a user logs out.

window.Amplitude.reset().then(() => {
  console.log('User reset');
});

Flush Events

Force flush events to Amplitude servers.

window.Amplitude.flush().then(() => {
  console.log('Events flushed');
});

Get Device ID

Get the current device ID.

window.Amplitude.getDeviceId().then(deviceId => {
  console.log('Device ID:', deviceId);
});

Get Session ID

Get the current session ID.

window.Amplitude.getSessionId().then(sessionId => {
  console.log('Session ID:', sessionId);
});

Set Device ID

Manually set the device ID.

window.Amplitude.setDeviceId('custom-device-id').then(() => {
  console.log('Device ID set');
});

Angular/Ionic Usage

For Angular/Ionic projects, create a service wrapper:

import { Injectable } from '@angular/core';
import { Platform } from '@ionic/angular';

declare var window: any;

@Injectable({
  providedIn: 'root'
})
export class AmplitudeService {
  private isInitialized = false;

  constructor(private platform: Platform) {}

  async initialize(apiKey: string): Promise<void> {
    if (!this.platform.is('cordova')) return;

    await window.Amplitude.initialize({ apiKey });
    this.isInitialized = true;
  }

  async track(eventName: string, properties: any = {}): Promise<void> {
    if (!this.isInitialized) return;
    await window.Amplitude.track(eventName, properties);
  }

  // ... other methods
}

Requirements

  • Cordova >= 9.0.0
  • cordova-ios >= 6.0.0
  • cordova-android >= 9.0.0
  • iOS 12.0+
  • Android SDK 21+

License

MIT

Author

Gratitude - https://365gratitudejournal.com