Installation
Learn how to integrate Croct with your React project.
For a more streamlined setup, go to the Integration page of your workspace and you will find instructions tailored to your application.
Prerequisites
To get most out of this guide, you have to:
- Create an account
If you do not already have one, you can sign up for free. - Get your Application ID
Find it on the Integration page of your application.
Install the SDK
Run the following command to install the SDK:
npm install @croct/plug-react
Initialize the provider
Add the <CroctProvider> component to the root of your application and set the appId property to your Application ID.
import {CroctProvider} from '@croct/plug-react';export default function App() {return (<CroctProvider appId="APPLICATION_ID"><div><h1>My first personalized app 🚀</h1></div></CroctProvider>);}
You can find the Application ID on the Integration page of your application. For a list of all available options, refer to the <CroctProvider> documentation.
Check your integration
If you open your application now, it should start sending events.
To check if your integration is working, go to the Integration page of your application.
When working correctly, you should see a green bullet next to the Status label saying "Received traffic in the past 24 hours". If you still do not see this message after a few minutes, see the Troubleshooting reference.