Tracking iOS

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

Name and email

You can set the name and email for the user, using setNameAndEmail. For example:

helpshift.setNameAndEmail("John Doe", "john.doe@johndoe.com");

username-email-sdk.png

The SDK prefills the previously used name and email in the new conversation screen. If you want to clear these fields, please use the setNameAndEmail API with both params set to null. For example:

helpshift.setNameAndEmail(null, null);

The name and email shows up in the issue's sidebar in the agent dashboard -

username-email-admin.png

User Identifier

If you have an identification for your users, you can specify that as well using login. For example:

helpshift.login("unique-user-id-746501", "John Doe", "john.doe@app.co");

This shows up in the issue's sidebar in the agent dashboard -

user-id-admin.png

User identifier should always be unique for each user.

In issue sidebar in the agent dashboard, other issues by the same user are also matched using user identifier. So make sure it is unique for each user.

other-issues-by.png

Multi Login

These APIs give developers the ability to allow multiple users to chat with agents on the same app

Logging in

You can login a user via login

The identifier uniquely identifies the user. Name and email are optional. It is the app developer's responsibility to make sure that the identifier is unique.

For example:

helpshift.login("unique-user-id-746501", "John Doe", "john.doe@app.co");

Logging out

The logout API will logout the currently logged in user. After logout, Helpshift falls back to the default login.

For example:

helpshift.logout();

Important notes

  • If you are passing in user-login dependent meta-data, please make sure you reset the meta-data through the Helpshift APIs when you change the login.
  • If you are using the leaveBreadCrumb API to pass user login related crumbs, please make sure to call the clearBreadCrumsbs API when you change the login.
  • After logout, user can still submit a new conversation, but it will be with the device credentials
  • If any of the helpshift screens is currently being shown in the app, then any login/logout attempt is ignored.
  • If login api is called with different user identifier, then it first logs out the currently logged in user and then logs in with this user identifier.
  • Use setNameAndEmail only if login is not being used.
  • If setNameAndEmail is used when already logged in, then it will overwrite the logged in user name and email.
  • setUserIdentifier does not relate to user login.
  • It is best to call login immediately when your app user logs in.

App usage

Breadcrumbs will help you track events or user actions and when user starts a new conversation, these breadcrumbs can be seen along with the conversation in the admin site. To leave breadcrumbs can use leaveBreadCrumb. For example:

helpshift.leaveBreadCrumb("Went to Preferences Screen");

Breadcrumbs will be collected within the set breadcrumb limit. This is set in the SDK Configurations section for app settings in the agent dashboard. Breadcrumbs are collected in a FIFO queue. If you want to clear the breadcrumbs queue, please use the clearBreadCrumbs API call. For example:

helpshift.clearBreadCrumbs();

Attaching metadata to reported issues

You can attach additional metadata to every new conversation started by the app user via two simple mechanisms provided by the SDK. This metadata can range from user-name, email etc to game scores, current game levels and any other data relevant to creating a suitable context to each new conversation.

There are 2 ways in which this metadata can be attached to reported issues.

  1. Whenever the user enters the Help section of your app, the Helpshift sdk will send an "updateMetaData" message to the registered game object (Please refer to the install API for details). In response to this message, your script should immediately the updateMetaData API to update the metaData. The updated meta data will be sent with the next issue that the user files.

  2. In all the API calls which launch the Help section, you can add a meta-data dictionary in the config dictionary parameter using the HSCUSTOMMETADATAKEY key. This meta-data will be sent along with the next reported issue. When the user exits out of the Help section this meta-data will be dropped in favor of the meta-data sent in the next Helpshift API call.

Attaching tags with metadata

On tag names & compatibility

  • Applicable to SDK v 2.8.0 & above.
  • Tags must be lowercase.
  • Please do ensure that the tags you send via meta data, are exact matches of tags that exist in the admin site.

metadatatags.png

Examples :

  1. You can attach tags with metadata to every reported issue via a reserved key constant Helpshift.HSTAGSKEY. This is used with updateMetaData as follows:

    Helpshift help = new Helpshift();
    Dictionary<string, object> configMap = new Dictionary<string, object>();
    configMap.Add("Level", "9");
    configMap.Add("Spend", "46.55 USD");
    configMap.Add("Device Timestamp", DateTime.UtcNow.ToLongTimeString());
    configMap.Add(Helpshift.HSTAGSKEY, new string[] {"Whale"});
    help.updateMetaData(configMap);
    
  2. You can attach tags with metadata to every reported issue via a reserved constant key HSTAGSKEY. This is used with the config dictionary as follows:

    Helpshift help = new Helpshift();
    Dictionary<string, object> configD = new Dictionary<string, object>();
    configD.Add("gotoConversationAfterContactUs", "yes");
    configD.Add("enableContactUs", "yes");
    Dictionary<string, object> configMap = new Dictionary<string, object>();
    configMap.Add("Level", "91");
    configMap.Add("Spend", "48.55 USD");
    configMap.Add("Device Timestamp", DateTime.UtcNow.ToLongTimeString());
    configMap.Add(Helpshift.HSTAGSKEY, new string[] {"Whale"});
    configD.Add(Helpshift.HSCUSTOMMETADATAKEY, configMap);
    help.showFAQs(configD);
    

Check if an active Conversation exists.

Applicable to Helpshift Unity plugin v2.8.0 & above.

This API determines if there is currently an ongoing Conversation in the SDK. You can use "CheckIfConversationActive()" and implement the Helpshift delegate method didCheckIfConversationActive:(string isActive) as shown below to get a string with value either true or false. This string value indicates whether there is an active Conversation open for the user. A Conversation is considered inactive when a user cannot respond with new messages on it.

API:
using Helpshift;
.
.
.
private HelpshiftSdk help;
this.help = HelpshiftSdk.getInstance();
help.checkIfConversationActive();

Delegate:
public void didCheckIfConversationActive(string isActive) {
    if (isActive.Equals("true")) {
        //Active Conversation
    } else {
        //No open Conversation
    }
}

Debug logs

If you want to add debug logs at specific places within your application which will help you debug issues filed by the user, you can instantiate and use the HelpshiftLog class and its methods which will provide varying degress of logging. For example, if you want to attach debug level logs please add the following code

this.logger = new HelpshiftLog();
logger.d(<debug-tag>, <debug-message>);