Customizing Gamification Components using Script

You can listen to the following events and use them to do customize the gamification experience:

Wheel starts spinning: onTriggerbeeSpinTheWheelSpinStart

Wheel stops spinning: onTriggerbeeSpinTheWheelSpinEnd

User finishes a Memory game: onTriggerbeeMemoryFinished

Example code:

document.addEventListener("onTriggerbeeSpinTheWheelSpinStart", function (event) {
    console.log('onTriggerbeeSpinTheWheelSpinStart', event.detail);
	/*
	{
	    widgetId: id of widget,
		slice: {
      		    label: label of slice the wheel stops on,
      		    isWinner: is this a winner-slice
    	    }
	}
	*/
});
document.addEventListener("onTriggerbeeSpinTheWheelSpinEnd", function (event) {
    console.log('onTriggerbeeSpinTheWheelSpinEnd', event.detail);
	/*
	{
	    widgetId: id of widget,
		slice: {
      		    label: label of slice the wheel stops on,
      		    isWinner: is this a winner-slice
    	    }
	}
	*/
});
document.addEventListener("onTriggerbeeMemoryFinished", function (event) {
    console.log('onTriggerbeeMemoryFinished', event.detail);
  	/*{
              widgetId: id of widget,
              component: The components html-element,
              elapsedTimeMs: Elapsed time in miliseconds,
              elapsedTime: Formated elapsed time in seconds
    }*/
});

Start spin the wheel animation:

You can initiate spinning using script, for example from your own button. Use this method:

triggerbee.widgets.spinTheWheel.letsSpin();
Example of letsSpin() method.


.

Still need help? Contact Us Contact Us