SNMobileAnalytics API

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:3分
  • 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.

    SNMobileAnalytics - addEvent(String eventName, Object properties)

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

    表 : 1. Parameters
    Name Type Description
    eventName String Name of the event to add.
    properties Object Optional. List of custom property key-value pairs for the event.
    Supported value types:
    • Boolean
    • Date
    • Number
    • String
    注:
    The total size of the eventName, properties key and value should not exceed 300 bytes (per event).
    表 : 2. Returns
    Type Description
    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.

    表 : 3. Parameters
    Name Type Description
    actionName String Name of the triggered web action.
    表 : 4. Returns
    Type Description
    None

    SNMobileAnalytics.addScreenAction('Custom UI Action')

    SNMobileAnalytics - setUserId(String userId)

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

    表 : 5. Parameters
    Name Type Description
    userID String ID to set for the current user.
    表 : 6. Returns
    Type Description
    None

    SNMobileAnalytics.setUserId('user123') 

    SNMobileAnalytics - startScreen(String screenName)

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

    表 : 7. Parameters
    Name Type Description
    screenName String Name of the screen to log the start time for, such as WelcomeScreen.
    表 : 8. Returns
    Type Description
    None

    SNMobileAnalytics.startScreen('My Web Page')