HowTo: Generate QR code for your site


Everyone know that one of the keys to have a great SEO for your website is making sure you keep your website updated, new and fresh. Whether you do this with a blog, or you change your homepage with new offers, coupons or new products, it serves to show Google that your site is “alive.” For many small businesses in particular, this is a real challenge.

So you already have great, fresh content on your site – what’s next? Do you know what is coming that may benefit your business? 

What are QR codes?

QR codes (abbreviation for Quick Response code) are a popular type of two-dimensional barcode. They are also known as hardlinks or physical world hyperlinks. QR Codes store up to 4,296 alphanumeric characters of arbitrary text. This text can be anything, for example URL, contact information, a telephone number, even a poem! QR codes can be read by an optical device with the appropriate software. Such devices range from dedicated QR code readers to mobile phones.

Uses of QR codes

  • QR Codes on business cards
  • Laptop stickers
  • Storefront displays
  • Promotions, discounts and giveaways
  • Use QR codes to get Likes and Follows
  • Increase e-commerce sales
  • Build your email subscriber list

QR code for your site?

There are various QR code generators available  online but, generating QR code without using generators is also very easy. We will use Google Chart APIs to generate QR code for us.

Creating QR code

Google charts API allows us to generate QR code by passing various parameters to their API. Below is the short description of each parameter-

Name Required? Description
cht=qr Yes Specifies a QR code.
chs=<width>x<height> Yes Image size. (Remember it’s English alphabet ‘x’ and not cross ’X’ )
choe=<output_encoding> No How to encode the data in the chart. Here are the available values:
UTF-8 [Default]
Shift_JIS
ISO-8859-1
chld=<error_correction_level>|<margin> No error_correction_level – QR codes support four levels of error correction to enable recovery of missing, misread, or obscured data. Greater redundancy is achieved at the cost of being able to store less data.Here are the supported values:
L – [Default] Allows recovery of up to 7% data loss 

M – Allows recovery of up to 15% data loss

Q – Allows recovery of up to 25% data loss

H – Allows recovery of up to 30% data loss

margin – The width of the white border around the data portion of the chart. This is in rows, not in pixels. The default value is 4.

Now, lets create QR code for Tutkiun, the values passed to parameters will be-

 

chs 150×150
cht qr
chl http://www.tutkiun.com
choe UTF-8

And the request URL is-

https://chart.googleapis.com/chart?chs=150×150&cht=qr&chl=http://www.tutkiun.com&choe=UTF-8

Generated QR code by Google chart API-

QR code for WordPress blogs

As WordPress provides functions which return base URL of a blog, we can use these functions.

<img src="http://chart.apis.google.com/chart?cht=qr&chs=150×150&chld=L|4&chl=<?php the_permalink(); ?/>" width="150" height="150" alt="QR code" />

Like this article? or have something to say? comment it down.

  • Prasanna Deshpande

    too good :)

    • http://www.tutkiun.com/ Mayur

      Thanks @google-7aeeb21ced8fe1ec45c0eb3890c00882:disqus  :-)

      Do check Tutkiun Beta List (http://beta.tutkiun.com) – A place where you find new products in Beta everyday.

  • Prasanna Deshpande

    too good :)

    • http://www.tutkiun.com/ Mayur

      Thanks @google-7aeeb21ced8fe1ec45c0eb3890c00882:disqus  :-)

      Do check Tutkiun Beta List (http://beta.tutkiun.com) – A place where you find new products in Beta everyday.

  • Anonymous

    400. That’s an error.

    Your client has issued a malformed or illegal request.
    The parameter ‘chs=150×150′ does not match the expected format.Invalid width or height.
    That’s all we know.

    • http://www.tutkiun.com/ Mayur

      Hey Jasper,

      You received that error because ‘×’ character in ‘chs=150×150′ is not an English character. It should be an English Language alphabet ‘x’.

      Hope that works! :-)

      Let me know if you have any other queries.

  • jasper22

    400. That’s an error.

    Your client has issued a malformed or illegal request.
    The parameter ‘chs=150×150′ does not match the expected format.Invalid width or height.
    That’s all we know.

    • http://www.tutkiun.com/ Mayur

      Hey Jasper,

      You received that error because ‘×’ character in ‘chs=150×150′ is not an English character. It should be an English Language alphabet ‘x’.

      Hope that works! :-)

      Let me know if you have any other queries.

  • Doug

    How can I pass a URL in the chl that contains variables? 

    Sample:

    the above example produces a QR with data stopping at “qid=234″.  How do I format the link to pass the other variables in my URL?

    Thanks,
    Doug

    • Tmay

      Did you ever figure this out?  I am searching for this answer 2.

  • Doug

    How can I pass a URL in the chl that contains variables? 

    Sample:

    the above example produces a QR with data stopping at “qid=234″.  How do I format the link to pass the other variables in my URL?

    Thanks,
    Doug

    • Tmay

      Did you ever figure this out?  I am searching for this answer 2.

  • Laurahartleyy

    very helpful, thanks :) .. I already have one of these QR codes for my blackberry but I have to say I don’t use it often at all… 

  • Laurahartleyy

    very helpful, thanks :) .. I already have one of these QR codes for my blackberry but I have to say I don’t use it often at all… 

  • http://www.smart-poster.co.uk Qr Codes

    This is pretty cool, i’ll going try this one also to my own site. Thanks anyways!

  • http://www.smart-poster.co.uk Qr Codes

    This is pretty cool, i’ll going try this one also to my own site. Thanks anyways!

  • http://www.techlila.com/ Rajesh Namase

    Cool info, will use this. I’ll use it.