linq-analytics-client
TypeScript icon, indicating that this package has built-in type declarations

1.3.5 • Public • Published

LinqAnalytics Library

Overview

LinqAnalytics is a comprehensive library designed to facilitate interaction with the Linq analytics platform. It provides seamless event tracking and user identification, offering developers an intuitive API.

Install

$ npm install linq-analytics-client

// or

$ yarn add linq-analytics-client

Initial Setup

First, ensure you've imported the necessary types and modules:

import {
  LinqAnalyticsConfig,
  ProductType,
  EventUserProps,
  TrackProps,
  LinqAnalytics,
} from 'linq-analytics-client'

Initialization

Before using the library, you need to initialize LinqAnalytics with your configuration:

const config: LinqAnalyticsConfig = {
  product: 'linq_app', // or 'linq_chat'
}
LinqAnalytics.initialize(config)

Note: The product can be either 'linq_app' or 'linq_chat', depending on your application's context.

Using the useLinqAnalytics Hook

  1. Import the Hook:
import { useLinqAnalytics } from 'linq-analytics-client'
  1. Initialize the Hook:
const { track } = useLinqAnalytics(organizationId, userProps)
  • organizationId: (Optional) Your organization's unique identifier.
  • userProps: (Optional) Object containing user properties like user_id, email, name, and so on.
  1. Track Events:
const someEventHandler = () => {
  // ... your event handling logic

  // Track the event
  const eventProps: TrackProps = {
    eventType: 'ButtonClick',
    eventName: 'Submit Button Clicked',
    properties: {
      someProperty: 'propertyValue',
      anotherProperty: 'anotherValue',
    },
  }
  track(eventProps)
}

The track function accepts a TrackProps object which consists of:

  • eventType: Type of the event ('PageView', 'ButtonClick', etc.).
  • eventName: Descriptive name for the event.
  • properties: (Optional) Additional properties or metadata related to the event.

Conclusion:

LinqAnalytics provides a straightforward way to integrate with the Linq analytics platform. By following the simple initialization step and leveraging the provided hook, developers can effortlessly track events and identify users in their applications. Happy coding!

Readme

Keywords

none

Package Sidebar

Install

npm i linq-analytics-client

Weekly Downloads

6

Version

1.3.5

License

ISC

Unpacked Size

39.2 kB

Total Files

38

Last publish

Collaborators

  • linq-ai