JsApi¶
The API on the global js object in the module scripting environment.
js.username¶
| Type |
|---|
string |
The current user’s username. Available in UFile, SFile, Module script enviornments
js.logEvent(pageview, elog, json)¶
Log an event.
| Param | Type | Description |
|---|---|---|
| pageview | boolean | indicates to call Google analytics w/ elog information |
| elog | object | json object of named params for GA & jsonsails logging |
| json | object | extra json field GA doesn't handle but offers more flexibility in jsonsails logging |
// logging example
var json = {};
var question = model.get_question();
json.choices = model.get_choices();
json.answer = model.answer;
var correct = model.resp_correct();
var elog = {
'eventCategory': 'nts',
'eventAction': 'answer',
'eventLabel': 'correct',
'eventValue': correct
};
var elog = {}
var json = {}
js.logger.logEvent(pageview, elog, json)
js.rerender()¶
Rerender this module and its children