Tracking
Track events and user actions when the user starts a new conversation. Attach custom metadata to every conversation started via the SDK.
Adding Tags to Conversations
You can attach tags while reporting an issue by passing them to the tags
parameter at the time of calling showConversation
function. You can pass an array of strings which will get added as tags
when the issue is created.
Pass this Map to showConversation
API. For eg:
const config = {
tags: {"foo", "bar"},
};
showConversation(config);
Similarly, you can pass this configuration to other APIs (ie. showConversation
, showFAQsWithConfig
, showFAQSectionWithConfig
).
On tag names & compatibility
- Tags must be pre-created in the Helpshift Dashboard (Settings → Tags), otherwise, they will be ignored.
- The attached tags must exactly match the tags present on the dashboard.
Set Custom Metadata
If you want to set Custom Metadata at the time of Issue creation, follow the steps.
- Define your custom metadata
Map
as key-value pairs. - Add the custom metadata
Map
in the map expected in theParameters
argument withcustomMetadata
as the key.
Pass this Map to the following APIs:
showConversation
API,
const customMetadata = { usertype:'paid', level:'7', score: '1505' } };
const config = {
customMetadata: customMetadata,
};
showConversation(config);
showFAQsWithConfig
API,
const customMetadata = { usertype:'paid', level:'7', score: '1505' } };
const config = {
customMetadata: customMetadata,
};
showFAQsWithConfig(config);
showFAQSectionWithConfig
API
const customMetadata = { usertype:'paid', level:'7', score: '1505' } };
const config = {
customMetadata: customMetadata,
};
showFAQSectionWithConfig(config);
Set Custom Issue Fields
If you want to set Custom Issue Fields at the time of Issue creation, follow the steps.
- Initialise a top-level custom issue fields
Map
- Define your custom issue field
Map
- Add the
"type"
and"value"
for that custom issue field
Pass this Map to showConversation
API.
Example:
const CIFs = { stock_level: { type: "number", value: "1505" } };
const config = {
cifs: CIFs,
};
showConversation(config);
Similarly, you can pass this Map to other APIs (ie. showConversation
, showFAQsWithConfig
, showFAQSectionWithConfig
).
The following are the valid values for the type
key of a Custom Issue Field.
- "singleline"
- "multiline"
- "number"
- "checkbox"
- "dropdown"
- "date"
Compatibility table for type and values:
Type | Value | Comments |
---|---|---|
singleline | string | Character limit of 255 |
multiline | string | Character limit of 100,000 |
number | int | |
dropdown | string | Drop-down options should exist for the given Custom Issue Field |
date | DateTime | Epoch time. For example - Date.now() |
checkbox | boolean |
On Custom Issue Fields keys & compatibility
- Custom Issue Fields must be created in the Helpshift Dashboard (Settings → Custom Issue Fields), otherwise they will be ignored. Read more here
Breadcrumbs
Breadcrumbs can be used to track events or end-user actions. It helps you to add debugging information regarding end-user actions, which will be passed along with every new conversation on Helpshift’s Agent Dashboard. To leave breadcrumbs can use leaveBreadCrumb
API and pass a string to it. For example -
import {
leaveBreadCrumb
} from 'helpshift-plugin-sdkx-react-native';
leaveBreadCrumb(<breadCrumbString>)
Breadcrumbs are collected within the set breadcrumb limit. The limit is set under the SDK Configurations section for App Settings in the Helpshift’s Agent Dashboard. Breadcrumbs are collected in a FIFO queue. If you want to clear the breadcrumbs, use the clearBreadcrumbs
API. For example -
import { clearBreadcrumbs } from "helpshift-plugin-sdkx-react-native";
clearBreadcrumbs();
In the Breadcrumbs and Debug logs APIs, the passing of formatted strings is NOT supported. It is recommended to pass data only in a simple String format.
For example:
- "{\"key\":\"value\"}" - JSON String, This is NOT supported
- "key - value" - Simple string, This is supported
Debug Logs
You may wish to pass additional debug logs with every new conversation filed by an end-user on Helpshift’s Agent Dashboard. So, HelpshiftLog
class and its methods provide varying degrees of logging - Verbose, Debug, Info, Warning, and Error. For example, if you want to attach debug level log -
import { HelpshiftLog } from "helpshift-plugin-sdkx-react-native";
const tag = "Tag";
const debugMsg = "Debug Message";
if (logLevel == "Verbose") {
HelpshiftLog.v(tag, debugMsg);
} else if (logLevel == "Debug") {
HelpshiftLog.d(tag, debugMsg);
} else if (logLevel == "Info") {
HelpshiftLog.i(tag, debugMsg);
} else if (logLevel == "Warn") {
HelpshiftLog.w(tag, debugMsg);
} else if (logLevel == "Error") {
HelpshiftLog.e(tag, debugMsg);
}
Debug logs are collected within the set debug logs limit. The limit is set under the SDK Configurations section for App Settings in the Helpshift’s Agent Dashboard. Debug logs are collected in a FIFO queue.