---
title: "HttpContext"
description: "Attaches the page URL and the user agent and referrer headers to the event. (default)"
url: https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/httpcontext/
---

# HttpContext for React Router Framework

This integration only works inside a browser environment.

*Import name: `Sentry.httpContextIntegration`*

This integration is enabled by default. If you'd like to modify your default integrations, read [this](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations.md#modifying-default-integrations).

This integration attaches the current page URL and the `User-Agent` and `Referer` headers to events and spans. Sentry uses the `User-Agent` header to tag events with browser, OS, and device information.

```JavaScript
Sentry.init({
  integrations: [Sentry.httpContextIntegration()],
});
```

## [Data Collection](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/integrations/httpcontext.md#data-collection)

This integration respects the [`dataCollection`](https://docs.sentry.io/platforms/javascript/guides/react-router/configuration/options.md#dataCollection) option in your root `Sentry.init` config:

* `dataCollection.httpHeaders.request` controls the `User-Agent` and `Referer` headers. If you disable request header collection, the SDK doesn't send these headers, and events won't include the browser, OS, and device information derived from `User-Agent`.
* `dataCollection.urlQueryParams` controls the query parameters in the page URL and the referrer.
