February 21, 2023
How to Track QR Codes with Google Analytics 4
If your business runs printed or billboard ads, you can still measure their impact on your website traffic. That can be done with the help of QR codes. Someone sees your ad, scans its QR code, and is redirected to your website/landing page. Here Google Analytics 4 joins the game and can attribute that session to your QR codes.
However, this does not happen by default, and you need to customize the setup. In this tutorial, I will explain how to track QR codes with Google Analytics 4.
Table of Contents
– Hide table of contents –
- QR code must be prepared
- Decorate the URL
- URL shortener
- Generate the QR code
- Test the traffic
- Where to find QR code data in reports?
- Final words
If you prefer video content, here’s a tutorial from my Youtube channel.
QR code must be prepared
Out of the box, no analytics tool can track traffic from QR codes. If you don’t customize the link of the QR, all traffic coming from it will be displayed as direct.
However, you can use UTM parameters to add more information to the QR code. When a visitor lands on your site and the page URL container things like utm_medium, utm_source, utm_campaign, GA4 will track that and attribute the session to the QR code.
Decorate the URL
Let’s say that you want visitors to land on example.com/special-offer/. This is the destination URL. Now, let’s add UTM parameters (if you want to learn more about them, watch this tutorial). You can either do that manually, or you can use URL builders like this one.
You should add at least 3 UTM parameters to the URL:
Medium (utm_medium) is the broadest descriptor (like email, organic, etc.). If you plan to place the QR on a magazine, the medium’s value could be print, magazine, or something like that. If this QR code is going to be added to a billboard outdoors, then the medium’s value could be billboard.
Source (utm_source) is a bit more specific compared to the medium. Examples of it can be facebook.com, google, mailchimp, etc. In the context of QR code, the source could be the name of a magazine, a name of a billboard company, or something similar.
Campaign (utm_campaign) is even more specific than the previous two UTM parameters. As the parameter name implies, it should contain the name of your campaign, for example, summer sale, Black Friday 2023, etc.
Here’s an example of a URL decorated with UTM parameters: https://example.com?utm_medium=print& utm_source=cool+magazine&utm_campaign=summer20.
Each parameter is concatenated with an ampersand (&).
To make the process a bit easier, you can use URL builders (like this one), where you just need to enter the destination URL and values of parameters.
Then the builder will generate the final URL with all UTMs.
The next step could have been to generate the actual QR code, but there’s one challenge. The longer the URL, the smaller the black squares in the QR code. This can negatively affect the user’s experience when scanning the code (with shaky hands, it might become a challenge for some people).
Your goal is to ensure that the QR code has as few black squares as possible. Also, the larger the squares, the better.
That’s why I recommend using a URL shortener (like bit.ly, shorturl.at). Open any URL shortener of your choice and paste the final link you generated in the previous chapter (the one with all the needed UTM parameters). Then generate the short URL. It might look like this https://bit.ly/239nd38 or like this https://rb.gy/xuduc5, or something else (depending on which URL shortener you chose).
It’s also a good idea to use a shortener that allows you to edit the final destination URL later. In rare situations, you might have an emergency and need to redirect users somewhere else.
Generate the QR code
Let’s generate the QR code. There are many free online QR code generators like this one. Paste your short URL there and generate the image. Save it and use it in your print ads or somewhere else.
Remember that if you plan to use it in print, the image’s resolution must be high.
Test the traffic
Don’t forget to test the QR code before you send it to the designer who’s responsible for incorporating the QR. The easiest way would be to take your smartphone, scan the QR code and then land on your website.
Then go to Google Analytics 4 > Reports > Realtime and find the card that says Event count by Event name. Find the page_view event there, and click it.
Then keep looking for the following parameters:
- campaign (one of the values there should be the value of your QR code’s utm_campaign)
- medium (represents utm_medium)
- source (represents utm_source)
See the correct values? If yes, then you’re good to go. If you cannot see the data in real-time reports, read this troubleshooting guide.
Where to find QR code data in Google Analytics 4?
After you launch the campaign and start getting traffic from the QR code, it’s time to check the data. Before you continue, ensure you have waited 24-48 hours after the campaign was launched. GA4 is slow when it comes to data processing.
To see the reports of your traffic sources, you will need to use Acquisition reports.
Go to Reports > Acquisition > Traffic Acquisition. It’s important that you choose Traffic Acquisition, not User acquisition because they serve different purposes. Since you want to check traffic sources of each individual session, Traffic acquisition is what you need.
The default dimension in that report is Session Default Channel Grouping. You won’t see anything related to the QR code there. However, if you switch the primary dimension to Session Medium, you should start seeing the needed value there.
You can add a secondary dimension, Session Source, by clicking the plus icon.
Now you can see how many sessions and users you got from visitors who scanned the QR code.
Also, you can scroll to the right and see how many conversions did you get and (if it applies to you) how much revenue did you get.
But if you still cannot see the traffic data coming from QR codes, I guess you are affected by Thresholding. If you see an orange exclamation mark above the report, my guess was correct. Read this guide on how to fix this.
Track QR codes with Google Analytics 4: Final words
Remember, QR codes need to be prepared if you want to track them with Google Analytics 4. Some URL shorteners might add their UTM parameters, so you can also investigate that option.
Even though you don’t have to use URL shorteners, I recommend doing that because it will reduce the number of squares in the QR code (which will make it easier to scan from a distance or with a low-quality smartphone camera).
If you want to learn much more about how to use Google Analytics 4 and benefit from it, take a look at my GA4 course.
Thanks, Julius, I'll definitely be learning to use this