@trackier/react-websdk
v1.0.0
Published
Trackier Web SDK Wrapper
Keywords
Readme
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-websdkUsage
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.gitGo into the project root:
cd react-trackier-websdkInstall npm packages:
npm installRunning Locally
For development, you can run the project locally:
npm run buildTesting Locally with npm link
If you want to test the SDK locally in another project, use npm link:
In the SDK project directory, run:
npm linkIn your React app where you want to test the SDK, run:
npm link @trackier/react-websdk
