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

Merged
merged 3 commits into from
Jul 15, 2025

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 HTML requests, and also explicitly
tracked page view requests when navigating the Ember app.

Within the past couple of years, we introduced the concept of
Browser Page Views (BPVs), which are recorded when requests are made
via AJAX when navigating the app with Ember, and also piggybacked
onto the first MessageBus request on page load. The former is known
as an explicitly tracked request, the latter is a deferred tracked request.

The explicitly tracked browser page views also add the X-Discourse-TrackView
header to the response, so it is hard to differentiate which requests are purely
browser page view requests in the 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 (both explicit
and deferred).

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.
@martin-brennan martin-brennan merged commit 33abb85 into main Jul 15, 2025
17 checks passed
@martin-brennan martin-brennan deleted the dev/add-bpv-header branch July 15, 2025 01:28
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