The Social widget enables developers to add capabilities of Social to external applications. Since the widget is hosted on your Social server, it can display personalized information. An activity stream of the most recent user actions will display to the group's members.

There are two options of the Social widget that provide different levels of integration and information. 

* The [basic version|#SOCref.DeveloperReference.widget_tutorial.basic_version] of this widget is an iFrame.
* The more [advanced version|#SOCref.DeveloperReference.widget_tutorial.advanced_version] is a button you can insert in a page; this will display a small pop-up with information about the space.

{docbook}
<para xml:id="SOCref.DeveloperReference.widget_tutorial.basic_version">
<citetitle>
<emphasis role="bold">
Basic version
</emphasis>
</citetitle>
</para>
{docbook}

To insert the basic version, you need to have an iFrame to insert on your site.

{code:html}<iframe  scrolling="no" height="180" frameborder="no" width="220" src="http://URL_OF_YOUR_EXO_INSTALLATION.COM/rest/private/spaces/portal/space_info?
spaceName=NAME_OF_YOUR_SPACE&description=DESCRIPTION_OF_THE_SPACE"></iframe>{code}

To install this version in your application, replace all the uppercase text below:
* _{{{URL_OF_YOUR_EXO_INSTALLATION.COM}}}_: This is the URL of your Social installation. If you are testing on your local computer, the URL may be _{{{localhost:8080}}}_.
* _{{{NAME_OF_YOUR_SPACE}}}_: This is the title of your space in Social. In the URL, it is necessary to avoid special characters. For the space name, you can only use alphanumeric characters and {{{"_"}}}, ".", "-" or ".".
* _{{{DESCRIPTION_OF_THE_SPACE}}}_: This will be displayed in the list of spaces.


{docbook}
<para xml:id="SOCref.DeveloperReference.widget_tutorial.advanced_version">
<citetitle>
<emphasis role="bold">
Advanced version
</emphasis>
</citetitle>
</para>
{docbook}

To install an advanced version of the widget, you need to insert a code snippet in your page. This includes some HTMLs plus some JavaScript. The necessary CSS will be added dynamically.

Next, insert the following code at the position you want the button to be displayed:

{code:html}<div class="exoSpacesContainer"><a href="javascript:void(0);" id="exoSpacesLink" class="exoSpacesLink" target="_blank">Space</a></div>
<script src="/socialWidgetResources/javascript/space.js"></script>
<script>spaces.createPopup("exoSpacesLink", "MyAppName - my social object", "my cool description");</script>{code}

The important function here is:

{code:js}spaces.createPopup(link, spaceName, description)
{code}

In which:
* _link_ is the ID or the HTMLElement where the pop-up will be placed. If you copy and paste the code snippet provided above, you do not need to change this value.
* _spaceName_ is the name of space. It is also used to identify the space. You should use the following format: "MyAppName - my social object".
* _description_ is a brief introduction about your space.

{docbook}
<para xml:id="SOCref.DeveloperReference.widget_tutorial.configure">
<citetitle>
<emphasis role="bold">
Configurations
</emphasis>
</citetitle>
</para>
{docbook}

* serverURL (Default: _"http://127.0.0.1:8080"_): The address of your eXo installation. To change it, use _spaces.setServerURL(...)_.
* spaceServicePath (Default: _"/rest/private/spaces/"_): The path to the spaces service. It is rare you have to change it; but if needed, use _spaces.setSpaceServicePath(...).
* portalName (Default: _"socialdemo"_): The name of portal you are using. To change it, use _spaces.setPortalName(...)_.

If you want to change any part of this configuration, the best way is to change before creating the pop-up. For example:

{code:html}<div class="exoSpacesContainer"><a href="#" id="exoSpacesLink" class="exoSpacesLink" target="_blank">Space</a></div>
<script src="/socialWidgetResources/javascript/space.js"></script>
<script>
  spaces.setServerURL("http://192.168.2.100:8080");
  spaces.createPopup("exoSpacesLink", "My cool new space", "my cool description");
</script>{code}

You can see an example of integration at: [http://localhost:8080/socialWidgetResources/test.html]
