Default Code

Last Updated: Feb 29, 2012 01:59PM EST

Default Menu Code

This will create the default menu that can be used on any website. You can start with this code, or generate your own by selecting Get AddThis.

<!-- ADDTHIS BUTTON BEGIN -->
<script type="text/javascript">
var addthis_config = {
     pubid: "YOUR-PROFILE-ID"
}
</script>

<a href="http://www.addthis.com/bookmark.php?v=250" 
	class="addthis_button"><img 
	src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" 
	width="125" height="16" border="0" alt="Share" /></a>

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>
<!-- ADDTHIS BUTTON END -->
Share

The Code is split into three sections: Inline Javascript, HTML, and External Javascript.




HTML

This is where the button is defined. You can make changes here to customize the button image and behavior.

<a href="http://www.addthis.com/bookmark.php?v=20" 
	class="addthis_button"><img 
	src="http://s7.addthis.com/static/btn/v2/lg-share-en.gif" 
	width="125" height="16" border="0" alt="Share" /></a>



Inline Javascript

Settings for your share menu are set here. This code must be on the page before the external Javascript. Settings here will apply to all share buttons on the page.

pubID (recommended)
Your AddThis Publisher Profile ID. This required if you want us to track analytics for your site.
<script type="text/javascript">
	var addthis_config = {
              pubid: "YOUR PROFILE ID"
        }
</script>



External Javascript

This is the code that creates the AddThis menu. You should only include this code once on your page - even if you have more than one share button. This code can be included anywhere in your page's code. It does not have to be in the header.

<script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js"></script>

Still need help?


General Topics

 

Developers