React SDK
@userflux/browser-js-react
Getting Started
1. Install the package
npm i @userflux/browser-js-react2. Initialise the SDK
import { UserFluxProvider } from "@userflux/browser-js-react"
const root = ReactDOM.createRoot(document.getElementById("root"))
root.render(
<React.StrictMode>
<UserFluxProvider
writeKey="YOUR WRITE ONLY API KEY"
options={{
autoCapture: ["page_views", "clicks"],
allowCookies: true,
autoEnrich: true,
cookieSameSiteSetting: "Strict",
cookieExpiryDays: 365,
trackSession: true,
defaultTrackingProperties: { project: "Web App" },
}}
>
<App />
</UserFluxProvider>
</React.StrictMode>
)3. Tracking events
4. Identifying users
Other Methods Available
trackBatch
updateDefaultTrackingProperties
reset
flush
trackPageView
getUserId
getAnonymousId
Last updated