My favorites | English | Sign in

Try Google Chrome's developer tools New!

Google Friend Connect APIs (Labs)

Getting Started

Overview

Millions of sites are using Google Friend Connect (GFC) to provide their visitors social features. GFC is on so many sites because it can be added by site owners who have no programming experience, by copying and pasting snippets of code from http://www.google.com/friendconnect.

However, since Google Friend Connect also provides a rich set of APIs, programmers can create deep integrations with their existing sites. If you have JavaScript or server-side programming skills, read on to learn more about the different ways you can take advantage of Google friend connect.

Audience

Desired Feature Programming Skills Required Recommended Google Friend Connect Usage
Site Owners Socializing a web page by inserting pre-made social apps. Ability to edit HTML, copy and paste basic JavaScript. Basic non-programming usage of Google Friend Connect
Integration of Google Friend Connect social data directly into your web page with JavaScript alone. Some JavaScript and AJAX programming skills. Google Friend Connect JavaScript API
Direct server-side integration with Google Friend Connect. Knowledge of the OpenSocial RESTful and RPC protocols and at least one of the languages supported by the OpenSocial client libraries. Server-side integration with GFC's REST/RPC Protocols
Integrate Google Friend Connect with blogs, content management systems and/or forums. No programming necessary, simply install and use the plugin in the supported environment. Using GFC plugins on popular blog, CMS and forums
Gadget Developers Build gadgets that can run on Google Friend Connect sites. Technical knowledge of how to build gadgets. Knowledge of OpenSocial APIs is also required for social gadgets. Building Gadgets for GFC

Basic non-programming usage

A basic usage of Google Friend Connect (GFC) allows site owners to add snippets of code to their sites without any programming and instantly provide it with social capabilities so that visitors can:

  • Sign-in with OpenID and pre-existing Google, Yahoo!, and any other OpenID accounts
  • Integrate an existing profile from social networks and services
  • Create a new profile for visitors who have no previous social network
  • Discover existing friends from other linked social networks and make friends across networks
  • Create posts, reviews, and comments on the site
  • Interact with, fully scalable and tested, social gadgets created by Google and the broader OpenSocial development community

To get started with a basic, non-programming usage of Google Friend Connect, visit the site: http://www.google.com/friendconnect.

Google Friend Connect JavaScript API

In contrast to a basic usage of Google Friend Connect where access to OpenSocial is through the hosting of gadgets, the Google Friend Connect JavaScript API allows you to directly link any content from a Google Friend Connect site to your page using JavaScript. The JS API has the following attributes:

  • Differs from gadgets or iframe usage of OpenSocial, and instead offers direct JavaScript API access to OpenSocial data from a GFC site.
  • GFC social data including person, activities persistent data can be directly accessed via JavaScript on a page and rendered in any manner.
  • Integrate GFC functions and data (such as signin) and present member data (such as profiles, friends) and generate "activities" directly within the markup of your web pages.
  • For further information on how to use the JavaScript API (JS API) for Google Friend Connect, click here.

    Server-side integration with REST/RPC protocols

    Because Google Friend Connect supports the OpenSocial REST/RPC protocols, it is possible to access OpenSocial from a GFC site entirely outside of a gadget or a web page. This opens up GFC OpenSocial data to any web technology that can access the GFC site directly via OpenSocial's REST/RPC protocol. Accessing a GFC site through REST/RPC has the following properties:

  • No gadgets, iframes or JavaScript required
  • Direct access to OpenSocial data from a GFC site through REST/RPC
  • Ability to leverage any of the OpenSocial client libraries written in PHP, Ruby, Java and Python
  • Authentication and secure server-to-server communication is handled through OAuth
  • Enables integration with existing server-side code, such as a login/identity system
  • To get started with server-side programming integration of Google Friend Connect, click here.

    Using the blog, CMS, and forum plugins

    The Google Friend Connect plugins allow you to integrate users with external accounts into your site. A user can visit your site and leave a comment with an account from a Google, Yahoo! or any site that implements OpenSocial REST/RPC protocols such as Plaxo, hi5, and MySpace.

    Some of the initial plugins include:

    • Wordpress
    • Drupal
    • PhpBB

    These plugins are part of an open source project -- your contributions are welcome!

    For more information on the GFC plugins and its open source development project, click here.

    Building gadgets for Google Friend Connect

    Since millions of sites are GFC-enabled, a gadget developer has the ability to host their gadget on any of these sites. This presents a vast new opportunity for gadget developers as well as OpenSocial application developers to publish their gadget applications.

    GFC for gadgets supports essentially the same programming paradigm as traditional gadgets or OpenSocial applications with little or no modification

    There are typically three ways to build gadgets for a GFC site:

    • Modify an existing gadget so that it runs gracefully in a GFC site
    • Design an entirely new gadget for a GFC site
    • Host your own GFC site to host your own gadget(s)

    For more information on building gadgets for GFC, click here.

    Google Friend Connect and other OpenSocial networks

    And finally, here are some useful tips about how Google Friend Connect works together with other OpenSocial networks.

    • Every site that includes Google Friend Connect in any fashion instantly becomes an OpenSocial container.
    • When visitors "Join" the site they become members and can either create a profile or use a profile from other social networks.
    • The visitors can optionally link in existing social networks that are integrated with Google Friend Connect.
    • This forms a site-specific social network consisting of the site's members, their friends and friends-of-friends that conforms to the OpenSocial API.
    • As a developer you use the OpenSocial API to integrate this social data without needing to know its multiple sources and endpoints.
    • GFC provides JavaScript and REST/RPC protocols of the standard OpenSocial API in the context of a given site.
    • GFC adds a very few additional JavaScript APIs so that a site can launch GFC's Sign-in, Settings, and Invite windows.

    For more technical information on OpenSocial, click here.