Miscellaneous

Get Information about the Current Device

MyDataHelps.getDeviceInfo()

Returns

Promise<DeviceInfo>

Resolves to a result object containing device info 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 Views
MyDataHelps Embeddables
Web View Steps
Getting Device Info on Various Platforms
MyDataHelps.getDeviceInfo()
	.then( function(result) {
		console.log(result);
	} );
MyDataHelps.getDeviceInfo() .then( function(result) { console.log(result); } );
Output from Chrome on Windows 10
{
  "identifier": "4ef563af-647b-451d-92c2-8acb41e2b2f5",
  "platform": "Web",
  "properties": {
    "Browser": "Chrome",
    "BrowserVersion": "89.0.4389.114",
    "OperatingSystem": "Windows",
    "Resolution": "1920 x 1080"
  }
}
{ "identifier": "4ef563af-647b-451d-92c2-8acb41e2b2f5", "platform": "Web", "properties": { "Browser": "Chrome", "BrowserVersion": "89.0.4389.114", "OperatingSystem": "Windows", "Resolution": "1920 x 1080" } }
Output from MyDataHelps on iOS (native)
{
  "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": "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" } }
Output from MyDataHelps on Android (native)

{
  "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"
  }
}
{ "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

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps
Getting Current Language
const lang = MyDataHelps.getCurrentLanguage();
console.log(lang);
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.

Parameters

event object

Event details.

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 Views
MyDataHelps Embeddables
Web View Steps
Tracking a Custom Event
MyDataHelps.trackCustomEvent({
  eventType: "ViewedHelp",
  properties: {
    "helpTopic": "Topic A"
  }
})
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

MyDataHelps Views
MyDataHelps Embeddables
Web View Steps

Initialize the Participant Session

setParticipantAccessToken(token)

Saves the participant’s access token and begins a session.