QR Codes and How to Track Them

As I’ve mentioned previously, I have a book coming out in October and it will contain QR codes. The big idea is to give readers of The Art of Explanation an easy way to watch the videos we use as examples in the book.  Scan the code with a smartphone --> watch a video.  It’s easier than typing a long URL.  Of course, we made a video explaining QR codes, if you’d like to learn more.

The QR code in the photo above is from a previous draft and not a trackable version. 

There will be 16 QR codes throughout The Art of Explanation.  Using these codes in a book is an experiment and like any good experiment, we need ways to measure if and how they are used. We want to know, via our analytics program, anonymous data like:

  1. How many total visits came from the book this month?
  2. What videos from the book are being watched the most?
  3. What do visitors from the book do after they watch the video?
  4. What devices do people use to watch videos from the book?

Through a number of discussions with our friends Boris Mann and Monique Trottier, we figured out a way to make QR codes trackable in Google Analytics.  Boris wrote about the specifics in a great post called “Best Practices for Tracking QR Codes.”

My goal is to explain why this makes sense. Fair warning - It's a little more technical than you're used to seeing here. Let’s start with the basic ideas:

Google Analytics essentially measures clicks.  When you click a URL and visit commoncraft.com, I see the click in Google Analytics, along with every other visit.  Together, these anonymous clicks provide very useful information about traffic to our website. 

QR codes often use URLs.  When you scan a QR code to visit our website, the QR code tells your device what URL to use. Instead of clicking, you are scanning.  In Google Analytics, I have no default way of knowing if a link was clicked on a computer or scanned via a QR code. I need a way to see only the scans and measure them.  This will help us see the how the QR codes are being used. To do that we need to create special URLs that are trackable and link them to our QR codes. 

Thankfully, there is a way to make them trackable by creating a URL that includes information that Google Analytics can use to show us useful information. 

Instead of the normal URLs:  


The URLs for our QR codes will look like this: 


The URL is longer, but it’s OK, because the visitor is scanning a code to use it. If you look closely, you’ll see these parts of the URL:

  • Source = book
  • Medium = qrcode
  • Campaign = social-media (the specific video page)

By using these URLs for the QR codes, we can give Google Analytics information that helps us measure the use of QR codes in the book. All we have to do is use this URL when we create a QR code. It will be really interesting and I plan to report what we see.


Here’s a code to the video if you want to give it a try.