Skip to content

DEV: Add X-Discourse-BrowserPageView response header #33598

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

martin-brennan
Copy link
Contributor

@martin-brennan martin-brennan commented Jul 14, 2025

When we are tracking requests in the Middleware::RequestTracker, we
have historically added an X-Discourse-TrackView response header
for implicitly tracked requests, which are HTML requests.

Within the past couple of years, we introduced the concept of
Browser Page Views (BPVs), which are also known as explicitly tracked
requests, which are recorded when requests are made via AJAX.
These also add the X-Discourse-TrackView header to the response,
so it is hard to differentiate the two in logs.

This commit adds a new response header, X-Discourse-BrowserPageView,
that acts in a similar way to the existing X-Discourse-TrackView
header, but is specifically for requests that are tracked as BPVs.

AJAX call:

image

HTML page load:

image

When we are tracking requests in the `Middleware::RequestTracker`, we
have historically added an `X-Discourse-TrackView` response header
for implicitly tracked requests, which are HTML requests.

Within the past couple of years, we introduced the concept of
Browser Page Views (BPVs), which are also known as explicitly tracked
requests, which are recorded when requests are made via AJAX.
These also add the `X-Discourse-TrackView` header to the response,
so it is hard to differentiate the two in logs.

This commit adds a new response header, `X-Discourse-BrowserPageView`,
that acts in a similar way to the existing `X-Discourse-TrackView`
header, but is specifically for requests that are tracked as BPVs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants