@inleads/event-logger
TypeScript icon, indicating that this package has built-in type declarations

1.0.21 • Public • Published

InLeads

Event Logger SDK for InLeads. The Smart Sales Management System.

Getting Started

Installation

NPM

npm install @inleads/event-logger --save

Yarn

yarn add @inleads/event-logger

Script

<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@inleads/event-logger/dist/events.js"></script>

Basic Usage

Node.js

const InLeads = require('@inleads/event-logger')
// The only required field is the api token
InLeads.init('api-token');

// Should be called once to initialise user, email is Mandatory
InLeads.setUser('email', 'name', { role: 'some-role' });

// track should only be called once init and setUser is completed
// event-name is mandatory
InLeads.track('event-name', { from: 'screen-name' });

ES6 module

import { init, track, setUser } from '@inleads/event-logger'
// The only required field is the api token
init('api-token');

// Should be called once to initialise user, email is Mandatory
setUser('email', 'name', { role: 'some-role' });

// track should only be called once init and setUser is completed
// event-name is mandatory
track('event-name', { from: 'screen-name' });

General JavaScript (script tag)

// The only required field is the api token
inleadsEvents.init('api-token');

// Should be called once to initialise user, email is Mandatory
inleadsEvents.setUser('email', 'name', { role: 'some-role' });

// track should only be called once init and setUser is completed
// event-name is mandatory
inleadsEvents.track('event-name', { from: 'screen-name' });

Functions Reference

init

  init('api-token')
Parameter Type Description
api-token string Required. Your API key

setUser

  setUser('email', 'name', {role: "userRole"})
Parameter Type Description
email string Required. Email Id of the contact / user
name string Optional. Name of the contact / user
options object Optional. JSON object can have any meta data to save with user data

track

  track('event-name', {from: "screenName"})
Parameter Type Description
event-name string Required. Name for the event can be any string
options object Optional. JSON object can have any meta data to save with event data

unset

  unset()

No parameters required

Readme

Keywords

none

Package Sidebar

Install

npm i @inleads/event-logger

Weekly Downloads

2

Version

1.0.21

License

MIT

Unpacked Size

51.2 kB

Total Files

9

Last publish

Collaborators

  • vkrishna0511