This chapter provides the basic knowledge needed to start developing using Gigya's JavaScript Web SDK. We highly recommend reading this document before starting to code.
What's in this Guide?
- Basic Concepts - The guide starts out with some fundamental concepts that are required for developing applications with Gigya's JavaScript Web SDK.
- Basic Tutorial - Continue with a basic example of a web page that uses the Gigya service - a basic Facebook app, and a guide for using Gigya Web SDK methods.
- Events - Learn how to handle Events generated by Gigya socialize.
- Advanced Customizations - Advanced customization options that you may apply on your client application.
- Supported Browsers - Information about Gigya's browser support.
Watch an Instructional Video
If you have a Gigya Academy membership, you can watch instructional videos about this and other Gigya products. To access Gigya Academy content, you should first make sure you are logged into the Gigya Console.
Gigya Academy is a premium product that requires separate activation. If it is not part of your site package, please contact your 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.
To watch a video about our Web SDK, Gigya Academy members can use this link.
Basic Concepts
An Asynchronous Programming Model
Gigya uses an asynchronous programming model in which operations are triggered and then run in the background until they are completed. Upon successful or unsuccessful completion, the operation invokes a callback function, which is provided by the developer, and returns a response object that includes the results of the operation. The callback function should handle the response in an appropriate manner, as determined by the application.
The SDK Namespaces
The entire range of Gigya functionality is provided as methods of one of the following namespaces: gigya.socialize, gigya.accounts, gigya.comments, gigya.gm and gigya.ds, thus all methods are referenced with the gigya. prefix.
Making Calls
Loading The Gigya Web SDK
The first thing you need to do is ensure that you have our Web SDK loaded on every page of your site that you will be using Gigya services. This is accomplished by sourcing the SDK from our CDN in the <head> of all your pages. To do this, simply add the following code to your sites header template.
<script type="text/javascript" lang="javascript" src="<Site_Protocol_and_CDN_Prefix>.<Data_Center>/js/gigya.js?apikey=<A_Valid_API_Key_For_Your_Site>"> </script>
Where, depending upon your site's protocol, <Site_Protocol_and_CDN_Prefix> is:
- https://cdns - Site uses SSL
- http://cdn - Site does not use SSL
us1.gigya.com
- For the US data center.eu1
- For the European data center..gigya.com
au1
- For the Australian data center..gigya.com
ru1
- For the Russian data center..gigya.com
cn1
- For the Chinese data center..gigya-api.cn
If you are not sure of your site's data center, see Finding Your Data Center.
Calling The Method
All the methods in the Gigya Web SDK have a common signature:
gigya.<namespace>.<method_name>(params); // e.g., gigya.socialize.showShareBarUI(params)
The "params" object is actually an object that may contain multiple members. We choose to use this object instead of passing parameters in the "classical" way - this provides flexibility in adding new parameters without "breaking" older code.