
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
react-native-mixpanel-android
Advanced tools
This is a revive project of the great https://www.npmjs.com/package/@pod-point/react-native-mixpanel by pod-point. For some reason, the original repo is down and doesn't work anymore with iOS, so I decided to take it and fix it for Android.
This package provides a React Native compatible, Mixpanel component which runs on Android using the same JavaScript API.
npm install react-native-mixpanel-android --save
Note: If you're already using Google Play Services 3.1 elsewhere in your project you may see this error when you sync Gradle:
Error:Execution failed for task ':app:processDebugResources'.
> Error: more than one library with package name 'com.google.android.gms'
You can temporarily disable this error with android.enforceUniquePackageName=false
However, this is temporary and will be enforced in 1.0
To solve this problem, open the build.gradle
file for the :pptmixpanel
module and delete or comment this line:
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.1.1'
compile 'com.facebook.react:react-native:0.14.0'
compile 'com.mixpanel.android:mixpanel-android:4.7.0'
//compile 'com.google.android.gms:play-services:3.1+' - Comment or delete this line
}
android
directory in your React Native project.settings.gradle
. Replace the line in the script
which states include ':app'
with include ':app', ':pptmixpanel'
(or append ':pptmixpanel'
to the end of the
include statement if you're already including other modules).settings.gradle
:project(':pptmixpanel').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-mixpanel-android/android/library')
app
module build.gradle
file and add the following line to the end of your dependancies section:compile project(path: ':pptmixpanel')
MainActivity
class and import the following package:import com.podpoint.pptmixpanel.PPTMixpanelPackage;
new MainReactPackage()
,
add the following line below: return Arrays.<ReactPackage>asList(
new MainReactPackage(),
new PPTMixpanelPackage() // Add this line
);
pptmixpanel
package in your project explorer and then expand the manifests
directory. Open up the
AndroidManifset.xml
and find the node with the key com.podpoint.PPTMixpanel.API_KEY
. Enter your Mixpanel API key
into the android:value
property and save the file. This file will be kept out of source control so it is safe to
store the API key in here.Ctrl+R
and make sure the app runs!Include Mixpanel using the following:
import Mixpanel from 'react-native-mixpanel-android';
You can track basic events by with the following call. The first parameter is the name of the event and the second optional parameter is an object of data which you would like to associate with this event:
Mixpanel.track('Android App Started', {foo: 'bar'});
You can time how long an event took with the following calls. The first call starts the timer and only requires the event name as a parameter. The second call stops the timer and requires the same event name to be passed. You may also include an optional parameters object:
Mixpanel.timeEvent('Timed Event');
setTimeout(() => Mixpanel.track('Timed Event'), 500);
You can register super properties which are included with every event you track afterwards with the following call:
Mixpanel.registerSuperProperties({'API Version': 'v3'});
You can identify a user using a numeric ID or string with the following call:
Mixpanel.identify(6850);
You can assign users' extra properties which can help identify them with the following call:
Mixpanel.people.set({'User Type': 'EV Driver'});
You can track numeric values which are associated with a user using the following call:
Mixpanel.people.increment({'Credits': 100});
You can track charges associated with the user with the following call. The first parameter is the numeric value of the charge, the second parameter is an optional object associated with this charge:
Mixpanel.people.trackCharge(50, {'Type': 'Account Top-up'});
FAQs
A Mixpanel integration for React Native on Android
The npm package react-native-mixpanel-android receives a total of 0 weekly downloads. As such, react-native-mixpanel-android popularity was classified as not popular.
We found that react-native-mixpanel-android demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.