html_interface_library

Need

The HTML interface library eases the HTML developer’s effort to log telemetry events from HTML content. It uses simple API methods exposed by the library to log associated events. The reasons to develop the HTML interface library are:

  • Any HTML content can package the interface library as part of the content. Thus using the library, the HTML content can log telemetry events.

  • There are simple API methods to generate the complete telemetry event as only the required fields are passed

  • It is easy to upgrade to new versions, in case of major changes in the telemetry library

  • There is effortless backward compatibility, as changes are handled within the telemetry library. Any upgrade of the telemetry library does not require code changes in the content

  • The library will handle logging of events from HTML content when it is playing in case portal or device/app.

How to use HTML interface library

Add the following to your HTML Content:

The file_path is the relative path (eg. assets/js) to these files within the html content.


<!-- HTML Interface  JS library -->
<script src="[relative_path]/htmlinterface.js"></script>

//you can log telemetry interact event as shown below
org.ekstep.contentrenderer.interface.telemetryService.interact(data) 
//or 
RI.telemetryService.interact(data)

API methods

The HTML interface provides simple methods to log telemetry, to handle the ContentRenderer overlay, to get content information, etc.

The HTML interface exposes the following list of API methods:

DispatchEvent

Dispatch an specific event to control ContentRenderer functionalities.

getcontentMetadata

This will return the content metadata information(HTML Cotnent metadata here).

getConfig

This will return the content renderer configuration. This will help to know what is the context of HTML content playing in ContentRenderer.

gotoEndPage

After completion of HTML content, you can call this function to show ContentRenderer end-page. This will take the user out of HTML content view.

exit

If you want to close the HTML game & contentRenderer to take user back to app, you can call this function.

Telemetry Interact

Api method to log telemetry interact events. Any interact events in HTML can log using this API method.

Telemetry Response

Api method to log telemetry response events. When an assessment is playing in content, on selection of option/answer data can be passed by calling this function.

Telemetry assessmentStart

Api method to get assessment start event data. This event object should be passed as a parameter while calling telemetry assess api method.

Telemetry Assess

Api method to log telemetry assess event. After submitting/validating the result of assessment question, call this funciton to log assessment result data.

Telemetry Impression

Api method to log telemtry impression event. When there is a state/page change, call this method to log impression event

Telemetry Exdata

Api method to log telemtry exdata events. Any additional information of can be passed by calling this function.

Last updated

Was this helpful?