@trackier/react-websdk

1.0.0 • Public • Published

Trackier React Web SDK

Overview

@trackier/react-websdk is a lightweight wrapper for the Trackier Web SDK, making it easier to integrate with React applications.

Installation (For Users)

To install the package via npm, run:

npm install @trackier/react-websdk

Usage

Import the SDK and initialize it in your application:

import TrackierWebSDK from "@trackier/react-websdk";
import { useEffect } from "react";

function App() {
  useEffect(() => {
    TrackierWebSDK.init("localStorage", { trackingId: "your-tracking-id" });
  }, []);

  const handleClick = () => {
    const trackingToken = TrackierWebSDK.getTrackingToken();
    console.log(trackingToken);
  };

  return (
    <div>
      <button onClick={handleClick}>Get Tracking Token</button>
    </div>
  );
}

export default App;

Development (For Contributors)

Prerequisites

  • Git
  • A clone of this repository on your local machine

Installation

Clone the repository:

git clone https://github.com/trackier/react-trackier-websdk.git

Go into the project root:

cd react-trackier-websdk

Install npm packages:

npm install

Running Locally

For development, you can run the project locally:

npm run build

Testing Locally with npm link

If you want to test the SDK locally in another project, use npm link:

  1. In the SDK project directory, run:

    npm link
  2. In your React app where you want to test the SDK, run:

    npm link @trackier/react-websdk

Readme

Keywords

none

Package Sidebar

Install

npm i @trackier/react-websdk

Weekly Downloads

0

Version

1.0.0

License

ISC

Unpacked Size

8.01 kB

Total Files

5

Last publish

Collaborators

  • hemant.mann
  • anushka7310
  • dev.trackier
  • sanu_gupta
  • manisha-gupta
  • jay-trackier