Signal Hub logoSignal Hub

TypeScript news and articles

TypeScript
Updated just now
Date
Source

1 article

Dev.to (JS/TS)
~8 min readMay 6, 2026

Track QR Code Scans in GA4 Without Losing Attribution

You launch a print campaign. Posters go up, menus get new QR codes, product packaging ships with a fresh scan prompt. Two weeks later you open GA4 to measure performance and see a spike in direct traffic. No campaign, no source, no medium. Your QR scans are in there somewhere, mixed in with people who typed your URL by hand. This is the default behavior for QR code GA4 tracking, and it will keep breaking attribution on every physical campaign you run until you fix it. TL;DR QR scans arrive in GA4 as direct traffic because phones send no HTTP referrer when opening a URL from a camera app. The fix is always-on UTM tagging: every QR destination URL needs at minimum utm_source, utm_medium, and utm_campaign. GA4 has no built-in QR channel — create a custom channel group so tagged QR traffic is not bucketed as "Unassigned." Use a consistent lowercase naming convention or your data fragments into separate line items that look like different sources. QR platform analytics and GA4 serve different purposes — use both, not one or the other. Key concept: GA4 classifies every session by traffic source. When no UTM parameters and no HTTP referrer are present, GA4 defaults to "direct / (none)." That is exactly what happens with every untagged QR code scan. GA4 identifies traffic source from two places: UTM parameters in the URL and the HTTP referrer header sent by the browser. Click a link on a webpage and that page's URL gets passed along as the referrer. Click an email link and the email client usually strips the referrer, which is why email marketers have been tagging URLs with UTM parameters for years. QR codes are the same problem, only worse. Someone scans a QR code and their phone opens the URL in a fresh browser tab. No previous page to reference. No referrer sent. GA4 sees an empty source and files the session under "direct / (none)." Every untagged QR campaign you run inflates your direct traffic number and vanishes from campaign reports. You cannot prove which placement drove visits, which campaign generated conversions, or whether your print spend was worth a dime. UTM parameters are query string tags appended to a destination URL. GA4 reads them on arrival and stores them as session-scoped dimensions, overriding whatever referrer data the browser would have sent. For QR codes, UTMs are not optional. They are the only attribution signal you have. utm_source — Where the traffic originates. For QR codes, use qr as a standard value across all campaigns. This makes it easy to create a single GA4 channel rule that captures all QR traffic regardless of format. utm_medium — The channel type. Options include offline, print, packaging, outdoor, event. Pick the one that reflects the physical format. utm_campaign — The campaign name. Keep it descriptive and lowercase: summer_menu_2026, trade_show_april, product_launch_q2. utm_content — The specific placement within a campaign. utm_content=lobby_poster versus utm_content=table_card versus utm_content=receipt_footer gives you placement-level data inside a single campaign. utm_term — Skip it for QR campaigns. It was designed for paid search keyword tracking and adds noise without value in an offline context. A properly tagged URL for a restaurant running a summer menu campaign: https://example.com/menu?utm_source=qr&utm_medium=print&utm_campaign=summer_menu_2026&utm_content=table_card Same campaign, different placement: https://example.com/menu?utm_source=qr&utm_medium=print&utm_campaign=summer_menu_2026&utm_content=entrance_poster In GA4, these sessions show up in Traffic Acquisition under source qr, medium print, campaign summer_menu_2026. Break down by utm_content to see which placement drove more scans or deeper engagement. GA4 is case-sensitive for UTM parameter values. utm_source=QR and utm_source=qr show up as two different sources. Pick your values, document them, enforce them. This is far and away the most common UTM mistake in practice. Even with perfect UTM tagging, GA4 will not know what to do with sessions where session_source = qr and session_medium = offline. The default channel grouping has no rule for these values, so they land in "Unassigned." You need a custom channel group. Go to GA4 Admin and select your property. Under Data Display, click Channel Groups. Click Create new channel group. Name your channel group "QR Campaigns" or copy the default channel group and add a new channel. Click Add new channel and name it "QR Code." Set the rule condition: Dimension: Session source Condition: exactly matches Value: qr If your team already uses multiple source values, add multiple conditions with OR logic. GA4 evaluates channel rules from top to bottom and stops at the first match. Place your QR Code channel above the broad catch-all rules like "Unassigned" or "Direct" so QR sessions are claimed before they fall through to a default bucket. Click Save. One caveat: this rule is not retroactive. Sessions collected before you created it stay where they are. Use GA4's Realtime report to test right away. Scan one of your tagged QR codes on your phone and watch the active users report. Within a few seconds the session should appear with the correct source, medium, and campaign. If you see direct traffic instead, a redirect probably stripped the UTM parameters. URL redirect chains trip up even experienced marketers. If your tagged URL goes through a redirect that strips query parameters, the UTM values disappear before they reach the landing page. The typical failure: you tag a URL, shorten it, and the shortener's redirect does not preserve query strings. The user lands on your page with a clean URL and GA4 records a direct session. Test every redirect in your chain before printing anything. Dynamic QR codes sidestep this. Instead of encoding a long UTM-tagged URL directly, the QR code points to a short redirect URL managed by your QR platform. The platform redirects to your destination with UTM parameters intact and lets you change the destination URL later without reprinting. For long-running campaigns, that flexibility alone is worth the switch. These tools track different things, and you need both. A QR platform captures scan-level data: total scans, unique scans, device type, OS, location by country and city, time-of-day patterns. All of this is recorded the moment someone scans, before they reach your website. It tells you how many people scanned and where. GA4 picks up after the landing page loads. Pageviews, events, conversions, session duration, goal completions. It tells you what scanners did once they arrived and how many converted. A QR campaign might show 400 scans in the platform dashboard but only 220 sessions in GA4. That gap is real: users who bounced before the GA4 script fired, or users on devices with JavaScript disabled. Comparing scan data against session data is the only way to understand drop-off at the scan-to-landing-page step. The most common one, and the most painful. Every QR code destination URL must be tagged. No exceptions. If you already have QR codes printed on materials without UTM parameters, that attribution data is gone. You cannot recover it. Adding UTM parameters to links between pages on your own website overwrites the session source mid-visit. A user arrives from your QR code, clicks a UTM-tagged internal banner, and GA4 reassigns the session to the banner as the source. Keep UTM parameters on external-to-your-site links only. Same tagged URL across five different placements means five placements sharing one line item in GA4. Worth creating a unique QR code for each placement, even if it takes a few extra minutes. Someone on your team launches a new campaign with utm_source=qr-code while every previous campaign used utm_source=qr. Now you have a separate source row in GA4 that cannot be merged after the fact. A shared UTM naming doc, reviewed before each launch, prevents this. Printing 10,000 flyers with a broken QR code is an expensive lesson. Scan your QR code with GA4 Realtime open before sending anything to print. Confirm the UTM parameters survive every redirect in the chain. With tagging and the channel group in place, build a focused QR campaign report in Explore using a free-form exploration. Dimensions to include: Session campaign — separates individual campaigns Session source / medium — confirms QR sessions are properly tagged Session manual ad content — surfaces your utm_content placement data Landing page + query string — useful for catching untagged QR sessions that slipped through Metrics to include: Sessions Engaged sessions Engagement rate Key events (conversions) User engagement duration Filter the exploration to Session source exactly matches qr to isolate QR traffic. Save it once and revisit across campaigns without rebuilding. QR code attribution in GA4 is not a platform limitation. It is a setup problem you can solve in an afternoon. Tag every destination URL with consistent UTM parameters, create a custom channel group so GA4 knows what to do with that traffic, and test before you print. Those three steps recover attribution that most marketers are losing to the direct channel bucket right now. Originally published on QR Nova