Track events and user actions when the user starts a new conversation. Attach custom metadata to every conversation started via the SDK.
Applicable to SDK v3.0.0 and above
You can set the name and email for the user, using
setNameAndEmail. For example:
HelpshiftCocos2dx::setNameAndEmail("John Doe", "email@example.com");
The SDK prefills the previously used name and email in the new conversation screen. If you want to clear these prefilled fields, set both arguments to NULL (applicable to version 3.4.0 and above).
The name and email shows up in the issue's sidebar in the agent dashboard -
The users can change their name and email in the new conversation screen.
If you have an identification for your users, you can specify
that as well using
setUserIdentifier. For example:
This shows up in the issue's sidebar in the agent dashboard -
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.
Applicable to plugin v3.8.0 and above
These APIs give developers the ability to allow multiple users to chat with agents on the same app
You can login a user via login API.
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.
HelpshiftCocos2dx::login("unique-user-id-746501", "John Doe", "firstname.lastname@example.org");
The logout API will logout the currently logged in user. After logout, Helpshift falls back to the default login.
loginis not being used.
setNameAndEmailis used when already logged in, then it will overwrite the logged in user name and email.
setUserIdentifierdoes not relate to user login.
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:
HelpshiftCocos2dx::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:
You can attach additional metadata to every new conversation started by the app user via a very simple mechanism 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 HS_META_DATA_KEY macro. 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.
On tag names & compatibility
You can attach tags with metadata to every reported issue via the
HS_TAGS_KEY macro. This is used with the config dictionary as follows:
For cocos2d-x 3.x
ValueMap config; ValueMap meta; meta["usertype"] = Value("paid") meta["level"] = Value("7") meta["score"] = Value("12345") ValueVector tags; tags.push_back("feedback") tags.push_back("paid user") meta[HS_TAGS_KEY] = Value(tags) config[HS_META_DATA_KEY] = Value(meta) HelpshiftCocos2dx::showFAQs(config)
For cocos2d-x 2.x
cocos2d::CCDictionary *config = new cocos2d::CCDictionary(); cocos2d::CCDictionary *meta = new CCDictionary(); meta->setObject(new CCString("54$"), "Money spent"); cocos2d::CCArray *tags = new cocos2d::CCArray(); tags->addObject (new CCString("Whale")); tags->addObject (new CCString("Cocos2d-x")); meta->setObject(tags, HS_TAGS_KEY); config->setObject(meta, HS_META_DATA_KEY); HelpshiftCocos2dx::showFAQs(config);
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 use the log functions of the Helpshift class which will provide varying degress of logging. For example, if you want to attach debug level logs please add the following code
HelpshiftCocos2dx::logd("Helloworld", "This is the number : %d", 123);