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-replika-purchase-tracking

v0.1.833

Published

Purchase tracking directed from a Replika link

Downloads

27

Readme

react-native-replika-purchase-tracking

This utility library facilitates purchase tracking for users arriving at your application via a Replika link. It provides a streamlined way to monitor and record purchases made by these users, enhancing your ability to analyze the effectiveness of Replika-directed traffic.

Installation

npm install react-native-replika-purchase-tracking

Usage

Setting up tracking and passing down the link that will be checked for tracking. And an example of deep linking, in this example we use the 'expo-linking' library

import { ReplikaTracking } from 'react-native-replika-purchase-tracking';
import * as Linking from 'expo-linking';

// ...
const url = Linking.useURL();
const [replikaLink, setReplikaLink] = useState('');

if (url) {
  const { hostname, path, queryParams } = Linking.parse(url);
  setReplikaLink(url);

  if (Object.keys(queryParams).length !== 0) {
    navigation.navigate("productdetail", {
      product: {
        "_id": "1",
        "image": "https://assets.adidas.com/images/w_940,f_auto,q_auto/5ae668a4e81749d6aa8c88dfee7c9882_9366/ID4989_01_standard.jpg",
        "price": 10,
        "quantity": 5,
        "title": "Product 1",
      }
    });

  }
}

// ...

return (
  <TopLevelAppComponent store={store}>
    <ReplikaTracking link={replikaLink}>
      <ChildComponents />
    </ReplikaTracking>
  </TopLevelAppComponent>
);

Calling the purchaseMade function

During the time of purchase make a call to the purchaseMade function. The function will check to see if the purchase will be made.

  • The first argument is the string key that you will be using to authorize the purchase.
  • The second argument is the order details that you will be sending to the function. The order details should be in the format of the OrderDetails interface.
import { purchaseMade } from 'react-native-replika-purchase-tracking';

// ...

// Example of a purchaseMade call
purchaseMade("<YOUR STRING KEY HERE>", {
  "consumerIdentifier": "anonymous",
  "orderId": "MobileLibraryTest005",
  "purchaseList": [
    {
      "productId": "AP_MBP_13",
      "productName": "Absolute Repair",
      "productPrice": "1800.00",
      "currency": "$",
      "productUrl": "https://myreplikacommerce.myreplika.com/absolute-repair-2",
      "productImage": "https://myreplikacommerce.myreplika.com/images/thumbs/0000169_absolute-repair_550.jpeg",
      "quantity": 2
    },
    {
      "productId": "HP_ESB_15",
      "productName": "Benefit Hair Oil",
      "productPrice": "1460.50",
      "currency": "$",
      "productUrl": "https://myreplikacommerce.myreplika.com/benefit-hair-oil-2",
      "productImage": "https://myreplikacommerce.myreplika.com/images/thumbs/0000171_benefit-hair-oil_550.jpeg",
      "quantity": 1
    }
  ],
  "purchaseTotalInfo": {
    "amount": "5060.50",
    "currency": "$"
  },
}).catch((error) => console.log('purchase Error', error));

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