AddToAny Menu API

JavaScript menu API

The AddToAny menu API consists of properties contained under the a2a_config object. See Example Code.

Property name Default value Description
linkname document.title Title of the item to be shared or saved. Will use the current page title (to accomodate AJAX sites) unless a value is explicitly set.
linkurl location.href URL of the item to be shared or saved. Will use the current URL (including the current hash to accomodate AJAX sites) unless a value is explicitly set.
onclick false If true, have the menu appear when the user clicks the button instead of when the user hovers over the button.
delay 0 Hover/mouseover delay (in milliseconds) until showing the drop-down menu. A value between 50 and 500 is recommended if set.
show_title false If true, show the title of the item to be shared/save within the menu (from linkname).
num_services 10 Number of services to be displayed by default within the menu.
prioritize User's services Specify the services you want to prioritize, ordered from highest priority to lowest priority.
This is an array, so you can add as many services as you desire.
See how to force services to appear first in the menu. Note that the smart menu's personalization will give a user's services highest priority.
custom_services N/A Add custom service(s) to the menu. This is an array, so you can add as many services as you desire. The icon URL is optional. See how to add custom services.
hide_embeds false (since June 2010) Hide intersecting objects (like Flash) when the menu is displayed.
orientation Automatic Specify the vertical orientation of the menu. Accepts down or up.
menu_type N/A If "mail", the e-mail menu is displayed. Accepts "mail" only.
templates N/A Customize the message sent to certain services, like Twitter. See how to change the Twitter message.
track_links false Shorten the URL or attach parameters to your shared link to get analytics on clickthrus.
This will only modify shared links for services where shared link tracking is appropriate (i.e. Twitter, not Delicious). See how to enable tracking of shared links.
track_links_key N/A Used with the track_links property only, this accepts your URL shortener API key or a custom URL to use for shared links. See how to enable tracking of shared links.
tracking_callback N/A Allows you to listen for events using a custom function. Value (object) may take the form {ready: function, share: function}, where both the ready and share properties are dispatchable AddToAny events, and function is a reference to your custom function(s). A custom function for the share event should have a single argument, which will return an object with 3 properties: service, title and url.
target Last uninitiated element with a class-name of a2a_dd Target specific DOM node(s) to initiate an AddToAny menu on. Accepts a string containing a CSS selector for an ID (like "#share-button") or class-name (like ".share-buttons"), or an actual DOM node reference (like document.getElementById('share-button')). If target is set, the targeted element(s) should not have an initial class-name of a2a_dd, otherwise AddToAny will initialize the target(s) prematurely.
localize Auto-localization Customize the language of the menu. See how to translate AddToAny yourself or how to submit default translations for AddToAny.
locale en-US Force the language of the menu and turn off auto-localization. Accepts a language code such as "fr" or "fr-CA" (ISO 639-1), or "custom" if you're providing your own AddToAny translation.
border_size 8 Change the pixel size of the menu's transparent border. Must be at least 1.
no_3p false No 3rd party cookies. Setting to true may affect stats and limit some functionality.

Many of these options are available in the button generator by clicking on More Options.

For color customization, see the button generator and click More Options > Menu Colors.

Feel free to customize the CSS in your stylesheet. We do our best to keep class and id names consistent with every release.