Miscellaneous
MyDataHelps.getDeviceInfo()
Returns
Promise<DeviceInfo>
Resolves to a result
object containing device info fields.
Result Fields
result.identifier
guid
Unique identifier for device. On web browsers, this is kept in a cookie which can sometimes be reset.
result.platform
string
Describes how the participant is accessing the application. Possible values include: Web
(using the MyDataHelps web application on any device), iOS
(iOS native app), and Android
(Android native app).
result.properties
object
Platform-specific fields providing additional information about the device. These fields vary depending on device/browser/OS.
Availability
MyDataHelps.getDeviceInfo()
.then( function(result) {
console.log(result);
} );
{
"identifier": "4ef563af-647b-451d-92c2-8acb41e2b2f5",
"platform": "Web",
"properties": {
"Browser": "Chrome",
"BrowserVersion": "89.0.4389.114",
"OperatingSystem": "Windows",
"Resolution": "1920 x 1080"
}
}
{
"identifier": "D4CDB2C5-13A6-4911-810F-688EF90DDCAA",
"platform": "iOS",
"properties":
{
"TextingCapability": "Available",
"NotificationAlertSetting": "Enabled",
"AppVersion": "2021.7",
"NotificationBadgeSetting": "Enabled",
"NotificationAuthorizationStatus": "Authorized",
"NativeResolution": "828 x 1792",
"LocationAccuracyAuthorizationStatus": "Full",
"LocationAuthorizationStatus": "AuthorizedAlways",
"BackgroundAppRefreshStatus": "Available",
"AppName": "MyDataHelps",
"iOSVersion": "14.4.2",
"HardwareModel": "iPhone11,8",
"DeviceType": "mobile",
"MovementDisorderStatus": "Unknown",
"NotificationSoundSetting": "Enabled",
"Resolution": "414 x 896"
}
}
{
"identifier": "5dc2a1f1-fb2e-4449-837b-6babd2722282",
"platform": "Android",
"properties":
{
"AppName": "MyDataHelps",
"NativeResolution": "900 x 1600",
"Resolution": "450 x 776",
"HardwareModel": "SM-G955N",
"AppVersion": "2021.14",
"DeviceType": "mobile",
"AndroidVersion": "7.1.2"
}
}
Get the Current Language
MyDataHelps.getCurrentLanguage()
Returns
lang
string
The language code configured on the current device, to be used when determining what language to show content in. In the native apps, this will be the language the device itself is configured for. On web, the user is given an option to choose the language they view MyDataHelps in. Formatting is device-dependent. For example, Chrome on Windows 10 may return ‘en’, the iOS native app ‘en-us’, and the Android native app ‘en-US’.
Availability
const lang = MyDataHelps.getCurrentLanguage();
console.log(lang);
Track Custom Events
MyDataHelps.trackCustomEvent(event)
You can use custom events to track user actions, such as clicking a link or searching for a topic. Whenever you record a custom event, you give it a type (a name you use to distinguish one kind of event from another) and a key/value set containing whatever details you wish to record about the event. In addition to the data you log, custom events will automatically include:
ParticipantID
ParticipantIdentifier
Timestamp
Custom events can be accessed via the Custom Events Export.
Tip
It is not necessary to create custom events for system events already reported through the
Analytics Export.
Parameters
event
object
Child Fields
event.eventType
string
Identifies what kind of event occurred.
event.properties
object
Key-value pairs with custom event properties.
Returns
Promise
A promise which resolves if the operation succeeded.
Availability
MyDataHelps.trackCustomEvent({
eventType: "ViewedHelp",
properties: {
"helpTopic": "Topic A"
}
})
Set the Status Bar Style (iOS Native Only)
MyDataHelps.setStatusBarStyle(style)
See the iOS status bar style documentation.
Parameters
style
string
(required)
Allowed values are darkContent
, lightContent
, and default
. If you want the status bar to appear in white, pass lightContent
to this action.
Availability
Initialize the Participant Session
setParticipantAccessToken(token)
Saves the participant’s access token and begins a session.
Note
This is only necessary when using the SDK in a MyDataHelps Embeddable. For Web View steps and custom views, the token is managed for you automatically. See
Participant Access Tokens for more details about managing sessions in Embeddables.