hardal
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Hardal

Hardal

License: GPL v3 version

An official plugin to add the Hardal tracking snippet to your React JS project.

Install

npm install --save hardal

or

yarn add hardal

How to use

Import module

//index.ts
import SendToHardal from 'hardal'

Send your custom events

//index.ts
 const sendCustomEvent = () => {
    const config = {
      apiKey: '',
      projectId: 372905,
      eventType: 'click-request-demo',
      eventValue: '',
      eventData: {
        path: window.location.pathname,
        referrer: document.referrer,
        position: 'header',
        isUserLogin: false,
        // Add any properties as needed
      },
    };
    SendToHardal(config);
  }

In the above example, the sendCustomEvent function is called with a configuration object named config. The configuration object includes the following properties:

  • apiKey: Your Hardal API key. Replace 'YOUR_API_KEY' with your actual API key.
  • projectId: The ID of the project to which you want to send the event.
  • eventType: The type of the event (e.g., 'click-request-demo').
  • eventValue: The value associated with the event (leave it as an empty string for now, or provide a specific value if needed).
  • eventData: An object containing additional data related to the event, such as path, referrer, product SKU, user type or any value. You can add more properties to the eventData object as needed.

Readme

Keywords

Package Sidebar

Install

npm i hardal

Weekly Downloads

1

Version

1.0.0

License

ISC

Unpacked Size

5.04 kB

Total Files

6

Last publish

Collaborators

  • raufsamestone