Twitter Hashtags and QR Codes
I spotted this poster today, encouraging people to search for the Twitter hashtag "#Transformers".
Wouldn't it make sense to use a QR code as well? That way people could quickly scan, and be taken straight to the discussion, rather than have to fire up Twitter and do a manual search.
As it happens, it's slightly tricky to make a QR code which searches for a Twitter hashtag.
There are two things to note:
- Twitter's search URLs are annoyingly different from every other search URL on the planet.
- You will need to take care of URL Encoding for special characters.
Building The Search Query
A typical Twitter search URL is
https://mobile.twitter.com/#!/search/
With the query at the end, so a search for "Transformers" would be
https://mobile.twitter.com/#!/search/Transformers
Encoding Correctly
Hash symbols (#) need to be URL Encoded. In this case, the hash becomes "%23"
https://mobile.twitter.com/#!/search/%23Transformers
However, there is a "gotcha". Because of the... special... way Twitter constructs its search URLs, we have to URL Encode the percentage sign! So, the "%" becomes "%25".
So, our final URL becomes
https://mobile.twitter.com/#!/search/%2523Transformers
Finally, if you want to use something like Google Charts to create your QR codes, you'll need the URL Encode all of the : / # ! and other special characters.
https://chart.googleapis.com/chart?chs=200x200&cht=qr&chl= https%3A%2F%2Fmobile.twitter.com%2F%23%21%2Fsearch%2F%2523Transformers
The Final Result
We end up with a QR code which can be scanned to take the user directly to the hashtag they are searching for,
7 thoughts on “Twitter Hashtags and QR Codes”