The publish.twitter.com website provides a simple, form-based approach to generate HTML markup for a follow button you may copy-and-paste into your website template.
User interaction flow¶
Selecting the Follow button will pop open a new child window displaying a follow action alongside a profile summary and a few recent Tweets from the account.
The viewer may click on the follow action displayed alongside the profile summary to follow Tweets from the specified account.
follow event is triggered on your webpage after a Twitter user follows the specified result in the child window.
Logged out flow¶
A viewer not logged in to Twitter will be prompted to log in to follow the account. A follow action will be triggered as part of the login flow of the follow intent.
How to add a Follow button to your website¶
1. Create a new anchor element with a
href attribute value of a Twitter profile URL.
<a class="twitter-follow-button" href="https://twitter.com/TwitterDev"> Follow @TwitterDev</a>
2. Customize Follow button parameters using data-* attributes.
<a class="twitter-follow-button" href="https://twitter.com/TwitterDev" data-size="large"> Follow @TwitterDev</a>
Hide followers count¶
Hide the number of Twitter accounts following the specified account by setting a
data-show-count attribute value of
Show count false
Hide Twitter username¶
Hide the username from the displayed Follow button by setting a
data-show-screen-name attribute value of
Show screen name false