Home API Include QR Codes on Your Website

Include QR Codes on Your Website

BeliefMedia QR Code

A QR code (or Quick Response Code) is the trademark name for a matrix two-dimensional barcode that holds far more information than traditional, linear Universal Product Code (UPC) barcodes most commonly used on general consumer products. QR Codes were invented in 1994 by the Denso Wave automotive manufacturing company in Japan (a subsidiary of Denso Corporation that deals specifically with tracking and scanning technologies) to track vehicles during manufacture, and allow high-speed and accurate component scanning. QR codes now are used in a much broader context, including both commercial tracking applications and convenience-oriented applications aimed at mobile-phone users (termed mobile tagging).

Conventional UPC-style barcodes are capable of storing a maximum of approximately 20 digits. QR Codes, however, can encode up to 7,089 characters (or roughly 3KB of data) in one symbol. Since the codes were designed for the automotive industry, they were conceived with the inevitable wear and tear in mind. If damaged, up to 30% of codewords, depending on the defined Error Correction, can be restored.

Denso Wave

Denso Wave made the decision to make the specifications of the QR Code publicly available very early on in the development phase so that anyone could use it freely. Although Denso retained the patent rights to the tech, it declared that it (generally) would not exercise them. This policy was in place from the very beginning of the code development, honouring the developers’ intent that the QR Code could be used by as many people as possible. Thus the QR Code, which could be used at no cost and without worrying about legal entanglements, grew into a public code used by people all over the world.

QR Code Relevance in Consumer Marketing

It’s likely you’ve seen QR codes on consumer products without specifically knowing what they’re called. They’re often used to direct consumers to websites, competition pages, videos, and other relevant online destinations or offline text messages. Some business people use QR Codes on the back corner (or elsewhere) on business cards so they might be scanned to return populated contact information. Their apparent widespread adoption aside, much research suggests that they’re dying a slow death and will invariably end up in the tech-wasteland alongside Betamax and pagers. Research conducted in 2012 claimed that “… 97% of consumers don’t know what a QR Code is”. The linked article went on to say that “… most consumers are unsure which app to use to read a QR Code, or how to search for an app to read one”.

Ask a fish to climb a tree and it’ll tell you to fuck off. It’s this same principle that applies with certain tech-based marketing surveys (I think my dad still thinks Google owns the Internet). QR Code relevance in marketing can’t be determined by a general consensus; the percentage of people that are familiar with the term “QR Code” is often quite high, but it’s the undefined “most consumers” that Holtzclaw refers to in his article that isn’t nearly as high as his fuzzy brain might like to believe. Even in 2012, I don’t think Eric foresaw the ubiquity of smartphones and the effectiveness of consumer-facing handset marketing. Applications like Snapchat, Messenger, and Kik all now integrate the tech, and many food manufactures are now starting to use the codes as standard. Even Amazon is starting to print QR codes on its packaging. The Google Chrome browser now integrates built-in scanning functionality which you can access via various means. Bottom line: QR Codes are relevant if you make them relevant.

Our own use of QR Codes suggests that they absolutely have a place in marketing… if used correctly. It’s this strategic usage that led us down a path that had us include various QR-related tools in our (client) media management system.


Until a few hours ago, we operated a website at QRimg that served over 250,000 QR codes a day – and that number was growing on a weekly basis. We made a decision to retire a number of our websites early this year… and QRimg was next on the list. Operating a free website isn’t without its challenges… not the least of which is the constant barrage of feature requests demands from less than appreciative users. While the consumer-facing forms will make their way into our tools area sometime soon, the new API is tested and available now.

If you’re a user of the former QRimg API, access will continue until September 26th of this year.

Google Charts QR Code

If you’re after unrestricted access to basic codes, Google provides an excellent service. We’ve provided a PHP function here and shortcode function here that make use of their Charts API. While the Google API is deprecated, it will continue to work as per Google’s support policy.

PHP Function

The new API requires a specific format depending upon the type of QR code requested. The one commonality in all URI formats is the base_64(ish) encoded text that forms the image name. A fully constructed request looks as follows: http://api.beliefmedia.com/qr/{size}-{error_correction}-{border}/{bg_color}-{foreground_color}/{encoded_url}.png. A simple request for a code with default values is simply http://api.beliefmedia.com/qr/{encoded_url}.png.

If you’re a client, an apikey should also be passed to the function in the arguments array; this ensures your access won’t be metered. The Boolean html argument determines if a URL link is returned or a full-constructed image with basic style applied.

WordPress Shortcode

While a feature-rich WordPress plugin is forthcoming, the shortcode may be used in the meantime.

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

Usage is as follows: [qr url="http://www.beliefmedia.com/"]. The shortcode will return the following image:

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Shortcode Attributes

The following may be used to alter the appearance of the QR Code. The attribute descriptions also apply to the PHP function arguments.


The URL is either a URL or text. A mobile phone will recognize a particular schema and launch an appropriate application (for example, phone numbers, SMS, MMS etc).


Clients should use their API key to ensure access isn’t throttled.


The size of the QR code in pixels. We’ll return a ode up to 3000 pixels. Clients can request a code up to billboard size.


Error correction. Error correction to enable recovery of missing, misread, or obscured data (L, M, Q or H).


Background color (without leading #).


Foreground (code) color (without leading #).


The border size.


CSS applied to the returned image. We center the image with 20px of padding by default.


  • Track the number of times a code is scanned by creating an image that returns a short URL.
  • Clients should log into the platform for additional features.


[download shortcode=”216″ php=”217″

■ ■ ■

Interested in WordPress and Web Design? Subscribe to our list and we'll send you subscriber-only tools and plugins

Short URL for this post: http://shor.tt/19oC


Please enter your comment!
Please enter your name here