Next steps with the t.co link wrapper

Friday, 5 August 2011

Since June of last year, Twitter has been preparing to wrap links submitted in all Tweets and Direct Messages. Link wrapping helps us understand how users engage with the tens of millions of links shared daily on Twitter while also giving us a means to protect users from malicious sites and scams. After wrapping links from the Tweet Button and twitter.com for the past few months, we’re now ready to wrap links with t.co throughout the service.

Beginning August 15th, when a user tweets or sends a direct message containing a URL 20 characters long or greater (the length of URLs wrapped with t.co), the URL will automatically be converted to a t.co-wrapped link. We will eventually wrap all links, regardless of length, but until then there’s nothing you need to do to support this change. When we’re ready to wrap all links, we’ll give you plenty of time and make another announcement.

To help prepare you for this eventuality, we’re also introducing two opt-in developer features today that will help you get a head start with t.co. Both of these methods, when employed, will automatically wrap any URLs with t.co. These are great options to use while designing a new Tweetbox or testing development versions of your application against the new behavior.

  • Per-tweet basis: Pass the new wrap_links=true parameter to the POST statuses/update and POST direct_messages/new API endpoints.
  • Application basis: Visit your application settings and configure this option globally for your application. If you choose this option, all links posted through your application will automatically be wrapped with t.co.

Until recently, all HTTP-based t.co links on Twitter have been only 19 characters long. Part of the August 15th phasing is to increase t.co URL’s default length to 20 characters. While we don’t anticipate the length of t.co links to change frequently, we wanted to remind you to check the fields short_url_length and short_url_length_https from GET help/configuration daily, rather than relying on a hard-coded value.

With so many t.co-wrapped links on Twitter, we strongly encourage applications that display Tweets to make liberal use of Tweet Entities. In fact, in the coming weeks, entities will be included by default in Tweet responses (as currently provided by including “include_entities=true”). We look forward to offering an accompanying analytics API not long after this rollout is complete.

To summarize

  • On August 15th, we’ll begin automatically wrapping URLs that are 20 characters or greater in length and submitted through Tweets & direct messages.
  • You can opt-in to using t.co on a per-tweet or per-application basis today. Use wrap_links=true on POST statuses/update & POST direct_messages/new or configure your app.
  • HTTP-based t.co links will soon be 20 characters long. HTTPS-based t.co links will be 21 characters long.
  • Use GET help/configuration daily to detect the maximum length for wrapped URLs (short_url_length & short_url_length_https) and cache the values.
  • Rendering Tweets with wrapped links is made possible with Tweet Entities.
  • We’ll let you know well in advance of wrapping URLs less than 20 characters long.

If you have any questions about t.co link wrapping, please consult the t.co Link Wrapper FAQ and ask questions on our Developer Discussions.

Questions you may have