Develop private gadgets for Google Sites

Gadgets are lightweight applications written in HTML and JavaScript. In Google Sites, gadgets let you embed rich media, retrieve feeds, and perform simple tasks like managing a to-do list.

Most gadgets that you use are hosted on the public internet and their source code could be read by anyone. However, Google Apps Premier customers can create private gadgets that are only visible to members of their Google Apps domain. You can find these gadgets in a directory with your company's domain name within the gadgets directory.

With support for the Google Secure Data Connector (SDC) in Google Sites, your private gadgets can connect to data stored behind your corporate firewall. So, your users can access your existing enterprise systems right in the browser even when they're not connected to your corporate network. For example, you could use private gadgets and SDC to create a site with gadgets that show data from your CRM and order management systems to let sales people track revenues, leads, and other sales data. Instead of having to log into multiple systems, sales people would get easy access to this information from anywhere through their Google Apps account - giving them more time to close deals.

Getting Started

To learn how to write a gadget, check out the gadgets developer guide.

In Sites, there are two places where you'll work when developing a private gadget. The first is your domain's PrivateGadgetSpec feed. This is where you save the gadget code and it's where you can test the gadget as you're developing. The second is the PrivateGadget feed which is used to control which gadgets appear in the directory itself. When you publish a gadget, you'll be copying it from the PrivateGadgetSpec feed into the PrivateGadget feed. By default only Google Apps administrators can save and publish gadgets.

We've built a tool called the Feed Server Client Tool (FSCT) to help manage your private gadgets. FSCT includes Windows and Unix scripts to make managing gadget easier. For example, on a Unix system you would save a gadget to your PrivateGadgetSpec feed with this command: $ ./insertGadgetSpec.sh PrivateGadgetSpec gadgetName gadgetSpecFile

You can publish a saved gadget to your directory with this command: $ ./publishGadget.sh PrivateGadget PrivateGadgetSpec/gadgetName

For more documentation on configuring private gadgets see the FSCT wiki.

Management gadgets

We've also made a couple beta gadgets to make this management process easier: the Private Gadget Editor and the Directory Manager gadgets.

To insert a gadget into a Sites page, go to the Insert menu, and select Gadgets, then More. Then, add each gadget with its URL. You can find the Private Gadget Editor here and the Director Manager here.

The Private Gadget Editor lets you write and save gadgets to your PrivateGadgetSpec feed. The Directory Manager lets you publish those saved gadgets to the domain's directory and manage the private categories used in the directory. If the category in the gadget spec matches the name of the private category you create, then the published gadget will automatically show up in that category. You need to create at least one category, to be able to see the private section of your directory.

One last tip for gadget developers. As you're writing your gadget, you'll probably want to test how it's working. In the PGE you can copy the URL labeled Gadget URL and use that URL to insert the gadget into your Sites page. Normally Sites will cache a gadget spec for about an hour, but if you add "?nocache=1" to the end of the URL of your Sites page, every time you refresh the page you'll see the latest saved version of your gadget.