> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flashduty.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Collection

> Learn about the data types, event attributes, performance metrics, and data storage mechanisms collected by Web RUM SDK

<Info>
  Web RUM SDK automatically collects rich user behavior and performance data. Each RUM event includes default attributes (such as `view.url`, `device.type`, `geo.country`) as well as additional metrics and attributes specific to each event type.
</Info>

## Default Attributes

Web RUM SDK automatically captures the following default attributes, applicable to all RUM event types.

<AccordionGroup>
  <Accordion title="Core Attributes">
    | Attribute        | Type    | Description                                                         |
    | ---------------- | ------- | ------------------------------------------------------------------- |
    | `date`           | Integer | Event timestamp (in milliseconds, epoch milliseconds)               |
    | `type`           | String  | Event type (e.g., `session`, `view`, `resource`, `error`, `action`) |
    | `application.id` | String  | Application unique identifier                                       |
    | `service`        | String  | Service name that generated this event                              |
    | `env`            | String  | Application environment name (e.g., `prod`, `dev`, `staging`)       |
    | `version`        | String  | Application version                                                 |
    | `sdk_version`    | String  | RUM SDK version                                                     |
  </Accordion>

  <Accordion title="Device Attributes">
    | Attribute      | Type   | Description                                                      |
    | -------------- | ------ | ---------------------------------------------------------------- |
    | `device.type`  | String | Device type (e.g., `Desktop`, `Mobile`, `Tablet`, `TV`, `Other`) |
    | `device.brand` | String | Device brand (e.g., `Apple`, `Samsung`, `Huawei`)                |
    | `device.model` | String | Device model (e.g., `iPhone`, `iPad`)                            |
    | `device.name`  | String | Device commercial name                                           |
  </Accordion>

  <Accordion title="Operating System Attributes">
    | Attribute          | Type   | Description                                              |
    | ------------------ | ------ | -------------------------------------------------------- |
    | `os.name`          | String | Operating system name (e.g., `Mac OS`, `Windows`, `iOS`) |
    | `os.version`       | String | Operating system version (e.g., `10.15.7`, `11.0`)       |
    | `os.version_major` | String | Operating system major version (e.g., `10`, `11`)        |
  </Accordion>

  <Accordion title="Browser Attributes">
    | Attribute                 | Type   | Description                                                |
    | ------------------------- | ------ | ---------------------------------------------------------- |
    | `browser.name`            | String | Browser name (e.g., `Chrome`, `Firefox`, `Safari`, `Edge`) |
    | `browser.version`         | String | Browser version (e.g., `91.0.4472.124`)                    |
    | `browser.version_major`   | String | Browser major version (e.g., `91`)                         |
    | `browser.user_agent`      | String | User Agent string                                          |
    | `browser.viewport.width`  | Number | Browser viewport width (pixels)                            |
    | `browser.viewport.height` | Number | Browser viewport height (pixels)                           |
  </Accordion>

  <Accordion title="Geo-location Attributes">
    | Attribute                 | Type   | Description                                                            |
    | ------------------------- | ------ | ---------------------------------------------------------------------- |
    | `geo.country`             | String | Country name                                                           |
    | `geo.country_iso_code`    | String | Country ISO code (e.g., `US`, `CN`)                                    |
    | `geo.country_subdivision` | String | First-level administrative division (e.g., US states, China provinces) |
    | `geo.continent_code`      | String | Continent ISO code (e.g., `EU`, `AS`, `NA`)                            |
    | `geo.continent`           | String | Continent name                                                         |
    | `geo.city`                | String | City name                                                              |

    <Note>
      Geo-location information is inferred by FlashCat backend based on client IP address. Precise GPS location is not collected on the client.
    </Note>
  </Accordion>

  <Accordion title="User Attributes">
    | Attribute   | Type   | Description                                         |
    | ----------- | ------ | --------------------------------------------------- |
    | `usr.id`    | String | User unique identifier                              |
    | `usr.name`  | String | User-friendly name, displayed by default in RUM UI  |
    | `usr.email` | String | User email address. Displayed if no username is set |

    <Tip>
      You can also add custom user attributes such as `usr.plan`, `usr.role`, etc. To set user information, see [SDK Integration Guide](/en/rum/sdk/web/sdk-integration#custom-user-identification).
    </Tip>
  </Accordion>
</AccordionGroup>

## Event-Specific Attributes

Different event types have specific attributes and metrics.

<AccordionGroup>
  <Accordion title="Session Attributes">
    | Attribute                   | Type    | Description                              |
    | --------------------------- | ------- | ---------------------------------------- |
    | `session.id`                | String  | Session unique identifier                |
    | `session.type`              | String  | Session type (e.g., `user`, `synthetic`) |
    | `session.is_active`         | Boolean | Whether session is active                |
    | `session.initial_view.id`   | String  | Initial view ID in session               |
    | `session.initial_view.url`  | String  | Initial view URL in session              |
    | `session.initial_view.name` | String  | Initial view name in session             |
    | `session.last_view.id`      | String  | Last view ID in session                  |
    | `session.last_view.url`     | String  | Last view URL in session                 |
    | `session.last_view.name`    | String  | Last view name in session                |
    | `session.has_replay`        | Boolean | Whether session has replay enabled       |
  </Accordion>

  <Accordion title="View Timing Metrics">
    RUM collects all performance metrics from the [Navigation Timing API](https://www.w3.org/TR/navigation-timing/) as well as metrics related to [Core Web Vitals](https://web.dev/vitals/).

    **Core Web Vitals**

    | Attribute                        | Type        | Description                                                                                    |
    | -------------------------------- | ----------- | ---------------------------------------------------------------------------------------------- |
    | `view.largest_contentful_paint`  | Number (ns) | Largest Contentful Paint (LCP), render time of the largest visible content element in viewport |
    | `view.first_input_delay`         | Number (ns) | First Input Delay (FID), time from user's first interaction to browser's actual response       |
    | `view.cumulative_layout_shift`   | Number      | Cumulative Layout Shift (CLS), quantifies unexpected movement of visible elements in viewport  |
    | `view.interaction_to_next_paint` | Number (ns) | Interaction to Next Paint (INP), measures latency of all user interactions with the page       |

    **Navigation Performance Metrics**

    | Attribute                     | Type        | Description                                                                                                     |
    | ----------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------- |
    | `view.time_spent`             | Number (ns) | Time user spent on this view                                                                                    |
    | `view.loading_time`           | Number (ns) | Time for page to fully load (triggered at `loadEventEnd`)                                                       |
    | `view.first_contentful_paint` | Number (ns) | First Contentful Paint (FCP), time when browser first renders any text, image, non-blank canvas or SVG          |
    | `view.first_byte`             | Number (ns) | Time to First Byte (TTFB), time from user initiating page load to browser receiving first byte of HTML document |
    | `view.dom_interactive`        | Number (ns) | Time when parser finished working on main document (`domInteractive`)                                           |
    | `view.dom_content_loaded`     | Number (ns) | Time when initial HTML document is fully loaded and parsed                                                      |
    | `view.dom_complete`           | Number (ns) | Time when page and all sub-resources are ready (`domComplete`)                                                  |
    | `view.load_event`             | Number (ns) | Time when load event fired (`loadEventEnd`), indicating page fully loaded                                       |

    **Network Timing Metrics**

    | Attribute                             | Type        | Description                               |
    | ------------------------------------- | ----------- | ----------------------------------------- |
    | `view.redirect.duration`              | Number (ns) | Time spent on redirects                   |
    | `view.dns.duration`                   | Number (ns) | Time spent on DNS lookup                  |
    | `view.connect.duration`               | Number (ns) | Time spent establishing server connection |
    | `view.ssl.duration`                   | Number (ns) | Time spent on TLS handshake               |
    | `view.request.duration`               | Number (ns) | Time spent requesting HTML document       |
    | `view.response.duration`              | Number (ns) | Time spent downloading HTML document      |
    | `view.in_foreground_periods.count`    | Number      | Number of times view was in foreground    |
    | `view.in_foreground_periods.duration` | Number (ns) | Total time view was in foreground         |
  </Accordion>

  <Accordion title="View Attributes">
    | Attribute              | Type    | Description                                   |
    | ---------------------- | ------- | --------------------------------------------- |
    | `view.id`              | String  | View unique identifier                        |
    | `view.url`             | String  | View URL                                      |
    | `view.name`            | String  | Customizable view name                        |
    | `view.referrer`        | String  | Previous page URL (referrer)                  |
    | `view.action.count`    | Number  | Number of user actions collected in this view |
    | `view.error.count`     | Number  | Number of errors collected in this view       |
    | `view.resource.count`  | Number  | Number of resources collected in this view    |
    | `view.long_task.count` | Number  | Number of long tasks collected in this view   |
    | `view.is_active`       | Boolean | Whether view is active                        |
  </Accordion>

  <Accordion title="Resource Timing Metrics">
    RUM collects detailed network timing information from the [Resource Timing API](https://www.w3.org/TR/resource-timing-2/) for individual resource loading.

    | Attribute                         | Type           | Description                                                  |
    | --------------------------------- | -------------- | ------------------------------------------------------------ |
    | `resource.duration`               | Number (ns)    | Total time to load resource                                  |
    | `resource.size`                   | Number (bytes) | Resource size                                                |
    | `resource.connect.duration`       | Number (ns)    | Time to establish server connection                          |
    | `resource.ssl.duration`           | Number (ns)    | Time for TLS handshake (HTTPS only)                          |
    | `resource.dns.duration`           | Number (ns)    | Time for DNS resolution                                      |
    | `resource.redirect.duration`      | Number (ns)    | Time for redirects                                           |
    | `resource.first_byte.duration`    | Number (ns)    | Time waiting to receive first byte of response               |
    | `resource.download.duration`      | Number (ns)    | Time to download response                                    |
    | `resource.render_blocking_status` | String         | Resource render blocking status (`blocking`, `non-blocking`) |
    | `resource.first_party`            | Boolean        | Whether resource is first-party (same domain as application) |
  </Accordion>

  <Accordion title="Resource Attributes">
    | Attribute                  | Type   | Description                                                                      |
    | -------------------------- | ------ | -------------------------------------------------------------------------------- |
    | `resource.id`              | String | Resource unique identifier                                                       |
    | `resource.type`            | String | Resource type (e.g., `xhr`, `fetch`, `css`, `js`, `image`, `font`, `media`)      |
    | `resource.method`          | String | HTTP method (e.g., `GET`, `POST`, `PUT`, `DELETE`)                               |
    | `resource.status_code`     | Number | HTTP response status code                                                        |
    | `resource.url`             | String | Resource URL                                                                     |
    | `resource.url_host`        | String | URL host part                                                                    |
    | `resource.url_path`        | String | URL path part                                                                    |
    | `resource.url_query`       | Object | URL query parameters, parsed as key-value pairs                                  |
    | `resource.url_scheme`      | String | URL scheme (e.g., `https`, `http`)                                               |
    | `resource.provider.name`   | String | Resource provider name, defaults to `unknown`                                    |
    | `resource.provider.domain` | String | Resource provider domain                                                         |
    | `resource.provider.type`   | String | Resource provider type (e.g., `first-party`, `cdn`, `ad`, `analytics`, `social`) |
  </Accordion>

  <Accordion title="GraphQL Attributes">
    If GraphQL request tracking is enabled, the following attributes are attached to `resource` events:

    | Attribute                         | Type   | Description                                                                                          |
    | --------------------------------- | ------ | ---------------------------------------------------------------------------------------------------- |
    | `resource.graphql.operation_type` | String | GraphQL operation type (`query`, `mutation`, `subscription`)                                         |
    | `resource.graphql.operation_name` | String | GraphQL operation name (if provided in request)                                                      |
    | `resource.graphql.variables`      | String | GraphQL variables sent with request                                                                  |
    | `resource.graphql.payload`        | String | GraphQL query (limited to 32 KB, only available when `trackPayload` is enabled)                      |
    | `resource.graphql.errors_count`   | Number | Number of errors returned in GraphQL response (only available when `trackResponseErrors` is enabled) |
    | `resource.graphql.errors`         | Array  | GraphQL errors array, containing message, code, locations and path                                   |
  </Accordion>

  <Accordion title="Long Task Attributes">
    Long tasks are tasks that block the main thread for 50 milliseconds or longer. These tasks cause high input delay, slow interactions, or janky animations/scrolling.

    | Attribute                   | Type        | Description                                          |
    | --------------------------- | ----------- | ---------------------------------------------------- |
    | `long_task.duration`        | Number (ns) | Long task duration                                   |
    | `long_task.is_frozen_frame` | Boolean     | Whether it's a frozen frame (duration exceeds 700ms) |

    <Warning>
      Long task detection is only available in browsers that support the Long Tasks API (Chrome, Edge). Safari and Firefox don't support this feature.
    </Warning>
  </Accordion>

  <Accordion title="Error Attributes">
    Frontend errors are collected via RUM. Error messages and stack traces (if available) are included.

    **General Error Attributes**

    | Attribute              | Type   | Description                                                                                           |
    | ---------------------- | ------ | ----------------------------------------------------------------------------------------------------- |
    | `error.id`             | String | Error unique identifier                                                                               |
    | `error.source`         | String | Error source (e.g., `console`, `network`, `source`, `logger`, `agent`, `webview`, `custom`, `report`) |
    | `error.type`           | String | Error type (in some cases, error code)                                                                |
    | `error.message`        | String | Concise, human-readable one-line error message                                                        |
    | `error.stack`          | String | Error stack trace or supplementary information                                                        |
    | `error.issue_id`       | String | Error issue unique identifier (same errors are grouped into the same issue)                           |
    | `error.fingerprint`    | String | Fingerprint for uniquely identifying the error                                                        |
    | `error.handling`       | String | Error handling method (`handled`, `unhandled`)                                                        |
    | `error.handling_stack` | String | Stack trace when error was handled                                                                    |
    | `error.causes`         | Array  | Information about other errors that caused this error                                                 |

    **Network Error Attributes**

    Network errors contain information about failed HTTP requests:

    | Attribute                        | Type   | Description                                                            |
    | -------------------------------- | ------ | ---------------------------------------------------------------------- |
    | `error.resource.status_code`     | Number | HTTP response status code                                              |
    | `error.resource.method`          | String | HTTP method (e.g., `GET`, `POST`)                                      |
    | `error.resource.url`             | String | Resource URL                                                           |
    | `error.resource.url_host`        | String | URL host part                                                          |
    | `error.resource.url_path`        | String | URL path part                                                          |
    | `error.resource.url_scheme`      | String | URL scheme                                                             |
    | `error.resource.provider.name`   | String | Resource provider name, defaults to `unknown`                          |
    | `error.resource.provider.domain` | String | Resource provider domain                                               |
    | `error.resource.provider.type`   | String | Resource provider type (e.g., `first-party`, `cdn`, `ad`, `analytics`) |

    <Tip>
      For more information about different JavaScript error types, see [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error).
    </Tip>
  </Accordion>

  <Accordion title="Action Attributes">
    **Action Timing Attributes**

    | Attribute                | Type        | Description                                   |
    | ------------------------ | ----------- | --------------------------------------------- |
    | `action.loading_time`    | Number (ns) | Action loading time                           |
    | `action.long_task.count` | Number      | Number of long tasks triggered by this action |
    | `action.resource.count`  | Number      | Number of resources triggered by this action  |
    | `action.error.count`     | Number      | Number of errors triggered by this action     |

    **Action Identification Attributes**

    | Attribute            | Type   | Description                                                                                                 |
    | -------------------- | ------ | ----------------------------------------------------------------------------------------------------------- |
    | `action.id`          | String | User action unique identifier (UUID)                                                                        |
    | `action.type`        | String | User action type (e.g., `click`, `custom`). Set to `custom` for custom user actions                         |
    | `action.target.name` | String | Element user interacted with. Only for auto-collected actions                                               |
    | `action.name`        | String | User-friendly name (e.g., `Click on #checkout`). For custom user actions, the action name given in API call |
  </Accordion>

  <Accordion title="Frustration Signals">
    RUM automatically detects user frustration signals, helping you understand problems users encounter in your application.

    | Attribute                             | Type   | Description                                                     |
    | ------------------------------------- | ------ | --------------------------------------------------------------- |
    | `session.frustration.count`           | Number | Total frustration signals in session                            |
    | `view.frustration.count`              | Number | Total frustration signals in view                               |
    | `action.frustration.type:dead_click`  | String | Dead click detected by RUM SDK (click with no response)         |
    | `action.frustration.type:rage_click`  | String | Rage click detected by RUM SDK (rapid consecutive clicks)       |
    | `action.frustration.type:error_click` | String | Error click detected by RUM SDK (click that triggered an error) |

    <Info>
      Frustration signals are important indicators for identifying user experience issues. Dead clicks and rage clicks typically indicate UI response delays or interaction design problems.
    </Info>
  </Accordion>

  <Accordion title="UTM Attributes">
    If the URL contains UTM parameters, RUM automatically captures the following attributes for tracking marketing campaigns:

    | Attribute                     | Type   | Description                                                                     |
    | ----------------------------- | ------ | ------------------------------------------------------------------------------- |
    | `view.url_query.utm_source`   | String | URL parameter tracking traffic source                                           |
    | `view.url_query.utm_medium`   | String | URL parameter tracking which channel traffic came from                          |
    | `view.url_query.utm_campaign` | String | URL parameter identifying specific marketing campaign associated with this view |
    | `view.url_query.utm_content`  | String | URL parameter identifying specific element user clicked in marketing campaign   |
    | `view.url_query.utm_term`     | String | URL parameter tracking keyword user searched to trigger given campaign          |
  </Accordion>
</AccordionGroup>

## Data Storage

Before uploading to FlashCat, data is temporarily stored in plaintext in the browser's local storage (LocalStorage or SessionStorage).

<Steps>
  <Step title="Data Collection">
    SDK adds events to an in-memory batch buffer.
  </Step>

  <Step title="Local Caching">
    When network is unavailable, batches are retained in local storage.
  </Step>

  <Step title="Batch Upload">
    When network is available, data is sent to server in batches.
  </Step>

  <Step title="Auto Cleanup">
    Data exceeding certain time limits is automatically cleaned up to avoid excessive storage usage.
  </Step>
</Steps>

<Warning>
  Sensitive data should not be included in RUM events, or should be obfuscated or filtered via the `beforeSend` callback before sending.
</Warning>

## Data Upload

Web RUM SDK uploads collected events to the server in batches to optimize network performance and reduce impact on user experience.

### Batch Upload Triggers

* Event count in batch reaches threshold
* Batch size reaches threshold
* Periodic upload (e.g., every 10 seconds)
* Page unload (`beforeunload` event)

### Upload Strategy

| Strategy               | Description                                                                 |
| ---------------------- | --------------------------------------------------------------------------- |
| **Beacon API**         | Preferred, ensures data isn't lost when page unloads                        |
| **XHR/Fetch Fallback** | If Beacon API unavailable, uses XMLHttpRequest or Fetch API                 |
| **Failure Retry**      | If upload fails, batch is retained in local storage until successfully sent |
| **Data Compression**   | Batch data is compressed before upload to reduce network traffic            |

## Privacy and Compliance

<CardGroup cols={2}>
  <Card title="IP Address Anonymization" icon="eye-slash">
    SDK can be configured to anonymize IP addresses
  </Card>

  <Card title="Sensitive Data Filtering" icon="filter">
    Use `beforeSend` callback to filter or obfuscate sensitive information
  </Card>

  <Card title="Cookie and Storage Control" icon="cookie">
    Configurable whether to use cookies and local storage
  </Card>

  <Card title="GDPR/CCPA Compliance" icon="shield-check">
    Supports user privacy opt-out mechanism
  </Card>
</CardGroup>

<Tip>
  For detailed privacy configuration information, see [Advanced Configuration](/en/rum/sdk/web/advanced-config#user-tracking-consent).
</Tip>

## More Information

<CardGroup cols={3}>
  <Card title="SDK Integration" icon="plug" href="/en/rum/sdk/web/sdk-integration">
    Learn how to integrate RUM SDK in Web applications
  </Card>

  <Card title="Advanced Configuration" icon="sliders" href="/en/rum/sdk/web/advanced-config">
    Learn how to configure advanced SDK features
  </Card>

  <Card title="Compatibility" icon="browser" href="/en/rum/sdk/web/compatible">
    Learn about SDK browser and framework compatibility
  </Card>
</CardGroup>
