Sub topic 9
Direct and Referral: What They Really Mean
This chapter assumes you know how GA4 builds sessions from events. It also assumes you have read the earlier chapters on source, medium and campaign, and on how the default channel rules are matched in order. Direct and Referral look like descriptions of how people arrived. In practice they are classifications GA4 makes from whatever signals reached it, and both hide information.
Direct: the fallback
Direct does not mean "the visitor typed your URL". GA4 assigns the Direct channel when a session has no campaign parameters and no usable referrer. The rule is strict:
- The session source is exactly
(direct). - The session medium is
(none)or(not set).
Direct is also the first rule checked. A session with no tagging and no referrer therefore ends up in Direct, and so does any session whose tagging or referrer was lost on the way to your site.
What genuinely lands in Direct
Some Direct sessions are real direct visits:
- Typing the address into the browser.
- Opening a bookmark.
- Following a link from a native app or desktop program that sends no referrer.
What lands in Direct by accident
A large share of Direct traffic is traffic that should have been classified elsewhere. The table lists the usual causes.
| Cause | What happens | Typical fix |
|---|---|---|
| Untagged links in email, PDFs, slide decks or documents | The click carries no referrer and no UTM parameters | Add UTM parameters to every link you control |
| Messaging and chat apps | Many apps strip the referrer | Tag shared links, or accept some Direct noise |
| HTTPS to HTTP transitions | Browsers drop the referrer when moving from a secure page to an insecure one | Serve your site over HTTPS only |
| Referrer policies and `rel="noreferrer"` | The source site tells the browser not to send a referrer | Ask the partner to change it, or tag the link |
| Redirects that drop query strings | The landing page URL arrives without `utm_*` parameters | Make redirects preserve the query string |
| Missing or late tag | The first page does not fire GA4 before the parameters disappear | Fire the tag on the landing page and check redirects |
The pattern is that Direct is where lost information collects. It is not evidence of brand strength by itself.
Direct and attribution
Session-scoped reports such as Traffic acquisition show a Direct session as Direct. Attribution reports and models treat it differently. In the last-click and data-driven models, a direct visit does not take credit from an earlier non-direct click inside the lookback window. So the same visitor can appear as Direct in a session report and still credit an earlier channel for a key event in an attribution report. Keep that difference in mind when two reports disagree.
Referral: a link from another site
GA4 uses the Referral channel when the medium is referral, app or link. For an ordinary link click, GA4 reads the browser's referrer header. It sets the source to the referring hostname and the medium to referral. A click from a partner blog might produce:
- Source:
partner-blog.com - Medium:
referral - Channel: Referral
Two points matter in practice.
- Referral is checked late. The default rules test Direct, the paid channels and the organic channels before they reach Referral. A referrer from a recognized social, search or shopping site is usually reclassified before it can be Referral. The earlier chapter on source categories explains how that recognition works.
- Referral can come from tagging too. If you set
utm_medium=referralon a link, the session lands in Referral whatever the referrer says. The valuesappandlinkwork the same way.
A simplified model
The next script models only the Direct and Referral decision. Real GA4 also applies campaign parameters, auto-tagging data and a large list of search and social sites. The model keeps just enough to show the order of decisions.
from urllib.parse import urlparse, parse_qs
SEARCH_HOSTS = {"google.com", "bing.com", "duckduckgo.com"}
def host_matches(host, domains):
return any(host == d or host.endswith("." + d) for d in domains)
def source_medium(landing_url, referrer, unwanted=()):
query = parse_qs(urlparse(landing_url).query)
# 1. Explicit campaign tagging wins over the referrer.
if "utm_source" in query or "utm_medium" in query:
source = query.get("utm_source", ["(not set)"])[0]
medium = query.get("utm_medium", ["(not set)"])[0]
return source, medium
# 2. Otherwise use the referrer, if there is one.
if referrer:
host = urlparse(referrer).hostname or ""
if host_matches(host, unwanted):
return None # ignored: session keeps its earlier source
if host_matches(host, SEARCH_HOSTS):
return host, "organic"
if host:
return host, "referral"
# 3. Nothing usable: fall back to direct.
return "(direct)", "(none)"
def channel(source, medium):
if source == "(direct)" and medium in ("(none)", "(not set)"):
return "Direct"
if medium in ("referral", "app", "link"):
return "Referral"
return "Other"
cases = [
("https://www.example.com/pricing", ""),
("https://www.example.com/pricing", "https://partner-blog.com/review"),
("https://www.example.com/pricing?utm_source=newsletter&utm_medium=email", ""),
("https://www.example.com/pricing?utm_source=blog&utm_medium=referral", ""),
("https://www.example.com/thanks", "https://www.paypal.com/checkout"),
]
for url, ref in cases:
result = source_medium(url, ref, unwanted={"paypal.com"})
if result is None:
print("ignored referral, keeps previous source")
else:
print(result, "->", channel(*result))Running it prints:
('(direct)', '(none)') -> Direct
('partner-blog.com', 'referral') -> Referral
('newsletter', 'email') -> Other
('blog', 'referral') -> Referral
ignored referral, keeps previous sourceThe newsletter session prints Other only because this model has no Email rule. In GA4 it would be Email.
The decision path
The diagram shows the order the model above uses, which mirrors how GA4 falls back from tagging to referrer to Direct.
Self-referrals and payment gateways
A common Referral problem is your own site, or a service your visitors pass through, appearing as a referrer. Typical examples are:
- A second domain you own, such as a separate checkout domain.
- A payment provider that returns the customer to your thank-you page.
- An authentication provider that redirects back after login.
Each of these can start a new session whose source is the intermediate site. Your conversion then looks like it came from paypal.com, and the true source is lost. GA4 gives you two settings for this.
- Cross-domain measurement. Under the data stream's tag settings, list the domains you own so that one visit keeps one session across them.
- List unwanted referrals. Add third-party domains such as the payment provider so that GA4 ignores them as referrers. The session then keeps its earlier source instead of starting a new one.
Diagnosing the two channels in a report
Open Reports, then Acquisition, then Traffic acquisition. The default view uses the session default channel group. To investigate, build a free-form exploration with these settings:
- Dimensions: Session source / medium, Landing page.
- Metric: Sessions.
- Filter: Session default channel group exactly matches
Direct.
Look at the landing pages. Sessions that land on deep campaign pages, such as /spring-sale, are unlikely to be typed URLs. They suggest lost tags or stripped referrers on that campaign. If the same page's Direct count jumps right after a campaign launch, check the links and redirects first.
For Referral, sort by source and look for:
- Your own domains, which point to missing cross-domain setup.
- Payment and login providers, which belong on the unwanted referral list.
- Social or search hostnames that are missing from the source list, which may indicate a source category gap.
Also compare the Direct share against your site's history. A sudden rise after a site migration, consent banner change or redirect rewrite is more likely a measurement change than a change in visitors.
Practical rules
- Tag every link you control, including those in email, PDFs and social bios, so that Direct holds only visits that really are direct.
- Keep
utm_mediumvalues consistent. A value such asreferralis an assignment to the Referral channel, not a description. - Preserve query strings through redirects and test them with a real click.
- Review the unwanted referral list and cross-domain settings whenever you add a checkout, login or marketing domain.
- Treat the Direct share as a measure of tagging quality as well as of loyalty.
Exercise
A visitor clicks a link in your PDF brochure. It points to https://www.example.com/offer with no query string. Which channel does GA4 assign, and what two changes would move the session into a more useful channel?
Show answer
GA4 receives no referrer and no campaign parameters, so the source is (direct), the medium is (none) and the channel is Direct. First, add UTM parameters to the brochure link, for example ?utmsource=brochure&utmmedium=print&utmcampaign=springoffer, so the source and campaign are recorded. Second, use a medium your channel rules recognize, such as referral if you want Referral, or define a custom channel group for print. A tagged link with an unrecognized medium would otherwise land in Unassigned, so check the result in a report afterwards.
Exercise
Your Referral report shows paypal.com as the second-largest source, and purchase conversions are credited to it. What is happening, and how do you fix it going forward?
Show answer
Customers leave your site to pay, then return from paypal.com. GA4 treats the return as a new referral session and credits paypal.com. Add paypal.com to the list of unwanted referrals in the data stream's tag settings, so returning visitors keep their earlier source. This applies only to new data, so past sessions stay as they were.