Embedded User Timeline
A user timeline displays the latest Tweets ordered from newest to oldest from a specific public Twitter account. The timeline includes a Follow button in the header to encourage new followers and a mention web intent footer to encourage new conversations specific to your Twitter account.
Create a new embedded user timeline from your logged-in account’s widget settings.
Override timeline selection
A Twitter username is associated with each saved widget ID. Add a data-screen-name
or data-user-id
attribute to override the user timeline selection with a Twitter username or numeric identifier respectively. The href
attribute and inner text of the fallback anchor element should be updated to accurately reference the Twitter account relevant to the page.
A template example using data-screen-name
:
<a class="twitter-timeline" data-widget-id="{widget_id}" href="https://twitter.com/{screen_name}" data-screen-name="{screen_name}"> Tweets by @{screen_name} </a>
<a class="twitter-timeline" data-widget-id="600720083413962752" href="https://twitter.com/fabric" data-screen-name="fabric"> Tweets by @fabric </a>
A template example using data-user-id
linked to a user web intent:
<a class="twitter-timeline" data-widget-id="{widget_id}" href="https://twitter.com/intent/user?user_id={user_id}" data-user-id="{user_id}"> Tweets by Twitter user {user_id} </a>
<a class="twitter-timeline" data-widget-id="600720083413962752" href="https://twitter.com/intent/user?user_id=2857397298" data-user-id="2857397298"> Tweets by Twitter user 2857397298 </a>
Override show replies
A widget ID includes a stored preference to exclude or include @replies. Add a data-show-replies
attribute with a value of either true
or false
to configure your replies preference inside your widget embed code.
<a class="twitter-timeline" data-widget-id="600720083413962752" href="https://twitter.com/fabric/with_replies" data-screen-name="fabric"> Tweets by @fabric </a>
JavaScript factory function
Twitter’s widget JavaScript library supports dynamic insertion of an embedded user timeline using the twttr.widgets.createTimeline
function. Pass a widget ID, target container element, and optional options object to insert an embedded timeline into your page.
HTML data-* parameters are camelCased when passed as an options object property.
twttr.widgets.createTimeline( "600720083413962752", document.getElementById("container"), { screenName: "fabric" } );