Twitter Hashtags and QR Codes


I spotted this poster today, encouraging people to search for the Twitter hashtag "#Transformers". Transformers Poster Twitter Hashtag

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:

  1. Twitter's search URLs are annoyingly different from every other search URL on the planet.
  2. 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,Transformers Hashtag Twitter Search


Share this post on…

  • Mastodon
  • Facebook
  • LinkedIn
  • BlueSky
  • Threads
  • Reddit
  • HackerNews
  • Lobsters
  • WhatsApp
  • Telegram

7 thoughts on “Twitter Hashtags and QR Codes”

    1. says:

      Interesting. It doesn't work for me. I wonder if it's because I'm signed in - or because I've got the new HTML5 experience?

      Reply
  1. Maybe they thought about it and hit the same stumbling blocks as you. Your QR code URL doesn't work for me, leads me to the mobile twitter home screen.

    Reply
    1. says:

      Mine or Ryan's?

      If you can't use mine, and I can't use his, it looks like there's something seriously weird with how Twitter handles mobile searches and redirects.

      Reply

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.

Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">