Skip to main content

Tracking iOS

Track events and user actions when the user starts a new conversation. Attach custom metadata to every conversation started via the SDK.

Note

All the public APIs in the SDK should be called after initializing the SDK via HelpshiftSdk.install() API

Adding Tags to Conversations

You can attach tags while reporting an issue by passing them to the configMap object at the time of calling ShowConversation. You can pass an array of strings with a key "tags" which will get added as Tags when the issue is created.

For example:

using Helpshift;

private HelpshiftSdk help;

void Awake(){
// install call here
}

// configuration map
void openHelpshift(){

Dictionary<string, object> configMap = new Dictionary<string, object>();
// other configurations
// ..
configMap.Add("tags", new String[] { "tag1", "tag2" })

// open the support chat screen
help.ShowConversation(configMap);
}

Note

On tag names & compatibility

  • Tags must be pre-created in the Helpshift Dashboard (SettingsTags), otherwise they will be ignored.
  • The attached tags must exactly match the tags present on the dashboard.

Adding Custom Metadata to Conversations

If you want to add Custom Metadata at the time of Issue creation, follow the steps.

  1. Initialize a top-level custom metadata Map
  2. Define your custom metadata Map
  3. Add the key-value pairs in that custom metadata Map
  4. Add the custom metadata Map to the top-level Map
  5. Pass the Map to configMap with key "customMetadata" to any of the SDK X APIs (like ShowConversation(configMap)).
Dictionary<string, string> customMetadataMap = new Dictionary<string, string>();
customMetadataMap.Add("Level", "9");
customMetadataMap.Add("Spend", "46.55 USD");
customMetadataMap.Add("Device Timestamp", DateTime.UtcNow.ToLongTimeString());

Map<String, Object> config = new HashMap<>();
// other configs...
//..
config.put("customMetadata", customMetadataMap);

Helpshift.showConversation(MainActivity.this, config);
Note

Metadata should only be sent as String key-value pairs.

  • Once customMetadata is set, if you want to reset it then you’ll have to call the SDK X API with an empty dictionary ie.
Dictionary<string, string> customMetadataMap = new Dictionary<string, string>();

Map<String, Object> config = new HashMap<>();
// other configs...
//..
config.put("customMetadata", customMetadataMap);

Helpshift.showConversation(MainActivity.this, config);

Set Custom Issue Fields

If you want to set Custom Issue Fields at the time of Issue creation, follow the steps.

  1. Initialise a top level custom issue fields' Dictionary
  2. Define your custom issue field Dictionary
  3. Add the "type" and "value" for that custom issue field
  4. Add the custom issue field map to top level map (with key as your configured key and value as custom issue field map)
  5. Pass the map to configMap with key "cifs" of the ShowConversation(configMap)

Dictionary<string, object> joiningDate = new Dictionary<string, object>();
joiningDate.Add("type", "date");
joiningDate.Add("value", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds());

Dictionary<string, string> stockLevel = new Dictionary<string, string>();
stockLevel.Add("type", "number");
stockLevel.Add("value", "1505");

Dictionary<string, string> employeeName = new Dictionary<string, string>();
employeeName.Add("type", "singleline");
employeeName.Add("value", "Bugs helpshift");

Dictionary<string, string> isPro = new Dictionary<string, string>();
isPro.Add("type", "checkbox");
isPro.Add("value", "true");

Dictionary<string, object> cifDictionary = new Dictionary<string, object>();
cifDictionary.Add("joining_date", joiningDate);
cifDictionary.Add("stock_level", stockLevel);
cifDictionary.Add("employee_name", employeeName);
cifDictionary.Add("is_pro", isPro);


Map<String, Object> config = new HashMap<>();
// other configs...
//..
config.put("cifs", cifMap);

Helpshift.showConversation(MainActivity.this, config);


Note
The "customIssueFields" key has been deprecated. We strongly recommend transitioning to using the "cifs" key as the preferred method for passing custom issue fields.

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:

TypeValueComments
singlelinestringCharacter limit of 255
multilinestringCharacter limit of 100,000
numberstring
dropdownstringDrop-down options should exist for the given Custom Issue Field
datenumberEpoch time in milliseconds. For example - DateTimeOffset.UtcNow.ToUnixTimeMilliseconds()
checkboxstringString representation of boolean. For eg. "true" or "false". This corresponds to the checkbox type custom issue field on dashboard.
Note

On Custom Issue Fields keys & compatibility

  • Custom Issue Fields must be created in the Helpshift Dashboard (SettingsCustom Issue Fields), otherwise they will be ignored. Read more here
Note

In the Breadcrumbs and Debug logs APIs, 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
Note

Applicable to SDK X Unity v10.1.0 & above.

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. For example:

HelpshiftSdk _support = HelpshiftSdk.GetInstance();
_support.LeaveBreadcrumb("Add breadcrumb");

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:

HelpshiftSdk _support = HelpshiftSdk.GetInstance();
_support.ClearBreadcrumbs();

Debug Logs

Note

Applicable to SDK X Unity v10.1.0 & above.

You may wish to pass additional debug logs with every new conversation filed by an end-user on Helpshift’s Agent Dashboard. For this, you can instantiate and use the HelpshiftLog class and its methods, which will provide varying degrees of logging. For example, if you want to attach debug level logs, please add the following code - For example:

using Helpshift;
HelpshiftLog.d("debug-tag", "debug-message");

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.