React

React

  1. First Step is to get your API Keys from your dashboard.

Keys

For security reasons, We do not store your tokens (not even encrypted !). You'll have to generate a new token if you lose this. You can generate as many tokens as you want.

Why API Key? Find here.

  1. Download the Ved Analytics Client component from the registry.
npm i ved-analytics
  1. Import the component in the main index.js file -
import VedAnalytics from 'ved-analytics';
 
const project = process.env.VED_PROJECT_ID;
const apiKey = process.env.VED_API_KEY;
 
const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(
  <React.StrictMode>
    <VedAnalytics project={project} apiKey={apiKey} />
    <App />
  </React.StrictMode>
);
 
reportWebVitals();

NOTE - You can get your project-id from your dashboard.

ProjectID

  1. It is recommended to store the API-KEY and ProjectID in a .env file and use it in your component.
VED_PROJECT_ID=
VED_API_KEY=
  1. You are good to go !

Example

You can refer to the example react implementation at - https://github.com/ved-analytics/ved-react-example (opens in a new tab)