Getting Started

Getting Started

We're currently in closed alpha. If you're interested in joining, please contact us (opens in a new tab).

Project Setup

React

Installation

npm install @doclabs/react
 
# or
 
yarn add @doclabs/react
 
# or
 
pnpm add @doclabs/react

Configuration

Wrap your page in a Provider component. This will enable page tracking by default.

import { Provider } from "@doclabs/react";
 
<Provider
  siteId={/* YOUR SITE ID */}
  identifier={{
    lvl1: /*...*/,
    lvl2: /*...*/,
    lvl3: /*...*/,
  }}
>
  {/*...*/}
</Provider>

Unlike with other analytics tools, pages aren't identified by the path. Instead, you need to provide a unique identifier for each page. This identifier is a JSON object with three levels which are decided by you. lvl1 is required, lvl2 and lvl3 are optional. These properties can be filtered on in the dashboard. Common examples are:

  • Page ID
  • Path
  • Version
  • Language

Allowed Origins

You must tell DocLabs where your traffic is coming from:

  1. Go to the "Settings" page for your site
  2. Add your origin(s) to the "Allowed Origins" section e.g. https://www.example.com (opens in a new tab)
Was this helpful?