# Network requests and traces

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Froku%2Ffeatures%2Fnetwork-requests.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Froku%2Ffeatures%2Fnetwork-requests.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

The SDK reports the HTTP requests your channel makes, and can carry a trace header into your own backends so their traces join the RUM session. This page covers both, and how to keep chosen URLs out of the data.

### Network requests[​](#network-requests "Direct link to Network requests")

Use `CxUrlTransfer` instead of `roUrlTransfer` in the Task that makes your requests. Its methods are the same, and the SDK reports every request with its method, URL, status code, duration and size.

Warning

Don't `callfunc` from the render thread into the Task that makes requests while a request is in flight. Each side waits for the other and the channel hangs.

1. Load it in the Task. A component can only call functions from scripts it loads itself, so this step is required. In the Task's XML:

   ```
   <script type="text/brightscript" uri="pkg:/source/roku_modules/coralogix_roku/instrumentations/network/CxUrlTransfer.brs" />
   ```

   Or, if the Task's code is in a BrighterScript (`.bs`) file, import it there:

   ```
   import "pkg:/source/roku_modules/coralogix_roku/instrumentations/network/CxUrlTransfer.brs"
   ```

2. Create it where you created `roUrlTransfer`:

   ```
   ut = coralogix_roku_CxUrlTransfer(m.global)

   ut.SetUrl("https://api.example.com/catalog")

   body = ut.GetToString()
   ```

3. For async requests, pass each `roUrlEvent` to `ReportEvent`:

   ```
   ut.SetMessagePort(port)

   ut.AsyncGetToString()



   msg = wait(0, port)

   if type(msg) = "roUrlEvent"

       ut.ReportEvent(msg)

   end if
   ```

To report a request made another way, call [`reportNetworkRequest`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#reportnetworkrequest):

```
m.global.cxRum.callfunc("reportNetworkRequest", {

    method: "GET", url: "https://api.example.com/catalog", statusCode: 200, durationMs: 184

})
```

Optional fields: `startTime` (epoch ms), `failureReason` and `responseContentLength` (bytes).

### Ignore URLs[​](#ignore-urls "Direct link to Ignore URLs")

`ignoreUrls` drops network requests whose URL matches. A string must equal the URL; a regular expression is written between slashes, with the flags `i`, `m`, `s` and `x`. Set it in [`coralogix_roku_initialize()`](https://coralogix.com/docs/user-guides/rum/sdk-installation/roku/features/api-reference.md#coralogix_roku_initialize), as with every option:

```
coralogix_roku_initialize({

    ' ...

    ignoreUrls: [

        "https://api.example.com/health",          ' this exact URL

        "/^https:\/\/analytics\.example\.com\//"   ' any URL on this host

    ]

}, screen.getGlobalNode())
```

### Traces[​](#traces "Direct link to Traces")

Add a W3C `traceparent` header to requests to your backends, so their traces join the RUM session. `allowedTracingUrls` takes strings and regular expressions, matched the same way as [`ignoreUrls`](#ignore-urls):

```
coralogix_roku_initialize({

    ' ...

    traceParentInHeader: {

        enabled: true,

        options: { allowedTracingUrls: ["/^https:\/\/api\.example\.com\//"] }

    }

}, screen.getGlobalNode())
```

The SDK adds the header to requests made with `CxUrlTransfer`. Without `allowedTracingUrls`, every such request gets it, including third parties, except URLs in `ignoreUrls`. If you set `traceparent` or `tracestate` yourself, the SDK leaves your headers as they are.
