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

@bilyai/react

v1.0.32

Published

> TODO: description

Downloads

1,703

Readme

Official Bily SDK for React

npm version npm dm npm dt

Don't already have an account and store added ? Head over to Bily, then return to this page.

☕ Install package

npm install @bilyai/react
yarn add @bilyai/react

🚦 Configurations

// src/index.js
import React from 'react';
import ReactDOM from 'react-dom/client';
import App from './App';

import { BilyProvider } from '@bilyai/react';

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <BilyProvider domainTracking="https://b.magnetor.net">
      <App />
    </BilyProvider>
  </React.StrictMode>,
);

Once implemented, Bily's React SDK will automatically track all pageviews. You can now begin tracking all other events as well.

🚀 Start tracking events

import { useBily } from '@bilyai/react';
import { useEffect } from 'react';

function ProductPage() {
  const { track } = useBily();

  useEffect(() => {
    track('Product Viewed', {
      client: {
        firstname: 'John',
        lastname: 'Doe',
        // ... other attributes here
      },
      products: [
        {
          id: '123',
          name: 'Product 1',
          price: 100,
          quantity: 1,
          currency: 'USD',
          sku: '123',
          category: 'Category 1',
          brand: 'Brand 1',
        },
      ],
      // ...other attributes here
    });
  }, [track]);

  return <div className="product">Product page</div>;
}

export default ProductPage;
import { useBily } from '@bilyai/react';
import { useCallback } from 'react';

function ProductPage() {
  const { track } = useBily();

  const addToCart = useCallback(() => {
    track('Product Added', {
      client: {
        firstname: 'John',
        lastname: 'Doe',
        // ... other attributes here
      },
      products: [
        {
          id: '123',
          name: 'Product 1',
          price: 100,
          quantity: 1,
          currency: 'USD',
          sku: '123',
          category: 'Category 1',
          brand: 'Brand 1',
        },
      ],
      // ...other attributes here
    });
  }, [track]);

  return (
    <div className="product">
      Product page
      <button onClick={addToCart}>Add to cart</button>
    </div>
  );
}

export default ProductPage;
import { useBily } from '@bilyai/react';
import { useCallback } from 'react';

function CartPage() {
  const { track } = useBily();

  const startCheckout = useCallback(() => {
    track('Checkout Started', {
      client: {
        firstname: 'John',
        lastname: 'Doe',
        // ... other attributes here
      },
      products: [
        {
          id: '123',
          name: 'Product 1',
          price: 100,
          quantity: 1,
          currency: 'USD',
          sku: '123',
          category: 'Category 1',
          brand: 'Brand 1',
        },
      ],
      // ...other attributes here
    });
    // start checkout logic
  }, [track]);

  return (
    <div className="cart">
      Cart page
      <button onClick={startCheckout}>Add to cart</button>
    </div>
  );
}

export default CartPage;
import { useBily } from '@bilyai/react';
import { useCallback } from 'react';

function CheckoutPage() {
  const { track } = useBily();

  const startCheckout = useCallback(() => {
    // ... checkout logic
    track('Order Completed', {
      client: {
        firstname: 'John',
        lastname: 'Doe',
        email: '[email protected]',
        phone: '1234567890',
        gender: 'male',
        dateOfBirth: '1990-01-01',
        address: {
          city: 'New York',
          state: 'NY',
          country: 'US',
          zip: '10002',
        },
        // ... other attributes here
      },
      order: {
        id: '123',
        currency: 'USD',
        total: 100,
        products: [
          {
            id: '123',
            name: 'Product 1',
            price: 100,
            quantity: 1,
            currency: 'USD',
            sku: '123',
            category: 'Category 1',
            brand: 'Brand 1',
          },
        ],
      },
      // ...other attributes here
    });
  }, [track]);

  return (
    <div>
      Checkout page
      <button onClick={startCheckout}>Add to cart</button>
    </div>
  );
}

export default CheckoutPage;

💬 We're here to help!

If you get stuck, shoot us an email or use the Intercom widget on the bottom right of any page.

We're excited you're here! :blue-heart:

This won't be fun to clean up...