Orkut Application Platform

Website Integration: Orkut Share Button/API

The orkut Share API allows website owners to enable their visitors to share the website content with visitor's orkut friends. Users can optionally promote the content among their friends.

The API aims to provide users with a uniform experience while managing their credentials in a secure manner to ensure that their privacy is not compromised. It allows website owners to enable sharing of content on their webpages using Javascript and HTTP GET Interfaces, as described below. All API calls trigger a similar experience for the user, but allow the site to customize the way the sharing is enabled.

Contents

  1. Using the API
    1. User Prompt
    2. Rendering within orkut
  2. Javascript Button API
  3. Javascript API
  4. HTTP GET API
  5. GET Endpoint
  6. FAQs

Using the API

Web publishers can post the share buttons in one or more locations on the page using a simple Javascript library. As an example, the following code snippet

<html>
  <head>
    <title>Google Internet Bus</title>
  </head>
  <body>
    <h1>Google Internet Bus</h1>
    <div id="orkut-button"></div>
    <script type="text/javascript" src="http://www.google.com/jsapi"></script>
    <script type="text/javascript">
      google.load('orkut.share', '1');
      google.setOnLoadCallback(function() {
        new google.orkut.share.Button({
          lang: 'en',
          style: google.orkut.share.Button.STYLE_REGULAR,
          title: 'Google Internet Bus',
          summary: ('The Internet Bus Project is an attempt ' +
                    'to educate people about the Internet'),
          thumbnail: ('http://lh5.ggpht.com/_AS18ZY6z1m8/SYWgcvA5beI' +
                      '/AAAAAAAAANw/DfoApipJxcY/s128/DSC_0013%20.jpg'),
          destination: 'http://www.google.co.in/en/internetbus/'
        }).draw('orkut-button');
      });
    </script>
  </body>
</html>

renders the share button on the webpage as

share on orkut

 

User Prompt

When users click this button they are prompted to login to orkut if they are not already logged in. They are then shown a preview of the content that will be posted to orkut with an option to also promote what they are sharing. Once the user confirms, the content will be shared with their orkut friends.

Rendering within orkut

The shared content appears in the 'Updates from my friends' section on orkut. If the user had checked 'Promote to your friends,' it also appears in the upper right hand corner of the orkut friends' home and profile pages, alternating with formal advertisements.

Updates

Promotions

Javascript Button API

Regular Mini
share on orkut share on orkut

Webpages can add the buttons shown above anywhere using a JavaScript library, clicking which brings up the share dialog with the item selected for sharing. This API describes the details of the content that can be configured.

Script location

<script src="http://www.google.com/jsapi"></script>

Static class — google.orkut.share.Button

Fields

Static field Description
STYLE_MINI String STYLE_MINI — constant to select the mini button style.
STYLE_REGULAR String STYLE_REGULAR — constant to select the regular button style.

Constructor — google.orkut.share.Button

Constructor Description
google.orkut.share.Button(options) Map<String, String> options — object containing optional customizations. The supported options are:
  • lang — language to use for button UI, if absent it is is automatically selected.
  • style — one of:
    google.orkut.share.Button.STYLE_REGULAR (default) google.orkut.share.Button.STYLE_MINI.
  • summary — summary of content being shared.
  • thumbnail — url of image to be associated with the shared content.
  • title — title of content be shared, by default it is the page title.
  • destination — url for link in shared content, by default the page url.

Methods

Constructor Description
draw(element) Renders the sharing button into the specified (div) element.
  • String|Element div_element — div element, or id of div element into which the button should be drawn.
  • Supported languages

    Code Language
    en English (default if detection fails)
    es Spanish
    fr French
    pt_BR Portuguese (Brazil)
    de German

    Example

    <html>
      <head>
        <title>An interesting Page</title>
      </head>
      <body>
        <h1>Hello World</h1>
        <div id="orkut-button"></div>
        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <script type="text/javascript">
          google.load('orkut.share', '1');
          google.setOnLoadCallback(function() {
            new google.orkut.share.Button({
              summary: 'So much to see here.'
            }).draw('orkut-button');
          });
        </script>
      </body>
    </html>
    

    Javascript API

    An alternate Javascript API that allows a more direct interaction with the server from the browser and supports more flexible integration with the page with a greater control over the details of the shared item contents. This allows developers to hook the sharing trigger to custom UI elements and user actions.

    Script location

    <script src="http://www.google.com/jsapi"></script>
    

    Class — google.orkut.share.Field

    Instances of this class are used as keys in the sharing configuration dictionary. There is no need to instantiate an object of this class. Available configuration fields are present as static members of this class, and possibly other classes.

    Fields — google.orkut.share.Field

    Static field Description
    NETWORK Always 'orkut.com' (reserved for future use).
    CONTENT Body of the shared item, a summary of the activity being shared.
    TITLE Title of the shared item.
    THUMBNAIL Thumbnail image to be included in shared item.
    USER_COMMENT Comment by the user on the shared item.
    DESTINATION_URL Destination url for the link in the shared item.

    Class — google.orkut.share.Connection

    Constructor — google.orkut.share.Connection

    Constructor Description
    google.orkut.share.Connection(config, opt_document)
    • Map<google.orkut.share.Field, String> config — base configuration for sharing parameters.
    • Document opt_document — optional DOM Document object that is to be shared.

    Methods

    Method Description
    send(dest, overrides)
    • String dest — currently must be orkut.com, reserved for future use.
    • Map<google.orkut.share.Field, String> overrides — custom settings for this specific instance.

    Notes

    The config and overrides parameters passed to the constructor and send method of google.orkut.share.Connection are dictionaries containing settings for the shared item. Setting passed to send override settings passed to the constructor. The keys of this dictionary are instances of the google.orkut.share.Field and the values are raw strings with constraints as specified in the documentation for the corresponding google.orkut.share.Field instance.

    Example

    <html>
      <head>
        <title>An interesting Page</title>
        <script type="text/javascript" src="http://www.google.com/jsapi"></script>
        <script type="text/javascript">
          google.load('orkut.share', '1');
          google.setOnLoadCallback(function() {
            var params = {};
            params[google.orkut.share.Field.TITLE] = 'Interesting Page!';
            params[google.orkut.share.Field.DESTINATION_URL] = 'http://example.com/interesting.html';
            var connection = new google.orkut.share.Connection(params);
            document.getElementById('orkut-share').onclick =
              function(e) { connection.send('orkut.com', {}); };
          }, true);
        </script>
      </head>
      <body>
        <h1>Hello World</h1>
        <span id="orkut-share" style="cursor:pointer; border:1px solid black">
          Share on Orkut
        </span>
      </body>
    </html>
    

    HTTP GET API

    The web developer can submit a GET request using a form and the sharing service will use the target window to complete the sharing flow. At the end of the flow the it will close the target window. An additional consideration is that the authentication for sharing is based on OAuth. So it is required that the target window display the location bar.

    HTTP GET request in the example would look as follows:

    http://promote.orkut.com/preview?nt=orkut.com&tt=Something%20Interesting&du=http://example.com&cn=An%20interesting%20page%20to%20visit

    GET Endpoint

    <script src="http://promote.orkut.com/preview"></script>
    

    Parameters

    nt Must be set to "orkut.com". Reserved for future use. Required
    du URL of content being shared. Required
    tt Title of the shared item, should be plain text. Required
    cn Content to be shared. Optional
    uc User comment on shared item. Optional
    tn A thumbnail image to be included in the shared item. Optional

    Note: All parameter values must be URL encoded. In the future the set of required fields may change.

    Example

    <html>
      <head>
        <title>An interesting Page</title>
      </head>
      <body>
        <h1>Hello World</h1>
        <form method="GET" target="_blank" action="http://promote.orkut.com/preview">
          <input type="hidden" name="nt" value="orkut.com"/>
          <input type="hidden" name="tt" value="Something interesting"/>
          <input type="hidden" name="du" value="http://example.com/"/>
          <input type="hidden" name="cn" value="An interesting page to visit."/>
          <input type="submit" name="share" value="Share"/>
        </form>
      </body>
    </html>
    

    FAQs

    How much does it cost to use?

    This feature is 100% free to both publishers and orkut users.

    Can users edit or delete the content, once they have shared it?

    Yes. This content will appear in the 'My updates' section, which users can delete anytime. If the content is promoted, they can pause or delete it from the 'My promotions' section.

    Are users and friends guaranteed to see the shared content from my site?

    Users can share content with their friends. However, some of those friends may not see the shared content because there are limits on the activities that show up by default and the number of promotions that can be sent.

    How do I get statistics of how many users shared out of my site?

    At this time there are no analytics and reports offered to website publishers for this feature. You can look at URL params from your own weblogs to see the level of shared activity.

    Authentication required

    You need to be signed in with Google+ to do that.

    Signing you in...

    Google Developers needs your permission to do that.