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

@bitespeed/react-native-sdk

v0.0.16

Published

Bitespeed React Native SDK - Supports user identification, product events, notification event webhooks and more...

Downloads

859

Readme

Bitespeed React Native SDK

© Bitespeed

This SDK is designed for React Native applications to facilitate tracking of user events, product interactions, and notifications. It ensures accurate identification of users and provides seamless integration with the Bitespeed API.

Features

  • User Identification: Identify users with contact details (email/phone).
  • Notification Tracking: Track notification events like delivery and clicks.
  • Product Event Tracking: Track events such as product views and add-to-cart.

Setup Instructions

  1. Install the Bitespeed SDK

    To integrate the Bitespeed SDK into your React Native project:

     npm install @bitespeed/react-native-sdk
  2. Set Up Firebase for FCM (Push Notifications)

    To setup firebase for react-native, follow the instructions here for both Android and iOS.

  3. Set up Firebase Cloud Messaging (FCM) for Push Notifications

    To set up FCM, follow the official Firebase documentation here.

  4. Add FCM Receiving Message Handlers

    Add the following code to your App.js file to receive FCM messages:

    import messaging from '@react-native-firebase/messaging'
    
    messaging().onMessage(async (remoteMessage) => {
      // call the trackNotification method here
    })
    
    messaging().setBackgroundMessageHandler(async (remoteMessage) => {
      // call the trackNotification method here
    })

    Refer to the official Firebase documentation here for more details.

Important Notes:

  1. Make sure to add the google-services.json file to your android project and GoogleService-Info.plist to your iOS project.
  2. Both Android and iOS require additional setup for FCM. Refer to the official Firebase documentation for more details.
  3. Ask the user for permission to receive push notifications.
  4. Make sure to call the trackNotification method in the onMessage and setBackgroundMessageHandler handlers to track notification events.

Usage

  1. Initialize the SDK

    Initialize the SDK with your API key and shop URL:

    import BitespeedSDK from 'bitespeed-sdk'
    
    const sdk = BitespeedSDK.getInstance('<SHOP_URL>.myshopify.com', 'your-api-key')
  2. Identify User

    Identify the user with their details and FCM token:

    await sdk.identify(
      {
        email: '[email protected]',
        phone: '1234567890',
        firstName: 'John',
        lastName: 'Doe',
      },
      'fcm-token' // Here you can pass the FCM token
    )
  3. Track Product Events

    Track product-related events such as viewing or adding to the cart:

    await sdk.trackProductEvent('productView', {
      event: {
        id: 'prod-123',
        name: 'Sample Product',
        price: 100,
        handle: 'sample-product',
      },
    })
  4. Track Notification Events

    Track notification events like clicks or delivery:

    await sdk.trackNotification('clicked', 'notif-123')

Supported Events

  1. Product Events:

    • productView - when the user views a product.
    • addToCart - when the user adds a product to the cart.
  2. Notification Events:

    • delivered - when the notification is delivered to the user.
    • clicked - when the user clicks on a notification.

Error Handling

The SDK will throw errors if:

  • API key or shop URL is missing during initialization.
  • User is not identified before tracking events.
  • Unsupported events are passed to tracking methods.

Contact

For further assistance, reach out to Bitespeed Support at [email protected].