The following six methods can stop caching from causing your website traffic (esp. paid traffic) to be reported as direct traffic in GA4. 1) Don’t cache URLs with tracking parameters. You are running a Google Ads campaign. The ad link is: https://example. com/landing-page?utm_source=google&utm_medium=cpc&utm_campaign=sale >> User A clicks the ad → lands with ?utm_source=google. >> Your CDN caches the HTML with UTMs baked in. >> Later, User B visits https://example. com/landing-page (no UTMs). >> CDN serves the cached HTML from User A’s session, which still contains utm_source=google. Result: GA4 wrongly attributes User B’s visit to google / cpc instead of direct. . . 2) Don't let your caching configurations strip out UTM parameters. >> A user clicks the ad → browser requests /landing-page?utm_source=google.... >> The caching layer (e.g., Cloudflare) says: “I already have a cached copy of /landing-page without parameters, let’s just serve that.” Result: The page loads without the UTM parameters passed to GA4. GA4 sees no source/medium and counts it as Direct traffic. Your Google Ads campaign loses credit. . . 3) Don’t add cache-busting query strings like ?v=1234 to landing pages with UTMs. >> A user clicks the ad → browser requests /landing-page?utm_source=google.... So far, attribution is correct → GA4 will record this visit as google / cpc. Your developer adds a cache-busting parameter for performance (like ?v=1234) to the landing page. Now, GA4 sees two different landing pages: /landing-page?utm_source=google... /landing-page?utm_source=google...&v=1234 Result: >> The same campaign traffic is split across multiple URLs. >> Landing page reports get fragmented. >> GA4 treats them as different pages even though they are the same. . . 4) Preserve referral headers. Some caching/CDN layers can unintentionally remove or overwrite Referer headers. Make sure these headers are preserved all the way through to GA4 so referral attribution remains accurate. . . 5) Set shorter cache durations for HTML documents. Use shorter cache times for HTML pages compared to static assets (CSS, JS, images). This prevents stale cached versions with UTM parameters from being served to later visitors who didn’t arrive via that campaign. . . 6) For SPAs (Single Page Applications), make sure GA4 captures virtual pageviews whenever the SPA route changes. >> A user clicks the ad and lands on /landing-page?utm_source=google... >> GA4 records the pageview as google / cpc. >> The user clicks a button that changes the SPA URL to: /checkout >> Since it’s an SPA, the page does not reload, so GA4 doesn’t automatically record this as a new pageview. >> The user makes a purchase. >> GA4 now sees only two things: A pageview for /landing-page and a purchase event. >> Because GA4 never saw the move to /checkout, it may lose the campaign context. Instead of crediting google / cpc, GA4 may attribute the purchase to Direct.