AddToAny Menu API

JavaScript Menu API

The AddToAny JavaScript menu API consists of properties contained under the a2a_config object. See the example code for usage details.

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 mini 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.
exclude_services false Accepts an array to remove specific services from the universal menus. See how to remove services from AddToAny.
show_title false If true, show the title of the item to be shared/save within the mini menu (from linkname).
num_services 10 Number of services to be displayed by default within the drop-down universal menu.
prioritize User's preferred 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 preferred 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.
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.
show_menu N/A Allows you to display the mini menu using static, absolute, fixed, or relative positioning, without needing a button. See the static share menu example for details.
templates N/A Customize the message sent to certain services, such as Twitter and email. See how to change the Twitter message and how to create a template for email services..
callbacks N/A Listen for and act on AddToAny events using custom functions. The value is an array of one or more objects that contain ready and/or share properties whose values are a function reference to your custom function(s). A custom function for the share event should have a single argument, which will return an object with 4 properties: node, service, title and url. See how to track and handle events.
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.
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.
hide_embeds false (since June 2010) Hide intersecting objects (like Flash) when the menu is displayed.
no_3p false Disable 3rd party cookies. Setting to true may affect stats and limit some functionality.

See AddToAny examples & documentation for example code and live demonstrations.

CSS Menu Overrides

AddToAny always keeps developers & designers in mind. We have a few tips for customizing the universal menus while maintaining box-sizing calculations:

  • You can override padding, fonts, and menu icon sizes.
  • For menu icons, override background-size, font-size, height, line-height, and width.
  • Avoid dimensional overrides (height & width) for most other elements.
  • Apply box-shadow instead of changing the border-size of elements.
  • We try to keep class and id names consistent with every release.