-
Notifications
You must be signed in to change notification settings - Fork 84
BuildFire Gamify
This sdk documentation is deprecated and will not be updated. Check out our new docs at https://sdk.buildfire.com/docs/gamify/
This is a service that provides some reusable features that help gamify your app.
Typically whenever there is a scoring system that you dont mind being public. This ties in with push notifications it triggers notifications to users as the scoreboard changes. It created engaging competition among your users
From the Widget
<script src="../../../scripts/buildfire/services/gamify/scoreboard.min.js"></script>
<script src="../../../scripts/buildfire/services/notifications/pushNotifications.js"></script>
From the Control
<script src="../../../../scripts/buildfire/services/gamify/scoreboard.min.js"></script>
<script src="../../../../scripts/buildfire/services/notifications/pushNotifications.js"></script>
buildfire.gamify.Scoreboard(tagName, size, autoSubscribeToPushNotification)
-
tagName: this is a string that is used to create a public data object to save your scoreboard in -
size: this is an integer that limits the size of the scoreboard example top 10, top 25, top 100 ...etc -
autoSubscribeToPushNotification: this is a boolean that dictates whether or not you want logged in users to automatically subscribe to the push notifications custom group
-
subscribe(callback): this method will subscribe the current logged in user to the push notifications group-
callback(error)is a function that is called upon the completion of the subscription. theerroris an object that will be provided if there is an error
-
-
unscubsribe(callback): this method will unsubscribe the current logged in user to the push notifications group-
callback(error)is a function that is called upon the completion of the subscription. theerroris an object that will be provided if there is an error
-
-
logScore(user, score,callback): this method logs the user's score and will check to see if it qualifies to make it to the top of the list. If the user makes it to the top 3 on the scoreboard it will trigger corresponding push notifications. Also if you get knocked off the scoreboard you will get a push notification. It also increases the play count number.-
user: object representing the user you want to log the current score for. -
score: integer representing the user's score -
callback(error,result): function returning-
error: error object if any -
result: object with the scoreboard data-
bumpedOff: user object. if you make it to the scoreboard and bump off someone from the list, that record is returned to you. -
rankedAt: integer. If you make it to the scoreboard it will inform you at what position.
-
-
-
-
reset: this method is used to reset the scoreboard -
getScoreboard: this returns an object with the scoreboard data and number plays made-
error: error object if any -
result: object with the scoreboard data-
gamesPlayed: integrer with the number of scores logged over time -
topScores: array of score record objects. records are sorted in the array by score-
user: user object -
score: integer with the score of the user -
createdOn: date object with the timestamp of when the record was created
-
-
-