---
title: Configuration options
description: CoralogixExporterOptions reference
url: https://coralogix.com/docs/user-guides/rum/sdk-installation/apple/ios/configuration/options/
product: rum
feature: iOS SDK
feature_id: mobile-sdk-ios
feature_identifier: rum/mobile-sdk-ios
last_updated: '2026-11-12'
---

# Configuration options

### CoralogixExporterOptions reference

The fields accepted by `CoralogixExporterOptions`. Each one is described in detail in the sections below.

| Property            | Type                                                                             | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Required |
| ------------------- | -------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| coralogixDomain     | CoralogixDomain                                                                  | The [Coralogix domain](https://coralogix.com/docs/user-guides/account-management/account-settings/coralogix-domain.md) for your account's region.                                                                                                                                                                                                                                                                                                                             | Yes      |
| publicKey           | String                                                                           | Coralogix token, the publicly-visible `public_key` value.                                                                                                                                                                                                                                                                                                                                                                                                                     | Yes      |
| environment         | String                                                                           | Specifies the environment, such as development, staging, or production.                                                                                                                                                                                                                                                                                                                                                                                                       | Yes      |
| application         | String                                                                           | Name of the application.                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Yes      |
| version             | String                                                                           | Version of the application.                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Yes      |
| userContext         | UserContext?                                                                     | Configuration for user context.                                                                                                                                                                                                                                                                                                                                                                                                                                               | No       |
| debug               | Bool                                                                             | Turns internal debug logging on or off.                                                                                                                                                                                                                                                                                                                                                                                                                                       | No       |
| ignoreUrls          | \[String]?                                                                       | URLs that partially match any regex in `ignoreUrls` are not traced.                                                                                                                                                                                                                                                                                                                                                                                                           | No       |
| ignoreErrors        | \[String]?                                                                       | Patterns for error messages that should not be sent to Coralogix.                                                                                                                                                                                                                                                                                                                                                                                                             | No       |
| labels              | \[String: Any]?                                                                  | Labels added to every span.                                                                                                                                                                                                                                                                                                                                                                                                                                                   | No       |
| beforeSend          | `(([String: Any]) -> [String: Any]?)?`                                           | Callback to inspect, modify, or discard each event before it reaches Coralogix. Receives the event as a dictionary; return `nil` to drop it.                                                                                                                                                                                                                                                                                                                                  | No       |
| tracesExporter      | `TracesExporterCallback?`, i.e. `((CoralogixTraceExporterData) throws -> Void)?` | Callback invoked for each exported span batch, for forwarding spans to your own collector.                                                                                                                                                                                                                                                                                                                                                                                    | No       |
| networkExtraConfig  | `[NetworkCaptureRule]?`                                                          | Per-URL rules for capturing request and response headers and payloads. Nothing is captured by default. Only allowlist URLs and header names you are comfortable logging, and note that bodies over 1024 characters are dropped rather than truncated. See "Swizzling and network capture" for the full rules.                                                                                                                                                                 | No       |
| proxyUrl            | String?                                                                          | Routes all RUM data through a proxy URL.                                                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
| traceParentInHeader | \[String: Any]?                                                                  | Configures W3C `traceparent` header propagation for distributed tracing.                                                                                                                                                                                                                                                                                                                                                                                                      | No       |
| collectIPData       | Bool                                                                             | Sends the client IP for region detection. Defaults to `true`.                                                                                                                                                                                                                                                                                                                                                                                                                 | No       |
| sessionSampleRate   | Int                                                                              | Percentage of overall sessions tracked, 0–100. Defaults to `100`.                                                                                                                                                                                                                                                                                                                                                                                                             | No       |
| excludeFromSampling | `Set<ExcludableInstrumentation>`                                                 | Instrumentations that bypass the `sessionSampleRate` gate, so their events are sent even from sessions that are not sampled in. Accepts `errors`, `logs`, `network`, `userInteractions`, `mobileVitals`, `customSpan`, `customMeasurement`, `navigation` and `lifecycle`. Defaults to empty.                                                                                                                                                                                  | No       |
| enableSwizzling     | Bool                                                                             | Method swizzling for `URLSession` instrumentation. Defaults to `true`.                                                                                                                                                                                                                                                                                                                                                                                                        | No       |
| instrumentations    | `[InstrumentationType: Bool]?`                                                   | Switches individual instrumentations off. All are active by default. Read once while the SDK initializes, so a later change takes effect only after `shutdown()` and a fresh `CoralogixRum(options:)`.                                                                                                                                                                                                                                                                        | No       |
| mobileVitals        | `[MobileVitalsType: Bool]?`                                                      | Switches individual mobile vitals detectors off. All are active by default. Read at initialization only, the same as `instrumentations`.                                                                                                                                                                                                                                                                                                                                      | No       |
| shouldSendText      | `((UIView, String) -> Bool)?`                                                    | Called before recording tapped text. Return `false` to redact it: the field is still sent, carrying `***` instead of the text. Taps on a deliberately masked view (`cxMask`, SwiftUI `.cxMask()`), inside a masked subtree, or on a field carrying sensitive traits are redacted without consulting this closure. Text masked only by the replay's pixel policy (`maskText`, `maskAllImages`) still reaches it, so use this closure for anything you need kept out of events. | No       |
| resolveTargetName   | `((UIView) -> String?)?`                                                         | Returns a human-readable name for a tapped view, used as `target_element`. Return `nil` to fall back to the class name. Runs on the main thread on every tap, so keep it fast.                                                                                                                                                                                                                                                                                                | No       |

### Instrumentations

Turn on/off specific instrumentation, default to true. Each instrumentation is responsible for which data the SDK will track and collect for you.

```
 let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                           environment: "ENVIRONMENT",

                                           application: "APP-NAME",

                                           version: "APP-VERSION",

                                           publicKey: "API-KEY",

                                           instrumentations: [.mobileVitals: true,

                                                              .custom: true,

                                                              .errors: true,

                                                              .network: true,

                                                              .userActions: false,

                                                              .anr: true,

                                                              .lifeCycle: false])
```

### Ignore errors

The ignoreErrors option allows you to exclude errors that meet specific criteria. Each pattern is compared with the event's error message and its error type, as an exact string or as a case-insensitive regular expression that can match part of the text. Every pattern is tried, so `SIGSEGV` drops segmentation-fault crashes and `ANR` drops ANR events.

```
 let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        ignoreErrors: []) //[".*errorcode=.*", "Im cusom Error"]
```

### Ignore URLs

The ignoreUrls option allows you to exclude network requests that meet specific criteria. This options accepts a set of strings and regular expressions to match against the event's network url. Use regular expressions for exact matching as strings remove partial matches.

```
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        ignoreUrls: []) //[".*\\.il$","https://www.coralogix.com/academy"])
```

### Label providers

Provide labels based on url or event

```
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        labels: ["item" : "item_number_5", "itemPrice" : 1000]) 
```

### CollectIPData

Determines whether the SDK should collect the user's IP address and corresponding geolocation data. Defaults to true.

```
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        collectIPData: true)
```

### Sample rate

Number between 0 and 100 as a percentage of sessions that report the full event stream.

A sampled-out session still starts. Network instrumentation stays installed so outgoing requests keep carrying `traceparent` and your backend traces stay correlated across the whole population; the events that would otherwise be reported are dropped before they leave the device. Session recording follows the same decision: a session that is not sampled in records no frames, and recording resumes with the next session that is sampled in. `excludeFromSampling` does not apply to session recording.

```
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        sessionSampleRate: 100)
```

### Excluding instrumentations from session sampling

Opt specific event categories out of the `sessionSampleRate` gate so they keep exporting from sessions that are otherwise sampled out. Useful when you want a low session sample rate for general telemetry but still need every log and error captured.

This option only ever *relaxes* the sampling decision, so it does nothing on a session that is already sampled in — and it never overrides `instrumentations`. If you switch an instrumentation off there and also list it here, it stays off.

In the example below, only 10% of sessions are sampled in for the full event stream; the remaining 90% of sessions still export `.logs` and `.errors`, but every other category is dropped.

```
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        sessionSampleRate: 10,

                                        excludeFromSampling: [.logs, .errors])
```

Accepted `ExcludableInstrumentation` cases:

* `.errors`
* `.logs`
* `.network`
* `.userInteractions`
* `.mobileVitals`
* `.customSpan`
* `.customMeasurement`
* `.navigation` (2.21.0 and later)
* `.lifecycle` (2.21.0 and later)

The default is an empty set: a sampled-out session then reports nothing, while still propagating trace context. Once you list any category, the SDK's own initialization events are reported alongside it.

Parity note: the Coralogix Browser SDK exposes the same option with matching semantics.

#### Network instrumentation and trace propagation

Network is the one instrumentation with three states rather than two: off, propagate-only, and fully reported. The header and the event are independent *while the instrumentation is enabled* — sampling can silence the event without silencing the header:

| Configuration                                                                          | Header               | `network-request` event |
| -------------------------------------------------------------------------------------- | -------------------- | ----------------------- |
| Session sampled in, network enabled                                                    | injected, flags `01` | reported                |
| `instrumentations: [.network: false]` — any session                                    | **not injected**     | not reported            |
| Session sampled out, `.network` not excluded                                           | injected, flags `00` | not reported            |
| Session sampled out, `excludeFromSampling: [.network]`, `traceParentInHeader` enabled  | injected, flags `01` | reported                |
| Session sampled out, `excludeFromSampling: [.network]`, `traceParentInHeader` disabled | not injected         | reported                |

The last byte of the `traceparent` header is the W3C sampled flag. From 2.21.0 it carries the session's sampling decision for that request: `00` when the session is sampled out and the request is only propagating trace context, `01` otherwise. Before 2.21.0 every request carried `01`, so a backend that honours the flag had no way to tell a propagate-only request apart from a reported one.

The flag reflects sampling alone, so `01` is not a guarantee that the event arrives. These still drop a reported event after the header has gone out, and all of them leave the flag at `01`:

* an event your `beforeSend` callback returns `nil` for
* a request your app sends while the session is idle, which it becomes after 15 minutes without activity

Note

On Flutter the `traceparent` header is injected from Dart rather than by this SDK, and an existing header wins, so it currently always carries `01`. React Native on iOS does not inject its own header — this SDK instruments the request, so the flag behaves as described above.

`instrumentations[.network]` is the outer gate: switching it off removes network instrumentation entirely, header included, and neither `traceParentInHeader` nor `excludeFromSampling` brings any of it back. Sampling is deliberately weaker than that — a session that is merely sampled out keeps injecting the header so your backend traces stay correlated, while reporting no events.

`enableSwizzling: false` overrides all of the above — with swizzling off the SDK never touches `NSURLSession`, so there is no header and no native network event.

#### Telling excluded events apart in `beforeSend`

Every event carries `session_context.isSessionSampledIn` (read-only). `false` means the event reached export only because its category is listed in `excludeFromSampling` — the session itself was sampled out. Use it in `beforeSend` to apply your own filtering on top of the exclude list, e.g. keep only crashes and ANRs from sampled-out sessions:

```
beforeSend: { cxRum in

    let session = cxRum["session_context"] as? [String: Any]

    let sampledIn = session?["isSessionSampledIn"] as? Bool ?? true

    let severity = (cxRum["event_context"] as? [String: Any])?["severity"] as? Int



    // Session sampled out: forward only error-severity events, drop the rest.

    if !sampledIn && severity != 5 {

        return nil

    }

    return cxRum

}
```

### Trace exporter

Forward span data to your own collector or backend by configuring a trace exporter callback. The callback receives each batch on its way out, in OTLP-compatible shape, and spans continue to flow to Coralogix when it is set.

Two things to know about where it sits in the pipeline: the batch has already been filtered, sampled and de-duplicated, so this is not a stream of every span produced; and it runs before `beforeSend`, so anything `beforeSend` would redact or drop is still present here. Sanitize attributes yourself before forwarding.

```
let options = CoralogixExporterOptions(coralogixDomain: CORALOGIX-DOMAIN,

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        tracesExporter: { data in

                                            // data.tracesData.resourceSpans[].scopeSpans[].spans[]

                                            // data.jsonString — JSON-encoded OTLP payload, nil if encoding fails

                                            if let json = data.jsonString {

                                                // Hand the work to your own queue: this callback runs on the

                                                // export path, so blocking here delays the batches behind it.

                                                DispatchQueue.global(qos: .utility).async {

                                                    forwardToCustomCollector(json)

                                                }

                                            }

                                        })
```
