This library provides a mechanism by which user interactions (clicks) can be tracked and logged to a Freshsuccess server. At the heart of the event tracking is the na object. At its core, the object provides methods for setting the feature, module, account Id, and user Id to be transmitted with each interaction event.
Module and feature Ids must be specified via API calls on the na object
To use the api, events should be sent via the sendFeatureEvent() api call. The module ID can be set separately via the setModuleId() call as shown in the quickstart guide. A module ID stays set until changed or explicitly set to null. An optional product ID can also be associated with feature and module events. The productId is set similarly to the moduleId, via the setProductId() call. As well, it stays set until changed or set to null.
An idle timer is used to track idle time. The timer is reset on any click, mousemove or keyboard event. When idle time is detected, a sessionIdle event is generated. As well a moduleEnd event is generated that contains the amount of time within the current module (if the current module is set). When the user resumes activity module and session time tracking continues.
Two cookies are generated to track user sessions. One cookie is a short-lived session cookie (with a default timeout of 30 minutes). The other is a longer more persistent cookie used to associate sessions over a longer time period. By default, the library attempts to track page unloading. This is difficult to do and somewhat browser dependent. At page unload time a pageViewEnd event is generated along with a moduleEnd event (if a current module is set and the user is not idle).
Once the library has been integrated into your product please let us know as we need to setup the workflows to run and process your data. This needs to be completed prior to data becoming visible within the UI.
See the Quickstart Guide for more details on instrumenting your application with this API.
Name | Type | Required | Description |
apiKey | string | yes | key to determine organization and source |
authKey | string | yes | authentication key |
options | object | no | see below for components (all optional) |
options.accountId | string(256) Default: null | no | identity of the account if known |
options.batchTimeout | number Default: 15s | no | number of secs to wait between batching of events |
options.debug | boolean Default: false | no | enables console logging |
options.debugUrl | string | no | sends event data to specified url (e.g., of a debug server);
you can find the debug URL within the product's IT Administration module |
options.disableEventSend | boolean Default: false | no | disables sending events; sets debug to true [debug can be forced off by explicitly setting debug = false] |
options.euEndpoint | boolean Default: false | no | sets the URL endpoint to the EU data collector if true |
options.pageName | string Default: html path | no | human readable name for page |
options.sessionTimeout | minutes Default: 30 mins | no | number of minutes before timing out the session |
options.sessionSyncInterval | seconds Default: 15 secs | no | number of seconds between syncing of session/module data |
options.trackUnload | boolean Default: true | no | attempts to track page unloads for accurate page durations |
options.unloadDelay | number Default: 500 ms | no | number of msecs to wait for last event on unload |
options.userId | string(256) Default: null | no | identity of the user if known |
Name | Type | Required | Description |
userId | string(256) | yes | identity of user |
accountId | string(256) | yes | identity of account |
details | object preferred | no | optional details that can be associated with the user. Can be used to update product user list, if user not previously seen. |
details.first_name | string(80) preferred | no | first name of user |
details.last_name | string(80) preferred | no | last name of user |
details.email | string(512) preferred | no | email of user |
details.phone | string(80) | no | phone of user |
details.mobile_phone | string(80) | no | mobile phone of user |
details.salutation | string(80) | no | salutation of user. e.g. Mr. |
details.title | string(128) | no | title of user. e.g. Customer Success Manager |
details.role | string(128) | no | role of user. e.g. CSM |
details.department | string(128) | no | department of user. e.g. Customer Success Department |
details.mailing_street | string(512) | no | mailing street of user. e.g. 123 Sesame St. |
details.mailing_city | string(80) | no | mailing city of user. e.g. New York |
details.mailing_state | string(80) | no | mailing state of user. e.g. NY |
details.mailing_postal | string(80) | no | mailing postal of user. e.g. 10001 |
details.mailing_country | string(80) | no | mailing country of user. e.g. USA |
productId | string(128) | no | product Id, set as if setProductId(product) had been called |
Name | Type | Required | Description |
details | object | yes | details that can be associated with the user |
details.first_name | string(80) preferred | no | first name of user |
details.last_name | string(80) preferred | no | last name of user |
details.email | string(512) preferred | no | email of user |
details.phone | string(80) | no | phone of user |
details.mobile | string(80) | no | mobile of user |
details.salutation | string(80) | no | salutation of user. e.g. Mr. |
details.title | string(128) | no | title of user. e.g. Customer Success Manager |
details.role | string(128) | no | role of user. e.g. CSM |
details.department | string(128) | no | department of user. e.g. Customer Success Department |
details.mailing_street | string(512) | no | mailing street of user. e.g. 123 Sesame St. |
details.mailing_city | string(80) | no | mailing city of user. e.g. New York |
details.mailing_state | string(80) | no | mailing state of user. e.g. NY |
details.mailing_postal | string(80) | no | mailing postal of user. e.g. 10001 |
details.mailing_country | string(80) | no | mailing country of user. e.g. USA |
Name | Type | Required | Description |
details | object | yes | details that can be associated with the account |
details.name | string(256) | no | name of account; required when adding new account |
details.join_date | number epoch ms | no | date account joined your product; required when adding new account |
details.lifecycle_stage | string(80) | no | current lifecycle stage |
details.is_churned | boolean | no | mark account as churned if true, mark account as active is false |
details.inactive_time | number epoch ms | no | when setting churned to true, set as date account churned |
details.inactive_reason | varchar(512) | no | when setting churned to true, set as reason why |
details.tier | string(80) | no | tier for account |
details.industry | string(80) | no | industry of account |
details.employees | number | no | number of employees |
details.website | string(512) | no | account's website |
details.phone | string(80) | no | account primary phone number |
details.billing_street | string(512) | no | mailing street of user. e.g. 123 Sesame St. |
details.billing_city | string(80) | no | mailing city of user. e.g. New York |
details.billing_state | string(80) | no | mailing state of user. e.g. NY |
details.billing_postal | string(80) | no | mailing postal of user. e.g. 10001 |
details.billing_country | string(80) | no | mailing country of user. e.g. USA |
Name | Type | Required | Description |
moduleId | string(128) | yes | name of current module (null to reset the current module) |
Name | Type | Required | Description |
productId | string(128) | yes | name of current product (null to reset the current product) |
Name | Type | Required | Description |
accountId | string(256) | yes | identity of account |
Name | Type | Required | Description |
userId | string(256) | yes | identify of user |
Name | Type | Required | Description |
featureId | string(128) | yes | feature id to associate with event |
moduleId | string(128) | yes | module id to associate with event; behaves as if setModuleId(moduleId) was called |
productId | string(128) | yes | product id to associate with event; behaves as if setProductId(productId) was called |