Logging events

You can log any event in your application using the JavaScript SDK’s Medio.EventApi.logEvent method. As an example, you may want to log an event named “clickButton” when a user clicks on a button in your application:

Medio.EventApi.logEvent("clickButton", null);

Note that before logging any events, your application must call the Medio.EventApi.initilize method in the page’s head section. See Adding the SDK for more information.

Events with key-value pairs

You can include additional event properties as key-value pairs when you log events using the Medio.EventApi.logEvent method. On the “clickButton” event, you may want to log the button name as a key-value pair (e.g., buttonName = “Done”):

Medio.EventApi.logEvent("clickButton", {"buttonName": "Done"});

Page request events

You can log requests for specific pages in your web application using the Medio.EventApi.logPageRequest method. Call the method in the head section whenever the browser loads a page:

Medio.EventApi.logPageRequest();