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

@hadx/analytics

Package Overview
Dependencies
Maintainers
1
Versions
42
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hadx/analytics

Hadex's analytics service to track and report app's usage

  • 1.1.12
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-60%
Maintainers
1
Weekly downloads
 
Created
Source

Hadex Analytics

This is a lightweight analytics library to track and report React Native app's usage using Firebase's firestore. Supporting real time mobile notification using One Signal.

What for?

Why not use Firebase Analytics?

You can have access to all the data programmatically since it's hosted on your firebase firestore. Hadex Analytics also provides functions to read, filter and analyse those data. No need to export to BigQuery which is not free.

Getting started

  1. Create a new project on firebase console (ex: AppsAnalytics)

  2. Create Firestore database with Rules

rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if request.auth != null;
    }
  }
}
  1. Enable Email/Password Authentication and add a new user, remember the email and password
  2. Install this package
yarn add @hadx/analytics
  1. Install react-native-device-info

  2. Add a Web App to the project

  3. Copy and save the firebaseConfig part to your code

Basic Usage

In your React Native app that you want to track:

import Analytics from '@hadx/analytics';


export default class App extends React.Component {
    await componentDidMount() {
        Analytics.initialize({appID: 'myappID',
            firebaseConfig: {
              // use the config copied above
            },
            firebaseAuth: {
              email: '...', password: '...'
              // use email & password of the user created previously
            }}
        });
            Analytics.logEvent('openApp')
    }
}

In your Report website or app:

import Analytics from '@hadx/analytics';

Analytics.initalize({firebaseConfig: {
  // use the config copied above
}}, () => {
  // newUnit is an event that is logged automatically by Hadex Analytics 
  Analytics.getAppEvents('myappID', [["id", '==', 'newUnit']]).then(events => {
    console.log('Total users: ' + events.length)
  });

})

Event notification (optional)

Want to receive real time notification with your mobile app when an user buy your in-app-purchase? (or whatever event you want to subscribe to)

  1. Your own private mobile app to receive notifications (not your tracked apps)
  2. Create an app on One Signal (ex: AppsAnalytics)
  3. Install One Signal for React Native
  4. Copy your One Signal API key and app id from the dashboard

Example code:

import Analytics from '@hadx/analytics';

Analytics.initalize({firebaseConfig: {
  // use the firebase config
}, notificationConfig: {
  apiKey: '...', // copy from above
  appID: '...', // copy from above
  subscriberID: 'thisUserID'
}}, () => {
  // newUnit is an event that is logged automatically by Hadex Analytics 
  Analytics.getAppEvents('myappID', [["id", '==', 'newUnit']]).then(events => {
    console.log('Total users: ' + events.length)
  });

})

Dependencies

Automatic events

These events below are logged automatically for you

Event IDWhenData
newUnita new user installs your appdeviceID

Keywords

FAQs

Package last updated on 18 Jan 2020

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