AddThis Academy

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

Controlling the 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.

Tweet Content Parameters

The full list of tweet content parameters, supported by Twitter.

Parameter Description Example
text Pre-populated text highlighted in the Tweet composer. custom share text
hashtags A comma-separated list of hashtags to be appended to default Tweet text. example,demo
via Attribute the source of a Tweet to a Twitter username. myTwitterAccount
related A comma-separated list of accounts related to the content of the shared URI. anotherAccount,someOtherAccount
Controlling the Text, and “via @” user on Twitter
5 (100%) 2 votes

Was this article helpful to you?