AddThis Academy

An ever-growing library of resources to help you become a better online marketer.

Controlling the URL, text, and “via @” user on Twitter

Bitly Integration

We’ve removed default Bitly shortening from our Twitter button to improve performance. If you want to re-enable Bitly integration you’ll need to register with AddThis and enter your Bitly login and API key and make sure your profile ID is properly configured on your site.

Twitter Templates

Twitter made a change in their API that broke our implementation of custom templates. As such, you should remove all references to the Twitter template from your code. If you want to continue to control the text and attribution (“via @username”) you should use the passthrough parameter. For instance, to control the attribution do this:

<script type="text/javascript">
var addthis_share = addthis_share || {}
addthis_share = {
	passthrough : {
		twitter: {
			via: "TWITTER USERNAME"
		}
	}
}
</script>

Replace TWITTER USERNAME with the username you’d like to attribute the post to. (That is, what you’d like to be after “via @”)

To control the text that is posted to Twitter, do this:

<script type="text/javascript">
var addthis_share = addthis_share || {}
addthis_share = {
	passthrough : {
		twitter: {
			text: "TEXT"
		}
	}
}
</script>

Replace TEXT with the text you’d like to post with the URL.

You can combine these like this:

<script type="text/javascript">
var addthis_share = addthis_share || {}
addthis_share = {
	passthrough : {
		twitter: {
			via: "TWITTER USERNAME",
			text: "TEXT"
		}
	}
}
</script>

Be sure to replace the values mentioned above. Also, be sure to include the comma between the values.

Controlling the URL, text, and “via @” user on Twitter
5 (100%) 1 vote

Was this article helpful to you?