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 and Description
AppMetricaJsInterface(com.yandex.metrica.impl.proxy.YandexMetricaProxy proxy) 

Method Summary

All Methods
Instance Methods
Concrete Methods
Modifier and TypeMethod and Description
voidreportEvent(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 Detail

AppMetricaJsInterface

public AppMetricaJsInterface(@NonNull
                             com.yandex.metrica.impl.proxy.YandexMetricaProxy proxy)

Method Detail

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