Was this article helpful?

Notifications

Last modified 14:42, 22 Jul 2014

 

Note: Game Mechanics is a premium platform that requires separate activation. If Game Mechanics is not part of your site package please contact your Gigya account manager or contact us by filling in a support form on our site. You can also access the support page by clicking "Support" on the upper menu of Gigya's site.

 

Introduction

The Game Mechanics (GM) Notifications plugin notifies the user of his latest achievement, and allows him to share this to his social networks.

The plugin is displayed as a popup window on the right hand corner of the page, and appears whenever the user unlocks a new level of any of the active challenges.

Each site may have one or more challenges, and each challenge has defined levels. Each level has a badge associated with it, and a level title. A user may achieve a level in a certain challenge by performing actions and accumulating points for these actions. To learn more about Gigya's Game Mechanics, refer to our Game Mechanics Guide.

The Notifications plugin displays the user's new achievement:

gm_notification.gif
 

The Notifications plugin is divided into a header, body, and footer, and displays:

Header:

  • A header alerting the user of the new achievement

​Body:

  • The badge of the newly unlocked level
  • The title of the new level
  • The description of the challenge as defined in the Challenge Settings page at Gigya's site

Footer:

    The footer display changes based on whether the challenge is point based or action based. In case of a points based challenge, the footer will display:

  • The number of points needed to achieve (unlock) the next level of the challenge
  • The title of the next level to be unlocked in the challenge
  • A grayed out badge of the next level
  • A Share button

    In case of an action/mixed-based challenge, the footer will not display the number of points required to level up.
    Instead, it will display a link to the action URL, if it was defined in the challenge settings
 

The Share Button

Pressing the Share button opens the Share plugin with the challenge information:

gm_userStatus_share.gif

The Share plugin allows the users to publish their achievements to various social networks. Learn about the Share plugin here.

Quick Start Implementation

Adding the Notifications plugin is simple, and involves only adding one line of code:


Add the following code snip to the <body> of your page to activate the Notifications plugin:

gigya.gm.showNotifications();

Like every Gigya API method, the gm.showNotifiaction API method receives one parameter - parameters object, which is empty in this case; all parameters of the Notifications plugin are optional, so there is no need to define the params parameter of the gm.showNotifications API method (learn more about Gigya's basics here). 

There are additional optional parameters. Please refer to the method's parameters table for the entire list of optional parameters.

 

 

A Working Example

In the GM Plugins demo you will find a complete working example of a web-page that uses all GM plugins, including the Notifications plugin. You may view the code, run it and view the outcome.

 

 

Customizing the User Action

The userAction object to be used for sharing the user's achievement, and it is comprised of several optional elements, such as title, description, etc. The newsfeed that is published to the social networks is constructed from the fields of this object.

If a userAction object is not defined, the plugin uses a default userAction object, the content of which is suited to sharing the user's achievement. You can customize the user action by constructing a new userAction object, filling it with data, and adding it to the plugin's parameters.

 

Construct a new userAction object using the userAction object constructor:

var notificationUA = new gigya.socialize.UserAction();

Change the default user action, by using the various UserAction member methods to set the object's properties. For example: 

notificationUA.setTitle('$challengeTitle');
notificationUA.setDescription('*** Challange title: $challengeTitle *** Level title: $levelTitle *** Challange description: $challengeDescription ***');
notificationUA.addImage('$badgeURL');

Add the userAction object to the plugin's parameters:

var notificationParams = {
	userAction:notificationUA
}

Pressing the Share button in the Notifications plugin will now open the Share plugin with the new user action properties:

gm_new_userAction.gif

You can refer to the Advanced Sharing guide to learn more about the UserAction object and how to implement the full richness of newsfeed reports, including adding various media items (Images/ a Flash file/ Mp3 file/ a Video).

Tags

This page has no custom tags.

Comments

You must to post a comment.

Attachments