How to Pre-Populate A Twitter Status On The Web

Alan BelniakSocial Media6 Comments

The Situation

You may have come across a site like this before: you see a nice bit of text (a quote, a joke, something with a hashtag in it) that is shareable.  Next to that text is a Twitter icon.  You click it, and it bounces you to your browser, opens a new window, and pre-populates a tweet for you.  All you need to do is click ‘Tweet’ or make an edit or two, and then click ‘Tweet’. (see my friend Jeff Cohen’s recent example on SocialMediaB2B.com to see what I mean)

Screen clip of pre-populated Tweet

The Request

How can I do that?  Can I make a button on a blog post, website, or even embedded in a .pdf to do the same?  Do I need to be a coder?

 

The Response

Easily – keep reading. Yes. No.

 

The way I figured this out was by clicking on a ‘Click here to tweet that you are reading this!’ button from a white paper.  I was intrigued, so I did, and then I watched what happened.  The ‘magic’ is just a URL with a pre-defined header, and a customizable ending.  Let’s look at one and dissect it.

 

Over on one of my company’s sites, we have an ebook for download.  Along the footer of each page of the ebook are some sharing icons, and one is to promote the fact that a reader is reading  the ebook.  To reduce the friction of sharing, we’ve set up a pre-populated tweet for the user to send.  If you click on the tweet, it (as I mentioned) pops open a browser window.  Here’s the URL:

https://twitter.com/intent/tweet?source=webclient&text=I+just+downloaded+the+%E2%80%98Exploring+the+evolution+
of+Creo%E2%80%99+eBook%3A+http%3A%2F%2Fbit.ly%2FCreo_eBook+%23Creo+%28via+%40PTC_Creo%29

 

Notice that it’s two distinct pieces:

https://twitter.com/intent/tweet?source=webclient&text=

 

and

I+just+downloaded+the+%E2%80%98Exploring+the+evolution+of+Creo%E2%80%99+eBook%3A+http%3A%2F%2F
bit.ly%2FCreo_eBook+%23Creo+%28via+%40PTC_Creo%29  

 

Here’s a recommendation…

  • Open an Excel sheet.
    • You don’t have to do this in Excel – it’s just a tip. You can use Word or notepad or anything. Ignore the specific tool and focus on the lesson.
  • Draft up your tweets in cells A1, A2, etc. (column A).  Be sure to include your links (typically at least 20 character), and hashtags, if appropriate.
    • Spell check them.
  • Now, in cell B1, enter =LEN(A1)   
    • LEN is the Excel command for LENgth.  The value returned is the number of characters, including spaces, contained in cell A1.  If any of these values exceeds 140, then you need to edit.  If you’re fancy, you can set up some conditional formatting on this column and very quickly tell which cells/tweets are your offenders and which are OK.
  • From what you can see above, URLs don’t use spaces.  So, use the CTRL+H command in Excel (and Word – it’s search and replace) and replace the spaces with + signs.  In many cases, you are 85% done.
  • Now, if you have special characters, like hashtags or question marks, you’ll need the ASCII equivalent for that.  Take a look at the table at http://www.w3schools.com/TAGS/ref_urlencode.asp for more help.  Simply replace the special character with the ASCII code and you’re cooking with gas.
  • Once you’ve swapped out spaces for plus signs and special characters for ASCII equivalents, now you can append the standard leading text of https://twitter.com/intent/tweet?source=webclient&text= with this new tweet text.  Go ahead.
  • Open notepad or some other text editor and do that.  Then, click the link.  Watch what happens.  Is it what you expect?  Then huzzah!  If not, figure out where it ‘breaks’, and go fix the text in the URL.
  • When you get this to work, save in a different document or Evernote or wherever you like.  Now, when you want to pre-populate a tweet, insert a nice Twitter image, and attach a URL to it.  In this case, it’s the URL you just built and tested.

 

 

How about you?  Have you gotten this technique to work?  If so, share your experiences below in the comments.

 

 


If you like what you’re reading here, consider subscribing to the RSS feed or signing up via e-mail (upper right corner) to be alerted when more new posts are added.