Skip to main content

Tracking Android

Important
Helpshift’s Legacy SDKs (SDK Version <=7.x.x) reached their end of life on 31 Dec 2022, and end of support on 31 March 2023. Please upgrade to the Latest SDKif you haven't already.

Tracking Android

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

Note

This API is now deprecated with Xamarin SDK v3.0.

It is expected that developers will pass the Name, Email or User Identifier using the Login API going forward.

Also, please note that this API will not work with the Conversational Experience. However, there will no impact on older SDK versions. They will keep on working as usual.

User Identifier

Note

This API is now deprecated with Xamarin SDK v3.0.

It is expected that developers will pass the Name, Email or User Identifier using the login API going forward.

Also, please note that there will no impact on older SDK versions and that they will keep on working as usual.

Multi Login

Details on User management are available here

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:

HelpshiftApi.HelpshiftSupport.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:

HelpshiftApi.HelpshiftSupport.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.

In all the API calls which launch the Help section, you can add a meta-data dictionary in the config dictionary parameter using the HelpshiftApi.HelpshiftSupport.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.

Note

While metadata can be set anytime, it will only be sent to the Admin Dashboard when an end user starts a new conversation.

As soon as an end user opens the conversation screen, that end user will see a greeting message, and the conversation is considered active.

Any modified metadata (updated during an active conversation) will only be sent within the next conversation that the end user starts.

Attaching tags with metadata

Note

On tag names & compatibility

  • 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.

Examples :

You can attach tags with metadata to every reported issue via a reserved constant key HelpshiftApi.HelpshiftSupport.HSTAGSKEY. This is used with the config dictionary as follows:

    string[] tags = new string[] { "feedback", "paid user" };
Dictionary<string, object> userData = new Dictionary<string, object>();
userData.Add("usertype", "paid");
userData.Add("level", "7");
userData.Add("score", "12345");
HelpshiftSupportMetadata metadata = new HelpshiftSupportMetadata(userData, tags);
HelpshiftAPIConfig apiConfig = new HelpshiftAPIConfig.Builder()
.SetCustomMetadata(metadata)
.Build();
HelpshiftApi.HelpshiftSupport.ShowFAQs(this, apiConfig);
Note

Applicable to version 3.0.0 and above.

Attaching Custom Issue Fields to conversations

Note

On Custom Issue Fields keys & compatibility

  • Applicable to SDK v2.5.0 & above.
  • Custom Issue Fields must be created in the Helpshift Dashboard (Settings -> Custom Issue Fields), otherwise they will be ignored. Read more here.

You can attach Custom Issue Fields to every new conversation started by the user. A Custom Issue Field should have a key, a data type, and a value. The SDK allows the addition of a dictionary of Custom Issue Fields by using the SetCustomIssueFields method in the HelpshiftAPIConfig class.

These Custom Issue Fields would be sent whenever a new conversation is started by the end user.

As soon as an end user opens the conversation screen, they will see a greeting message, and the conversation is considered active.

Any modified Custom Issue Fields (updated during an active conversation) will only be sent within the next conversation that the end user starts.

Possible datatypes to be passed into the config are:

TypeComments
"sl"Single line string with character limit of 255
"ml"Multi line string with character limit of 100,000
"n"String representation of a number. For eg. "12345"
"dd"Drop-down options should exist for the given Custom Issue Field on dashboard. Value should be one of the values specified on the dashbaord for that dropdown.
"dt"String representation of epoch time in milliseconds. For eg. "1505927361535"
"b"String representation of boolean. For eg. "true" or "false". This corresponds to the checkbox type custom issue field on dashboard.
    Dictionary<string, string[]> customIssueFields = new Dictionary<string, string[]>();
// The format for calling Add is customIssueFields.Add(<key>, new string[]{<datatype>, <value>});
customIssueFields.Add("join_date", new string[]{"dt", "1505927361535"});
customIssueFields.Add("level", new string[]{"n", "42"});
customIssueFields.Add("name", new string[]{"sl", "John Doe"});
customIssueFields.Add("address", new string[]{"ml", "3346, Sunny Glen Lane,
Warrensville Heights, Ohio - 44128"});
customIssueFields.Add("is_pro", new string[]{"b", "true"});
customIssueFields.Add("currency", new string[]{"dd", "Dollar"});

HelpshiftAPIConfig apiConfig = new HelpshiftAPIConfig.Builder()
.SetCustomIssueFields(customIssueFields)
.Build();
HelpshiftApi.HelpshiftSupport.ShowFAQs(activity, apiConfig);
Note

Applicable to version 3.0.0 and above.

Check if there exists an active Conversation

Note

Applicable to SDK v2.4.0 and above

This API determines if there is currently an ongoing Conversation in the SDK. You can use "HelpshiftApi.HelpshiftSupport.CheckIfConversationActive()" and implement Helpshift delegate DidCheckIfConversationActive method as shown below to get a boolean value that indicates whether there is an active Conversation open for the user. As soon as an end user opens the conversation screen, they will see a greeting message, and the conversation is considered active.

For example:

    HelpshiftApi.HelpshiftSupport.CheckIfConversationActive();

You can implement the "DidCheckIfConversationActive" delegate method like the following example:

    using HelpshiftApi;

public class HSDelegate : ISupportDelegate {

.
.
.
.
.
.
public void DidCheckIfConversationActive(bool isActive) {
// your code here
}
}