Using the Related Twitter Accounts Tag in the Tweet Button

If you have a site like ours, you might want to give people the opportunity to share your content socially.  One of the ways you can do that is using the Tweet Button for Twitter.  It’s actually super easy to implement.

One of the things you might also do is to specify “related Twitter accounts” that a user might be interested in.  You would normally include your account in the “via” tag but you can give Twitter the chance to suggest additional users for a person to follow whenever they share some of your account.  In my case, I may want to give people a chance to follow the account for Imaginet, the company I work for, @justimaginet.  You do this by specifying the “data-related” tag in your hyperlink.  You can specify as many accounts as you want but they are really just suggestions to Twitter.  Take a look at the documentation mentioned below about if you want to specify multiple accounts.

Here’s an example of what I used to update the itemTemplate.blogtemplate file for my dasBlog site.

<div class="twitter-badge">
    <a href="" class="twitter-share-button" 
        data-text="<%ItemTitleText()|edsquared%>" data-count="horizontal" 
        data-related="justimaginet:Imaginet - Microsoft ALM Partner of the Year">Tweet</a>

Give it a try out by visiting our blog site and using one of the Tweet buttons to share the content to your followers:

If you are wanting to research this a little more, here’s the official documentation from Twitter:

Related accounts

Using the related field you can suggest accounts for a user to follow once they have sent a Tweet using your Tweet Button. These suggested accounts and their basic information are shown on the last page of the Share Box flow.

Only two accounts are displayed and by default the via user is shown first with the first related account shown afterwards. If the user is a follower of the via user the Share Box will instead show the first two related accounts the user isn't a follower of. No accounts are displayed if the user follows all of the suggested accounts (via and related).

You can add your own summary of a related user by adding some text after their screen name, separated using a colon. For example, to add a summary The Javascript API to the related user @anywhere you would use:

data-related="anywhere:The Javascript API"

The summary is shown above the related user and is in addition to the default information like the bio and verified status. Summaries should not include commas or colons and can only be added to related accounts.

Tweet Button - Twitter Share Dialog

You can provide multiple related accounts by comma separating entries in the data-related value:

data-related="anywhere:The Javascript API,sitestreams,twitter:The official account"

You learn something every day…

Ed Blankenship

Posted in

Tuesday, 02 April 2013 03:58:05 (Pacific Standard Time, UTC-08:00)
I am attempting to use the "data-related" method to recommend and account, however it never fulfills. The tweet sends, but never recommends the account to follow. I am not already following the account, so I'm not sure what the problem is. I am 100 percent sure the account name is typed correctly. Any guidance would be much appreciated.
Ross M.
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, b, blockquote@cite, em, i, strike, strong, sub, sup, u) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

[Captcha]Enter the code shown (prevents robots):

Live Comment Preview