page_view

A page or screen was viewed. The tag writes one per navigation.

FieldValue
Namepage_view
Severity9 (INFO)
Written byBrowser tag automatically. Every SDK when you call page().
Turned off bydata-auto-page="false", which stops the single-page-app half. The first view of a document is always written.

When it fires

The tag writes one as soon as it has consent, and one on every history change where the path actually moved. Frameworks call replaceState constantly for scroll restoration, shallow query updates and prefetch bookkeeping, and counting those would be counting nothing.

A change of query string or fragment is therefore not a page view. Filtering a list twelve times is one page view, which is the number somebody reading a top-pages board wants.

On a server or in a desktop app there is no navigation to observe, so you call page(path) yourself and url.path is the only attribute filled in for you.

Attributes

AttributeTypeWhat it holds
url.fullstringThe whole URL, query string and fragment included.
url.pathstringThe path alone. What a breakdown by page groups on, because a query string turns one page into a thousand rows.
firstrun.referrerstringThe full referring URL. Absent when the browser sent none.
firstrun.referrer.hoststringThe referring host alone. Absent when there was no referrer.
firstrun.utm.sourcestringutm_source, read off the landing URL. Absent when the parameter is not there.
firstrun.utm.mediumstringutm_medium, same rule.
firstrun.utm.campaignstringutm_campaign, same rule.

Every entry also carries the resource its client sends once per batch: session.id, user.id once you have called user(), and the rest of the list on the overview. Anything you pass yourself lands in the same map, and your key wins on a collision.

What it never carries

No page title, no viewport size, no scroll position, and nothing about what the reader then did. How long they stayed is page_leave, and it is a separate entry.

firstrun.utm.term and firstrun.utm.content are conventional keys the tag does not read. Pass them yourself if your campaigns use them.

Questions it answers

A widget is a filter, a group by, an aggregate, a time bucket and a limit. These are those five parts written out, and every one of them is something you can build yourself.

QuestionThe query
Which pages are readName is page_view . group by url.path . count of entries . limit 20
Where people arrive fromName is page_view . group by firstrun.referrer.host . count of entries
Which campaign brought themName is page_view . group by firstrun.utm.campaign . count of uniques
Traffic over timeName is page_view . count of entries . bucket by day
Landing pages onlyName is page_view . firstrun.referrer.host is not set . group by url.path

See also