.eventLog.Schema(name, samplingRateopt, defaultsopt)

The class allows inheriting classes to log events based on a sampling rate if sampling is enabled.

If the schema uses different sampling rates for different events, samplingRate can also be passed to individual events.


new mw.eventLog.Schema(name, samplingRateopt, defaultsopt) #


var mySchema = new mw.eventLog.Schema( 'Name', 0.01, { skin: 'minerva' } );
// Log the following event at the default sampling rate of 0.01.
mySchema.log( { action: 'viewed' } );
// Log the following event at the sampling rate of 0.2.
mySchema.log( { action: 'clicked' }, 0.2 );


Name Type Attributes Default Description
name string

Schema name to log to.

samplingRate number <optional>

The rate at which sampling is performed. The values are between 0 and 1 inclusive.

defaults Object <optional>

A set of defaults to log to the schema. Once these defaults are set the values will be logged along with any additional fields that are passed to the log method.



log(data, samplingRateopt) #

Log an event via the EventLogging subscriber.


Name Type Attributes Description
data Object

Data to log

samplingRate number <optional>

Number between 0 and 1. Defaults to this.samplingRate.

Log an event via the EventLogging subscriber.