Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

SNMobileAnalytics API

The SNMobileAnalytics API provides methods that you can call within a WebView using JavaScript. These methods enable you to push custom analytics data (events, pages, and user properties) to the Usage Insights for Service Portal dashboard.

To use these methods within your mobile application, you must first call the installJavascriptInterface() method, which exposes these JavaScript methods to the associated WebView.

Refer to NowAnalyticsService - installJavascriptInterface(into webView: WKWebView) for the iOS implementation.

Refer to NowAnalyticsSDK - installJavascriptInterface(webView: WebView) for the Android implementation.

Parent Topic:Mobile SDK - iOS

SNMobileAnalytics - addEvent(String eventName, Object properties)

Adds a new web-triggered event with its associated properties to the current mobile session timeline.

NameTypeDescription
eventNameStringName of the event to add.
propertiesObject

Optional. List of custom property key-value pairs for the event. Supported value types:

  • Boolean
  • Date
  • Number
  • String

Note: The total size of the eventName, properties key and value should not exceed 300 bytes (per event).

TypeDescription
None 
SNMobileAnalytics.addEvent('MyEvent', JSON.stringify({'Type': 'Show', 'Amount': 16}))

SNMobileAnalytics - addScreenAction(String actionName)

Adds a new screen UI action tag to the current mobile session time line.

NameTypeDescription
actionNameStringName of the triggered web action.
TypeDescription
None 
SNMobileAnalytics.addScreenAction('Custom UI Action')

SNMobileAnalytics - setUserId(String userId)

Sets the ID of the current active user for the current mobile session.

NameTypeDescription
userIDStringID to set for the current user.
TypeDescription
None 
SNMobileAnalytics.setUserId('user123') 

SNMobileAnalytics - startScreen(String screenName)

Adds a new web-triggered page to the current mobile session time line.

NameTypeDescription
screenNameStringName of the screen to log the start time for, such as WelcomeScreen.
TypeDescription
None 
SNMobileAnalytics.startScreen('My Web Page')