Embed twitter timeline in page


On my website, a user enters their Twitter username when they register and their timeline is embedded on their profile page. Until now, I’ve achieved this with the following JavaScript code:

var twitterUsername = // read from database
    new TWTR.Widget({
        version: 2,
        type: 'profile',
        rpp: 4,
        interval: 30000,
        width: 'auto',
        height: 210,

        features: {
            scrollbar: true,
            loop: false,
            live: false,
            behavior: 'all'

Recently I noticed the following messages appearing in the JavaScript console

TWITTER WIDGET: This widget is being deprecated, and will cease functioning soon. <https://twitter.com/support/status/307211042121973760>
TWITTER WIDGET: You can obtain a new, upgraded widget from <https://twitter.com/settings/widgets/new/user?screen_name=electricpicnic>

It seems that instead of using this widget I should use an embedded timeline. However, the docs seem to suggest that in order to embed a timeline in a page, you need to go to the widgets section of your settings page and setup a widget for *each user* whose timeline you wish to embed. Twitter gives you the code that will embed this timeline in your page, but this code contains an attribute data-widget-id="275025608696795138" which has a different value for each user.

Obviously this approach won't work for me, because it's not feasible for me to setup a widget for all my users (present and future) and store a data-widget-id for each of them. Is there some non-deprecated way that I can embed timelines, which allows me to provide the Twitter username at runtime?


While you can’t dynamically set the screen_name/owner of the user timeline in Embedded Timelines today, we’ll be launching a new version soon that will allow this kind of dynamic assignation for user timelines.

I would wait for that feature rather than the alternative, which is to build your collection routines server-side and then additionally roll-your-own display requirement-meeting display logic.


“we’ll be launching a new version soon that will allow this kind of dynamic assignation for user timelines”

Is this going to be released before the final retirement deadline? Also, will it allow for more control of text and icon colors?


Thanks for the reply, would you mind posting here once this feature is available?


Hi Taylor,
Do you know when the new version you mentioned will be released?