# Before send

Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fcoralogix.com%2Fdocs%2Fuser-guides%2Frum%2Fsdk-installation%2Fapple%2Fios%2Fconfiguration%2Fbefore-send.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%2Fapple%2Fios%2Fconfiguration%2Fbefore-send.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

### Before Send[​](#before-send "Direct link to Before Send")

Enable event access and modification before sending to Coralogix, supporting content modification.

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

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        beforeSend: { cxRum in

            var editableCxRum = cxRum

            if var sessionContext = editableCxRum["session_context"] as? [String: Any] {

                sessionContext["user_email"] = "john.doe@coralogix.com"

                editableCxRum["session_context"] = sessionContext

            }

            return editableCxRum

        })
```

, and event discarding

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

                                        environment: "ENVIRONMENT",

                                        application: "APP-NAME",

                                        version: "APP-VERSION",

                                        publicKey: "API-KEY",

                                        beforeSend: { cxRum in

            var editableCxRum = cxRum

            if var viewContext = editableCxRum["view_context"] as? [String: Any], 

                      let view = viewContext["view"] {

                if view == "DetailsViewController" {

                    return nil

                }

            }

        })
```

#### Masked interactions in `beforeSend` (`is_masked_element`)[​](#masked-interactions-in-beforesend-is_masked_element "Direct link to masked-interactions-in-beforesend-is_masked_element")

Every user-interaction event carries `interaction_context.is_masked_element` — the SDK's own observation that the interaction targeted content session replay masked. By default (matching the Browser SDK) only `target_element_inner_text` is redacted to `***` on a masked interaction; identity fields and coordinates are reported as-is, and the replay's tap marker is suppressed. Anything stricter is yours to express here, where it stays auditable in your own code.

The flag is always present. `false` also covers "could not resolve" — a hybrid payload with no coordinates (React Native scroll/swipe), or no frame geometry to test the point against (session replay not initialized) — so it under-reports rather than over-reports when the SDK has no answer.

Drop masked interaction events entirely:

```
beforeSend: { cxRum in

    let interaction = cxRum["interaction_context"] as? [String: Any]

    if interaction?["is_masked_element"] as? Bool == true {

        return nil

    }

    return cxRum

}
```

Or keep the event but blank the coordinates (they travel inside `interaction_context.attributes`):

```
beforeSend: { cxRum in

    var editable = cxRum

    if var interaction = editable["interaction_context"] as? [String: Any],

       interaction["is_masked_element"] as? Bool == true {

        var attributes = interaction["attributes"] as? [String: Any] ?? [:]

        attributes["x"] = 0

        attributes["y"] = 0

        interaction["attributes"] = attributes

        editable["interaction_context"] = interaction

    }

    return editable

}
```

`is_masked_element` itself is read-only: it records the SDK's observation, so a value written to it in the returned dictionary is ignored and the SDK's value is restored.
