New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-amplitude-analytics

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-amplitude-analytics

React Native iOS and Android wrapper for Amplitude

  • 0.1.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
292
decreased by-35.82%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-amplitude-analytics

npm version

Dependencies

react-native version >0.40

Installation

npm i react-native-amplitude-analytics --save

react-native link react-native-amplitude-analytics

iOS installation
  1. Open your app .xcodeproj file
  2. Add the following line to your "Podfile": pod 'Amplitude-iOS', '~> 3.14.1'
  3. run pod install
  4. Run your project (Cmd+R)
Android Manual installation
  1. Open up android/app/src/main/java/[...]/MainApplication.java
  • Add

    import com.sudoplz.reactnativeamplitudeanalytics.RNAmplitudeSDKPackage;
    

to the imports at the top of the file.

  • Add

    new RNAmplitudeSDKPackage(),
    

to the list returned by the getPackages() method

  1. Append the following lines to android/settings.gradle:

    include ':react-native-amplitude-analytics'
    project(':react-native-amplitude-analytics').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-amplitude-analytics/android')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:

    compile 'com.amplitude:android-sdk:2.13.4' // native sdk of amplitude
    compile project(':react-native-amplitude-analytics') // our react-native module
    
  3. Add permissions. If you haven't already, add the INTERNET permission to your manifest file:

    <uses-permission android:name="android.permission.INTERNET" />
    

Usage


import RNAmplitute from 'react-native-amplitude-analytics';

Example

class testApp extends Component {
  constructor() {
    super();
	 const amplitude = new RNAmplitute('Your Amplitude key');
	 
	 // log an event
	 amplitude.logEvent(eventName);
	 
	 // log an event with data
	 amplitude.logEvent(eventName, { foo: bar });
	 
	 // set the user id
	 amplitude.setUserId('1D32FS45');
	 
 	 // set user props
	 amplitude.setUserProperties({ hairColor: 'brown' });
	 
	 // log revenue
	 amplitude.logRevenue(productIdentifier, quantity, amount)
  }
  ...
}

there's also an example project here.

Keywords

FAQs

Package last updated on 26 Jul 2017

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