@usertimeline/react
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

@usertimeline/react

After creating an account and adding the domain (or subdomain) you want to track, you need to add the script to your saas/website.

Create a Usertimeline account

Install

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

Usage

Add the script to your saas/website.

import { UsertimelineScript } from '@usertimeline/react';

export default function Layout() {
  return (
    <html lang="en">
      <body>
        {/* replace the YOUR_PROJECT_CODE_HERE with the project code */}
        <UsertimelineScript project="YOUR_PROJECT_CODE_HERE" />
      </body>
    </html>
  );
}

That's it! Now you can track users on your saas/website.

Disable features

You can disable features like page view, click, or both.

import { UsertimelineScript } from '@usertimeline/react';

export default function Layout() {
  return (
    <html lang="en">
      <body>
        {/* replace the YOUR_PROJECT_CODE_HERE with the project code */}
        <UsertimelineScript
          project="YOUR_PROJECT_CODE_HERE"
          disableFeature="page_view,click"
        />
      </body>
    </html>
  );
}

Authenticated users

You can track authenticated users on your saas/website in 3 ways:

Using the script

You can add one or more of the 3 additional parameters. Remember to replace the parameters with your data.

import { UsertimelineScript } from '@usertimeline/react';

export default function Layout() {
  return (
    <html lang="en">
      <body>
        {/* replace the YOUR_PROJECT_CODE_HERE with the project code */}
        <UsertimelineScript
          project="YOUR_PROJECT_CODE_HERE"
          externalid="{{YOUR_EXTERNAL_ID_HERE}}"
          name="{{YOUR_NAME_HERE}}"
          email="{{YOUR_EMAIL_HERE}}"
        />
      </body>
    </html>
  );
}

Use component after the initial script

import { UsertimelineAuth } from '@usertimeline/react';

export default function Layout() {
  return (
    <html lang="en">
      <body>
        <UsertimelineAuth
          externalid="{{YOUR_EXTERNAL_ID_HERE}}"
          name="{{YOUR_NAME_HERE}}"
          email="{{YOUR_EMAIL_HERE}}"
        />
      </body>
    </html>
  );
}

Readme

Keywords

none

Package Sidebar

Install

npm i @usertimeline/react

Weekly Downloads

243

Version

0.2.1

License

none

Unpacked Size

7.37 kB

Total Files

9

Last publish

Collaborators

  • etc-tiago