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 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-lytics

v0.0.1

Published

Lytics SDK for React Native

Downloads

10

Readme

Lytics SDK for React Native

Installation

Install the SDK:

yarn add react-native-lytics

Android

Add the following permissions to your AndroidManifest.xml file:

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

This permission is required to send events to the Lytics API.

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

This permission is technically optional but highly recommended to allow the library to determine the best time to send events to the API.

iOS

Install native modules:

npx pod-install

Configuration

You must initialize the Lytics SDK with your API token before using it.

import { start } from 'react-native-lytics';

start({
  apiToken: 'xxxxxx',
  ...
});

Sending Data

Identity Events

Tracking identity events provides an interface for updating the current user's properties stored on device as well as emitting an identify event to the downstream collections API.

import { identify } from 'react-native-lytics';

identify({ identifiers: { email: '[email protected]' } });

Consent Events

Consent events provide an interface for configuring and emitting a special event that represents an app users explicit consent. This event does everything a normal event does in addition to providing a special payload for consent details at the discretion of the developer.

import { consent } from 'react-native-lytics';

consent({
  consent: {
    documents: ['terms_aug_2022', 'privacy_may_2022'],
    consented: true,
  },
});

Track Custom Events

Track custom events provides an interface for configuring and emitting a custom event at the customers discretion throughout their application (e.g. made a purchase or logged in).

import { track } from 'react-native-lytics';

track({ name: 'Event_Tap', properties: { event: 'Event_Tap' } });

Screen Events

Screen events provide an interface for configuring and emitting a special event that represents a screen or page view. It should be seen as an extension of the track method.

import { screen } from 'react-native-lytics';

screen({
  name: 'Event_Detail',
  properties: { artistID: 123, eventID: 345 },
});

Advertising ID

Android

To support collecting the Android Advertising ID, add the following to the application's gradle dependencies:

implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'

Additionally, declare a Google Play services normal permission in the manifest file as follows:

<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>

After confirming with the user and getting their consent, enable Advertiser ID collection via Lytics.enableGAID().

The user's Android Advertising ID will be sent with each event's identifiers.

Note, the user can disable or change the Advertising ID via the Android system privacy settings.

iOS

Before collecting the IDFA you must first add a NSUserTrackingUsageDescription to your app's Info.plist. You can then call requestTrackingAuthorization() to have iOS request authorization to access the IDFA. Note that the alert will not be displayed if the user has turned off “Allow Apps to Request to Track” in the system privacy settings and that authorization can be revoked at any time.

Usage

import { requestTrackingAuthorization } from 'react-native-lytics';

requestTrackingAuthorization();