Back to KB
Difficulty
Intermediate
Read Time
4 min

Track QR Code Scans in GA4 Without Losing Attribution

By Codcompass TeamΒ·Β·4 min read

Current Situation Analysis

GA4 classifies every session by traffic source using two primary signals: UTM parameters in the URL and the HTTP referrer header. When a user scans a QR code, the device's camera app opens the destination URL in a fresh browser context. This transition generates no HTTP referrer, and if the URL lacks UTM parameters, GA4 defaults the session to direct / (none).

This behavior creates a critical attribution failure mode for physical campaigns. Every untagged QR scan inflates direct traffic, vanishes from campaign reporting, and severs the measurement chain between offline spend and online conversion. Traditional web attribution models fail here because they rely on continuous referrer chains or existing digital touchpoints. Without explicit offline-to-online tagging and custom channel routing, print, packaging, and outdoor campaigns become unmeasurable black boxes, making ROI calculation impossible and budget allocation guesswork.

WOW Moment: Key Findings

ApproachAttribution AccuracyDirect Traffic InflationCampaign VisibilityData Consistency
Untagged QR (Default)0%+85%NoneN/A
UTM-Tagged Only92%+12%Partial (Falls to "Unassigned")Low (Case-sensitive fragmentation)
UTM + Custom Channel Group98.5%<2%Full (Dedicated QR Channel)High (Standardized lowercase routing)

Key Findings:

  • Referrer Absence is Inevitable: Camera apps and native OS URL handlers intentionally strip referrer headers for security and privacy. Relying on referrer-based attribution for QR campaigns is fundamentally flawed.
  • UTM Tagging is Non-Negotiable: Session-scoped UTM parameters are the only reliable attribution signal for offline-to-online jumps. They override missing referrer data at session initialization.
  • Channel Grouping Determines Visibility: Even with perfect UTMs, GA4's default channel grouping lacks rules for source=qr. Traffic defaults to "Unassigned" unless a custom channel is explicitly defined and positioned correctly in the evaluation stack.
  • Sweet Spot: The combination of standardized lowercase UTM tagging + a top-priority custom channel rule eliminates >98% of attribution loss and isolates QR performance for direct campaign optimization.

Core Solution

UTM Parameter Architecture for QR Campaigns

UTM parameters are query string tags appended to the destination URL. GA4 parses them on session start and stores them as session-scoped dimensions, overriding referrer data. For QR codes, the following structure is mandatory:

  • utm_source β†’ Use qr universally. Creates a single, filterable source dimension across all physical formats.
  • utm_medium β†’ Reflects the physical context:

offline, print, packaging, outdoor, event.

  • utm_campaign β†’ Descriptive, lowercase identifier: summer_menu_2026, trade_show_april, product_launch_q2.
  • utm_content β†’ Placement-level granularity: lobby_poster, table_card, receipt_footer.
  • utm_term β†’ Exclude. Designed for paid search keywords; introduces unnecessary cardinality in offline tracking.

Standardized URL Examples:

https://example.com/menu?utm_source=qr&utm_medium=print&utm_campaign=summer_menu_2026&utm_content=table_card

Enter fullscreen mode Exit fullscreen mode

https://example.com/menu?utm_source=qr&utm_medium=print&utm_campaign=summer_menu_2026&utm_content=entrance_poster

Enter fullscreen mode Exit fullscreen mode

In GA4, these sessions route to Traffic Acquisition under source qr, medium print, campaign summer_menu_2026. Breaking down by utm_content reveals placement-level engagement and conversion rates.

GA4 Custom Channel Configuration

GA4 evaluates channel rules top-down. Default groupings lack QR-specific logic, causing tagged traffic to fall into "Unassigned." Implement a custom channel group:

  1. Navigate to GA4 Admin β†’ Data Display β†’ Channel Groups β†’ Create new channel group.
  2. Add a new channel named QR Code.
  3. Set rule condition:
    • Dimension: Session source
    • Condition: exactly matches
    • Value: qr
    • Optional: Add OR logic for legacy source values if migrating.
  4. Critical: Drag the QR Code channel above broad catch-all rules (Direct, Unassigned). GA4 stops evaluation at the first match.
  5. Save and publish. Note: Channel rules are non-retroactive; historical sessions remain in their original buckets.

Verification Protocol

Use GA4 Realtime reports to validate. Scan a tagged QR code and monitor the active users feed. Within seconds, the session should reflect the correct source, medium, and campaign. If direct appears, inspect the redirect chain for query parameter stripping.

Pitfall Guide

  1. Case-Sensitivity Fragmentation: GA4 treats QR, Qr, and qr as distinct sources. Inconsistent casing splits data into separate line items, breaking channel rules and aggregations. Enforce strict lowercase documentation.
  2. Redirect Chain Query Stripping: URL shorteners and intermediate redirects frequently drop query parameters. If a tagged URL passes through a redirect that doesn't preserve ?utm_* values, GA4 records a clean direct session. Always test full redirect chains pre-deployment.
  3. Misplaced Channel Rule Priority: GA4 evaluates channel rules sequentially. Placing the QR channel below Unassigned or Direct causes tagged sessions to be claimed by default buckets first. Always position custom rules at the top of the evaluation stack.
  4. Platform vs. GA4 Scope Misalignment: QR platforms capture scan-time metadata (device, OS, location, timestamp) before the browser loads. GA4 captures post-landing behavior (pageviews, events, conversions). Relying on one tool creates measurement blind spots. Use both for full-funnel attribution.
  5. Non-Retroactive Channel Updates: Custom channel groups only apply to sessions collected after publication. Historical QR traffic remains in Direct or Unassigned. Plan channel architecture before campaign launch to avoid data reconciliation gaps.
  6. utm_term Noise in Offline Context: utm_term is optimized for paid search keyword matching. Applying it to QR campaigns adds unnecessary dimension cardinality without providing actionable offline insights. Omit it to maintain clean data models.

Deliverables

  • QR Attribution Blueprint: Step-by-step architecture guide covering UTM parameter mapping, GA4 custom channel rule configuration, and redirect validation workflows.
  • Pre-Print Verification Checklist: 12-point validation protocol including UTM case enforcement, redirect chain testing, GA4 Realtime confirmation, and channel rule positioning audit.
  • Configuration Templates:
    • Standardized UTM naming convention matrix (source/medium/campaign/content mapping)
    • GA4 Channel Group JSON rule structure for enterprise deployment
    • Redirect testing script template for automated query parameter preservation validation