You are not logged in.   Log in | Register

Using Widgets

From $1

The Socialize Widgets are pre-built Web GUI elements that can be used to perform common tasks which are related to Social Networks.

 

 

 

Widget Setup Wizards

The Widget Setup Wizards may be accessed from the "Widgets" section in Gigya's website. These Wizards are the best way to get started with Gigya Socialize and to get a basic integration up and running as quickly as possible. The Setup Wizards let you modify some basic settings, while previewing the changes as you make them. Based on your modifications, the Wizards generate code that you can insert into your own application with minimal modifications.

 

Step 1 of the setup lets you modify some common visual and behavioral properties of the Widget.

These settings take effect immediately so you can see a preview of your design in step 2, and finally step 3 you can grab the generated code to use in your application.

LoginSetupWizard.gif

Subsequent:

The Wizards allow you to easily perform modifications in the Widgets' visual aspects. The generated code is actually constituted of code fragments which simply display the Widget. In addition, to fully integrate a Widget and use its full functionality, you may wish to:

  • Create an action (button, link, etc) and associate it with the creation of the Widget.
  • Define event handlers and register for events which are initiated by the Widget; the next page, "Events", explains how this is done.

 

Note: the Setup Wizards currently generate only JavaScript code. If you are developing an ActionScript application you may customize the Widgets manually, by altering the Widget's parameters in the code (as shown in the examples further ahead in this page).

 

Dialog or Embedded

All Widgets may be displayed as dialogs (pop-up) at the center of the browser screen / Flash widget. They may also be embedded inside the application. This behavior is controlled by the presence of the containerID (for JS) /container (for AS3) parameter, which is passed to the Widgets' method calls (as part of the 'params' object). 

JavaScript

To embed a Widget in a certain DIV?, set the containerID parameter with the specific DIV id (see usage examples below).

If the containerID parameter is provided, the Widget will embed itself in the corresponding DIV - in which case the application must hide the Widget when it is no longer required. If the containerID parameter is not provided (or if it is set to 'null' value), the Widget will be displayed as a dialog and will disappear when the relevant user interaction is completed.

ActionScript

To embed a Widget in a certain container (e.g. Canvas), set the container parameter with the specific container object reference (see usage examples below).

If the container parameter is provided, the Widget will embed itself in the corresponding container - in which case the application must hide the Widget when it is no longer required. If the container parameter is not provided (or if it is set to 'null' value), the Widget will be displayed as a dialog and will disappear when the relevant user interaction is completed.

 

Available Widgets

There are currently five available Widgets:

  • Login - A user authentication Widget.
  • Connect - This Widget enables establishing connections to Social Networks.
  • Friend Selector - Displays the current user's friends and lets her select one or more for application related interactions.
  • Share - The Widget gives the user an option to publish a newsfeed to various social networks.
  • Newsfeed - The Widget displays recent user activities in a feed stream.
  • Edit Connections - Lets users connect to additional destinations and disconnect from their existing connections.

 

Login

The Login Widget is Gigya's user authentication Widget. It should be used by sites that wish to use Gigya as their authentication service or that wish to add Gigya as an authentication option for users.

The Widget displays all the available providers' logos as login options, enabling the user to login to your site via his social network / webmail account.

After the user logs in successfully, the onLogin global event is fired. The next page - Events, explains how to handle events.

 

The Login Wizard - Lets you customize the visual aspects of the Login Widget design, view, and grab the customized code.

 

Default look of the Widget:

LoginUI.gif

 

The following parameters are adjustable:

  • Widget size.
  • Select which social networks' buttons appear on the widget. The options are:  Facebook, Myspace, Twitter, Yahoo, LinkedIn, AOL, Windows Live ID, Google, WordPress, BloggerID, Typepad, liveJournal, Hyves, VeriSignID.
  • Can be shown as either as a popup dialog (default) or embedded in the application.
  • Colors: Widget background, frame, text, link, navigation arrow, caption background, caption text, button text.
  • Header text.
  • Caption text.
  • Caption: show or hide. By default the Widget shows a caption when in dialog mode.
  • “Terms” link: show or hide.
  • Buttons' size.
  • Buttons' design style - selecting one of the pre-defined design styles for the network buttons.
  • Custom Buttons' icons - replacing the icons of the network buttons to custom icons. The Custom Network Icons section guides how to implement this feature.
  • In JavaScript you may define redirection URL (after successful login).
  • And more.

 
API Method:

The API method which displays the Login Widget is: Socialize.showLoginUI

 

Usage Example:

<html>
<head>
<!-- Including the socialize.js script: -->
<script type="text/javascript" src="http://cdn.gigya.com/JS/socialize.js?apikey=INSERT-YOUR-APIKEY-HERE" ></script>

<script type="text/javascript">
//Define a configuration object. Insert your Gigya APIKey below:
var conf =
{
    APIKey: "INSERT-YOUR-APIKEY-HERE"
}

// Changing the default look and behavior of the Widget using the 'params' object:
var params =
{
    showTermsLink:false, // 'terms' link is hidden
    headerText:"Please Login using one of the following providers:", // adding header text
    height:105, // changing default Widget size
    width:360,  // changing default Widget size      
    
    containerID:"loginDiv", // The Widget will embed itself inside the "loginDiv" DIV (will not be a popup) 
    
    // Changes to the default design of the Widget's UI
    //     Background color is changed to pale blue and button size is set to 40 pixels:    
    UIConfig:"<config><body><background background-color=\"#ADC8FF\"></background><controls><snbuttons buttonsize=\"40\"></snbuttons></controls></body></config>",

    // Change the buttons design style to the 'blue' style:
    buttonsStyle:'blue',
    
    // After successful login - the user will be redirected to "www.MySite.com/welcome.html" :   
    redirectURL: "www.MySite.com/welcome.html",
  
    useFacebookConnect: true  
}

</script>
</head>
<body>
<div id="loginDiv"></div>
<script type="text/javascript">
    gigya.services.socialize.showLoginUI(conf, params);
</script>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="401" height="365" applicationComplete="init()">
	<mx:Canvas x="36" y="108" id="loginCanvas" width="325" height="200">
	</mx:Canvas>
	<mx:Script>
		<![CDATA[

			// Step 2 - Define a configuration object. Insert your Gigya APIKey below:
			private var conf:Object = { 
			    APIKey: "INSERT-YOUR-APIKEY-HERE"
			}	

			// This method is executed on applicationComplete				
			private function init():void {			
				// Initialize the "mcRoot" attribute of the conf object - should refer to the root of the flash container.
				this.conf.mcRoot=this.root;
				
				// Step 3 - Load socialize service
				// 3.1 Create the load-parameters object
				var loadParams:Object = {
				    services:'socialize',
				    callback:onGigyaInit
				}
				
				// 3.1 Load the services
				gigya.load(conf,loadParams);				
			}
			
			// 3.2 Wait for the load to complete and handle failures/success
			private function onGigyaInit(response:*):void {
			    if (response.hadError) {
			        // handle failure
					trace("An error has occurred while attempting to load Socialize service");
			    } else {
					showLoginUI();
			    }
			}
			
			private function showLoginUI(): void {
				// Step 4 - Define parameters object:
				var params:Object =
				{
				    showTermsLink:false, // 'terms' link is hidden
				    headerText:"Please Login using one of the following providers:", // adding header text
				    height:105, // changing default Widget size
				    width:360,  // changing default Widget size      
				    
				    container:loginCanvas, // The Widget will embed itself inside the loginCanvas container (will not be a popup) 
				    
				    // Changes to the default design of the Widget's UI
				    //     Background color is changed to pale blue and button size is set to 40 pixels:    
				    UIConfig:"<config><body><background background-color=\"#ADC8FF\"></background><controls><snbuttons buttonsize=\"40\"></snbuttons></controls></body></config>"
				  
				    // Change the buttons design style to the 'blue' style:
				    buttonsStyle:'blue'
				  
				};
	   
			    // Step 5 - Calling the Socialize API method - showLoginUI:
			    gigya.services.socialize.showLoginUI(conf, params);
			}
			
		]]>
	</mx:Script>
	
</mx:Application>
The output of this code:

login_change-default.gif

In the JavaScript implementation:
Following a successful login, the user will be redirected to "www.MySite.com/welcome.html". The following additional parameters will be appended to the URL string: UID, UIDSig, timestamp, loginProvider, nickname, photoURL, thumbnailURL, firstName, lastName, gender, birthDay, birthMonth, birthYear, email, country, state, city, zip, profileURL, proxiedEmail, provider.
For example:

http://www.MySite.com/welcome.html?zip=&
photoURL=http%3A%2F%2Fprofile%2Eak%2Efbcdn%2Enet%2Fprofile5%2F1719%2F30%2Fs722723209%5F4728%2Ejpg&
nickname=Assaften%20Esh&profileURL=http%3A%2F%2Fwww%2Efacebook%2Ecom%2Fprofile%2Ephp%3Fid%3D722723209&
birthMonth=10&loginProvider=&country=&thumbnailURL=&lastName=Esh&signature=XGcp4tmIVvQNCqG9pET7XbHaies%3D&
firstName=Assaften&provider=twitter&gender=&birthYear=1965&timestamp=2009%2D12%2D01%2011%3A05%3A33&UIDSig=&state=&
UID=123&email=&city=&birthDay=11&
proxiedEmail=apps%2B51244333578%2E722723209%2Edb978474083d884bcb0ba35d313c4c8f%40proxymail%2Efacebook%2Ecom

The parameters are equivalent to the User object fields. Please find the parameters' description in the User object reference page.

Note: redirect URL is not supported in ActionScript environment.

 

Last Logged In

The Login Widget give an indication of the last provider the user was logged into, so as to provide an improved user experience. The Widget will display the specific provider's logo first (the position will precede the rest of the logos) and will be ornamented with a star.

This is demonstrated in the following screenshot (in this example, user has previously logged-in to MySpace):

LastLoggedIn.gif

Note: You may change this default behavior by using the lastLoginIndication parameter (see the socialize.showLoginUI API method parameters reference) .

 

Connect

The Gigya Socialize Connect Widget enables establishing connections to Social Networks. Establishing connection with a Social Network enables an on-going social interaction with that SN, which includes: retrieving information about the user and his friends, updating status, sending newsfeed items and notifications. A user can connect to multiple SNs, regardless of using / not using Gigya Socialize for logging in.

 

The Connect Wizard - Lets you customize the Connect Widget visual design, view, and grab the customized code.

 

Default look of the Widget:

ConnectUI.gif


The following parameters are adjustable:

  • Widget size.
  • Select which social networks' buttons appear on the widget. The options are:  Facebook, Myspace, Twitter, Yahoo, LinkedIn.
  • Can be shown as either as a popup dialog (default) or embedded in the application.
  • Colors: Widget background, frame, text, link, navigation arrow, caption background, caption text, button text.
  • Header text.
  • Caption text.
  • Caption: show or hide. By default the Widget shows a caption when in dialog mode.
  • “Terms” link: show or hide.
  • Buttons' size.
  • Buttons' design style - selecting one of the pre-defined design styles for the network buttons.
  • Custom Buttons' icons - replacing the icons of the network buttons to custom icons. The Custom Network Icons section guides how to implement this feature.
  • And more.

After the user connects to social networks, the connected social network buttons are marked and grayed out (see screenshot below). In addition,  an "Edit" link appears automatically below the buttons, to give the user the ability to edit his connections and disconnect. Clicking the Edit link opens the Edit Connections widget.

ConnectUI-connected.gif

 

API Method:

The API method which displays the Connect Widget is: socialize.showConnectUI

 

Usage Example:

<html>
<head>
<!-- Including the socialize.js script: -->
<script type="text/javascript" src="http://cdn.gigya.com/JS/socialize.js?apikey=INSERT-YOUR-APIKEY-HERE" ></script>

<script type="text/javascript">
var conf=
{
    APIKey: "INSERT-YOUR-APIKEY-HERE"
}

var params=
{
    enabledProviders:"facebook,myspace",  // Limiting the Widget to show only facebook and myspace buttons
    headerText: "My title",  // add a title
    height: 73,                // define size
    width: 147,                
    containerID: "loginDiv",  // The Widget will be embedded inside the application HTML
    buttonsStyle:'blue',  // Change the buttons design style to the 'blue' style
    // background color is set to gray:
    UIConfig: "<config><body><background background-color=\"#BFBFBF\"></background></body></config>" 
}

</script>
</head>
<body>
<div id="loginDiv"></div>
<script type="text/javascript">
   gigya.services.socialize.showConnectUI(conf,params);
</script>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="383" height="269" applicationComplete="init()">
	<mx:Canvas x="36" y="56" id="loginCanvas" width="325" height="200">
	</mx:Canvas>
	<mx:Script>
		<![CDATA[

			// Step 2 - Define a configuration object. Insert your Gigya APIKey below:
			private var conf:Object = { 
			    	APIKey: "Put Your APIKey here"				
			}	

			// This method is executed on applicationComplete				
			private function init():void {			
				// Initialize the "mcRoot" attribute of the conf object - should refer to the root of the flash container.
				this.conf.mcRoot=this.root;
				
				// Step 3 - Load socialize service
				// 3.1 Create the load-parameters object
				var loadParams:Object = {
				    services:'socialize',
				    callback:onGigyaInit
				}
				
				// 3.1 Load the services
				gigya.load(conf,loadParams);				
			}
			
			// 3.2 Wait for the load to complete and handle failures/success
			private function onGigyaInit(response:*):void {
			    if (response.hadError) {
			        // handle failure
					trace('An error has occurred while attempting to load Socialize service');
			    } else {
					showConnectUI();
				}
			}
			
			private function showConnectUI(): void {
				// Step 4 - Define parameters object:
				var params=
				{
		    	            enabledProviders: 'facebook,myspace',  // Limiting the Widget to show only facebook and myspace buttons
				    headerText: "My title",  // add a title
				    height: 73,                // define size
				    width: 147,                
				    container: loginCanvas,  // The Widget will be embedded inside the application HTML
                                    buttonsStyle:'blue',  // Change the buttons design style to the 'blue' style
                                    // background color is set to gray:
				    UIConfig: "<config><body><background background-color=\"#BFBFBF\"></background></body></config>" 
				}	   
			    // Step 5 - Calling the Socialize API method - connect:
			    gigya.services.socialize.showConnectUI(conf, params);
			}
			
		]]>
	</mx:Script>
	
</mx:Application>
 The output of this code:

Connect_change-default.jpg

 

 

Friend Selector

The Friends Selector Widget displays the current user's friends and lets him select one or more for application-related interaction. The Widget will present a list of confirmed friends from which the user can browse and select friends. The Friends Selector can easily be integrated with any action on your page, returning the user’s list of friends as the result.

Supported Use cases:

  • The Widget allows the user to select a list of friends. The list could be mixed, with friends from different Social Networks (Facebook, MySpace, etc.). The Widget indicates the network the friend originates from.
  • The Widget allows the user to filter different Social Networks, thus displaying individually the available friends from each network to which the user is connected.
  • The Widget includes a search option.

 

The Friend Selector Wizard - Lets you customize the Widget's visual design, view, and grab the customized code.

 

Default look of the Widget:

FriendSelectorUI.gif

 

 The following parameters are adjustable:

  • Limiting the number of friends the user may select.
  • Select which social networks are included in the widget (the widget will show only friends from the included social networks). The options are:  Facebook, Myspace, Twitter, Yahoo, LinkedIn. By default, all social networks are included.
  • Can be shown as either as a popup dialog (default) or embedded in the application.
  • Widget size.
  • Colors: Widget background, frame, text, link.
  • Caption text.
  • Caption: show or hide.
  • Selected items: background color and frame color
  • Mouse-over items: background color and frame color
  • Caption background color
  • The text is presented on the confirmation button (the default text is: "OK").
     

API Method:

The API method which displays the Friends Selector Widget is: socialize.showFriendSelectorUI

 

Usage Example:

The following example combines both the Connect and the Friend Selector Widgets:

<html>
<head>
<!-- Including the socialize.js script: -->
<script type="text/javascript" src="http://cdn.gigya.com/JS/socialize.js?apikey=INSERT-YOUR-APIKEY-HERE" ></script>

<script type="text/javascript">
    var conf =
{
    APIKey: "INSERT-YOUR-APIKEY-HERE"
}

</script>
</head>
<body>
<div id="loginDiv"></div>
<script type="text/javascript">
    var params =
    {
        "showTermsLink": true,
        "height": 73,
        "width": 147,
        "containerID": "loginDiv"
    }
    gigya.services.socialize.showConnectUI(conf, params);
    
</script>
<div id="Div1"></div>
<script type="text/javascript">
    var params2 =
    {
        "showTermsLink": true,
        "height": 500,
        "width": 400,
        "containerID": "Div1"
    }
    gigya.services.socialize.showFriendSelectorUI(conf, params2);
    
   </script>
</body>
</html>
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="500" height="750" applicationComplete="init()">
	<mx:Canvas x="36" y="56" id="loginCanvas" width="325" height="100"></mx:Canvas>
	<mx:Canvas x="36" y="180" id="friendsCanvas" width="400" height="500"></mx:Canvas>
	<mx:Script>
		<![CDATA[

			// Step 2 - Define a configuration object. Insert your Gigya APIKey below:
			private var conf:Object = { 
			        APIKey: "Put Your APIKey here"	
			}	

			// This method is executed on applicationComplete				
			private function init():void {			
				// Initialize the "mcRoot" attribute of the conf object - should refer to the root of the flash container.
				this.conf.mcRoot=this.root;
				
				// Step 3 - Load socialize service
				// 3.1 Create the load-parameters object
				var loadParams:Object = {
				    services:'socialize',
				    callback:onGigyaInit
				}
				
				// 3.1 Load the services
				gigya.load(conf,loadParams);				
			}
			
			// 3.2 Wait for the load to complete and handle failures/success
			private function onGigyaInit(response:*):void {
			    if (response.hadError) {
			        // handle failure
					trace('An error has occurred while attempting to load Socialize service');
			    } else {
					showConnectUI();
					showFriendSelectorUI()
				}
			}
			
			private function showConnectUI(): void {
				// Step 4 - Define parameters object:
				var connectParams:Object=
				{
					showTermsLink: true,
				    height: 73,                // define size
				    width: 147,                
				    container: loginCanvas  // The Widget will be embedded inside the application HTML
				}	   
			    // Step 5 - Calling the Socialize API method - connect:
			    gigya.services.socialize.showConnectUI(conf, connectParams);
			}

			private function showFriendSelectorUI(): void {
				// Step 4 - Define parameters object:
				var friendsParams:Object=
				{
					showTermsLink: true,
				    height: 500,                // define size
				    width: 400,                
				    container: friendsCanvas  // The Widget will be embedded inside the application HTML
				}	   
			    // Step 5 - Calling the Socialize API method - connect:
			    gigya.services.socialize.showFriendSelectorUI(conf, friendsParams);
			}
			
		]]>
	</mx:Script>
	
</mx:Application>

 

 

Share

The "Share" Widget gives the user an option to publish a newsfeed to various social networks.

Default look of the Widget:

ShareUI.gif

The Widget presents:

  • An editable text box providing the user with an option to edit his newsfeed message.
  • An abbreviated preview of the newsfeed to be published.
  • A list of social networks from which the user can select publishing destinations.
    The Widget displays, by default, the following social networks: Facebook, Myspace, Twitter, Yahoo, LinkedIn. You may customize this list using the enabledProviders and disabledProviders parameters of the showShareUI API method.
  • A "Share" button. When the user presses the button, Gigya will attempt publishing the newsfeed to each of the social networks which the user selected.
     

To learn more about the Share widget and how to publishing feed items, please read the Share Widget page of this guide.
 

API Method:

The API method which displays the "Share" Widget is: socialize.showShareUI.

Usage Example:

In "The "Share" Widget demo" you will find a complete working example which uses the "Share" Widget. You may view the code, run it and view the outcome.

 

 

Newsfeed

The Newsfeed Widget displays recent user activities in a feed stream. The stream can be filtered according to different groups:  "Everyone", "Friends", and "Me".

Default look of the Widget:

StreamUI.gif

The Widget presents: A tab per each group. The groups are: Everyone, Friends, Me.

The Widget is highly customizable. To learn more about the widget and how to integrate and customize it, please read the Newsfeed Widget designated guide.

 

API Method:

The API method which displays the Newsfeed Widget is: socialize.showNewsfeedUI.

Usage Example:

In The Newsfeed Widget Demo you will find a complete working example which uses the Newsfeed Widget. You may view the code, run it and view the outcome.

 

 

Edit Connections

The Edit Connections Widget enables users to connect to additional destinations and disconnect from their existing connections.
In addition, the Widget enables users to view their basic identity information for each destination to which they are connected.

Default look of the Widget:

EditConnectionsUI.gif

The following parameters are adjustable:

  • Widget size.
  • Select which social networks' buttons appear on the widget. The options are:  Facebook, Myspace, Twitter, Yahoo, LinkedIn.
    Note: if the user has logged in with an Open ID provider, then the component will also show the provider's icon, enabling the user to logout.
  • Can be shown as either as a popup dialog (default) or embedded in the application.
  • Colors: Widget background, frame, text, link, caption background, caption text, button text.
  • “Terms” link: show or hide.
  • And more.

API Method:

The API method which displays the Edit Connections Widget is: socialize.showEditConnectionsUI

The 'Edit Connections' Widget may also be opened by clicking the Edit link on the Connect Widget.

 

What's Next?Edit section

To complement the usage of the Socialize Widgets, we encourage you continue to the next page and learn how to register for Events which are generated by Gigya Socialize.

 

 

 < Back to 'Getting Started' | Next to 'Events' >

Tags:
Files (0)