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

onetarget-react-native

v4.0.9

Published

test

Downloads

94

Readme

onetarget-react-native

Onetarget Wrapper Native SDK

Installation

npm install onetarget-react-native

Usage

import { OneTargetAnalytics } from 'onetarget-react-native';

// ...
1. Initialize

OneTargetAnalytics.initialize("[your_workspace_id]", "[your_flavor]", "[your_app_push_id]"); // flavor : dev, stg, prod

2. Tracking Event

function onAddtoCart() {

  let eventName = "add_to_cart"; // Event Name
  let identify = { "ext_identify": ext_identify};
  let eventData = { "ecommerce.trip_passengers_children": "1", "ecommerce.items.0.item_variant": "Eco", "ecommerce.trip_return_date": "2022-09-23", "ecommerce.items.0.flight_time": "06:20-08:30", "ecommerce.trip_start_date": "2022-09-23", "ecommerce.trip_passengers_adult": "2", "ecommerce.trip_to": "SGN", "platform": "APP", "ecommerce.items.0.index": "1", "ecommerce.trip_route": "SGN-HN", "ecommerce.trip_passengers_infant": "0", "ecommerce.currency": "VND", "ecommerce.items.0.item_category": "FareOption", "ecommerce.items.0.quantity": "1", "ecommerce.trip_from": "HAN", "ecommerce.trip_passengers": "1", "ecommerce.items.0.flight_from": "HAN", "ecommerce.items.0.price": "39.000đ", "ecommerce.items.0.flight_date": "2022-09-23", "ecommerce.items.0.item_id": "VJ197", "ecommerce.items.0.item_list_id": "Outbound:HAN:SGN", "ecommerce.trip_type": "roundTrip", "ecommerce.items.0.flight_to": "SGN", "ecommerce.items.0.item_name": "Flight:HAN:SGN" };
  var profiles = [{ "ext_identify": ext_identify }];

  OneTargetAnalytics.trackEvent(
    identify,
    eventName,
    eventData,
    profiles
  );
}

3. Add a Notification Service Extension

The OneTargetNotificationServiceExtension allows your application to receive rich notifications with images and/or buttons, and to report analytics about which notifications users receive.

- In Xcode Select File > New > Target...
- Select Notification Service Extension then press Next.
- Enter the product name as OneTargetNotificationServiceExtension and press Finish. Do not press "Activate" on the dialog shown after this.
- At OneTargetNotificationServiceExtension Link Library : OneTargetMobileSDK.xcframework, OneSignal.xcframework from Pods frameworks.
- In the OneTargetNotificationServiceExtension directory > NotificationService.m or NotificationService.swift file, replace the whole file contents with the code below:


import OneTargetMobileSDK

class NotificationService: UNNotificationServiceExtension {

    var contentHandler: ((UNNotificationContent) -> Void)?
    var bestAttemptContent: UNMutableNotificationContent?
    var receivedRequest: UNNotificationRequest!

    override func didReceive(_ request: UNNotificationRequest, withContentHandler contentHandler: @escaping (UNNotificationContent) -> Void) {
        self.receivedRequest = request
        self.contentHandler = contentHandler
        bestAttemptContent = (request.content.mutableCopy() as? UNMutableNotificationContent)
        
        if let bestAttemptContent = bestAttemptContent {
            // Modify the notification content here...
            bestAttemptContent.title = "\(bestAttemptContent.title) [modified]"
          _ = OneTargetAnalytics.didReceiveNotificationExtensionRequest(self.receivedRequest, with: bestAttemptContent, withContentHandler: self.contentHandler)
        }
    }
    
    override func serviceExtensionTimeWillExpire() {
        // Called just before the extension will be terminated by the system.
        // Use this as an opportunity to deliver your "best attempt" at modified content, otherwise the original push payload will be used.
        if let contentHandler = contentHandler, let bestAttemptContent =  bestAttemptContent {
          _ = OneTargetAnalytics.serviceExtensionTimeWillExpireRequest(self.receivedRequest, with: self.bestAttemptContent)
          contentHandler(bestAttemptContent)
        }
    }

}

4. Add App Group

  • Add "Sign In & Capabilities" add App Groups for All Target "Your Projects and OneTargetNotificationServiceExtension.

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

MIT


Made with create-react-native-library