Class AppMetricaJsInterface

java.lang.Object
com.yandex.metrica.AppMetricaJsInterface

public class AppMetricaJsInterface
extends java.lang.Object
This class is used as a bridge between Javascript and native code. It allows to report AppMetrica events directly from JS code. For more info see method descriptions.
  • Constructor Summary

    Constructors
    Constructor Description
    AppMetricaJsInterface​(com.yandex.metrica.impl.proxy.YandexMetricaProxy proxy)  
  • Method Summary

    Modifier and Type Method Description
    void reportEvent​(java.lang.String name, java.lang.String value)
    Reports event with name and json value to AppMetrica from JS code.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AppMetricaJsInterface

      public AppMetricaJsInterface​(@NonNull com.yandex.metrica.impl.proxy.YandexMetricaProxy proxy)
  • Method Details

    • reportEvent

      public void reportEvent​(java.lang.String name, java.lang.String value)
      Reports event with name and json value to AppMetrica from JS code. Example of usage in JS:
       
           function reportToAppMetrica() {
               // you can skip this check if you guarantee that it is always present
               if (typeof(AppMetrica) !== 'undefined') {
                   AppMetrica.reportEvent("My name", "{}");
               }
           }
       
       
      Parameters:
      name - event name
      value - event value in json format