Skip to content

Commit 6073c85

Browse files
authored
feat(develop): Add page context (#13203)
This adds a new context to develop docs: The new `page` context should be used to add information about the current page that an event originated on. It should be used for web-based client SDKs instead of putting this information into `event.request`. Relay will need to extract data from this (if available) instead of `event.request`.
1 parent 3304f54 commit 6073c85

File tree

2 files changed

+46
-4
lines changed

2 files changed

+46
-4
lines changed

develop-docs/sdk/data-model/event-payloads/contexts.mdx

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -748,6 +748,49 @@ envelope endpoint.
748748
}
749749
```
750750

751+
## Page Context
752+
753+
Page context contains information about the page that the event occurred on.
754+
755+
`url`
756+
757+
: **Required.** The URL of the page that the event occurred on, excluding query parameters & fragment.
758+
759+
- Example: `https://sentry.io/issues`
760+
761+
`http.query`
762+
763+
: **Optional.** The query parameters of the page that the event occurred on.
764+
765+
- Example: `?page=1`
766+
767+
`http.fragment`
768+
769+
: **Optional.** The fragment of the page that the event occurred on.
770+
771+
- Example: `#123`
772+
773+
`referer`
774+
775+
: _Optional_. The referer of the page that the event occurred on.
776+
777+
- Example: `https://sentry.io/`
778+
779+
**Example Page Context**
780+
781+
```json
782+
{
783+
"contexts": {
784+
"page": {
785+
"url": "https://sentry.io/issues",
786+
"http.query": "?page=1",
787+
"http.fragment": "#123",
788+
"referer": "https://sentry.io/"
789+
}
790+
}
791+
}
792+
```
793+
751794
## Response Context
752795

753796
Response context contains information about the HTTP response associated with the event.
@@ -799,7 +842,7 @@ The required field is `package` which should contain the package or framework wh
799842
"contexts": {
800843
"missing_instrumentation": {
801844
"package": "express",
802-
"javascript.is_cjs": true,
845+
"javascript.is_cjs": true
803846
}
804847
}
805848
}

develop-docs/sdk/data-model/event-payloads/request.mdx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@ sidebar_order: 8
44
---
55

66
The Request interface contains information on a HTTP request related to the
7-
event. In client SDKs, this can be an outgoing request, or the request that
8-
rendered the current web page. On server SDKs, this could be the incoming web
9-
request that is being handled.
7+
event. In client SDKs, this can be an outgoing request (use the [page context](../contexts/#page-context) to track the page that the request was made from).
8+
On server SDKs, this could be the incoming web request that is being handled.
109

1110
The data variable should only contain the request body (not the query string).
1211
It can either be a dictionary (for standard HTTP requests) or a raw request

0 commit comments

Comments
 (0)