0.3.2 • Published 12 months ago

@tabula/ui-analytics v0.3.2

Weekly downloads
-
License
ISC
Repository
github
Last release
12 months ago

@tabula/ui-analytics

Allows to provide tracking ids to components.

Installation

Use the package manager pnpm to install @tabula/ui-analytics.

pnpm add @tabula/ui-analytics

You can use npm or yarn too.

Usage

UiAnalytics

This component provides trackId property through context to the children component.

import { UiAnalytics } from "@tabula/ui-analytics";

// ...
<UiAnalytics trackId="awesome-id">
  {/* ... */}
</UiAnalytics>
// ...

useUiTrackId

This hook allows to fetch track id from context.

Type

function useUiTrackId(id?: string): string | null

Usage

import { useUiTrackId } from "@tabula/ui-analytics";
Track IdIdResult
undefinedundefinedundefined
undefinednullundefined
undefinedfalseundefined
undefined""undefined
undefined"child"undefined
nullundefinedundefined
nullnullundefined
nullfalseundefined
null""undefined
null"child"undefined
""undefinedundefined
""nullundefined
""falseundefined
""""undefined
"""child"undefined
"parent"undefined"parent"
"parent"null"parent"
"parent"falseundefined
"parent"""undefined
"parent""child""parent--child"

useUiTrackIds

This hook allows to fetch track id from context and build ids map.

Type

function useUiTrackId(ids: Record<string, string | null | false>): Record<string, string> | Record<string, null>

Usage

import { useUiTrackIds } from "@tabula/ui-analytics";
Track IdIds
undefined{ isUndefined: undefined, isNull: null, isFalse: false, isEmpty: "", isString: "child" }{ }
null{ isUndefined: undefined, isNull: null, isFalse: false, isEmpty: "", isString: "child" }{ }
""{ isUndefined: undefined, isNull: null, isFalse: false, isEmpty: "", isString: "child" }{ }
"parent"{ isUndefined: undefined, isNull: null, isFalse: false, isEmpty: "", isString: "child" }{ isString: "parent--child" }

License

This project is ISC licensed.

0.3.2

12 months ago

0.3.1

1 year ago

0.3.0

1 year ago

0.2.0

1 year ago

0.1.0

1 year ago