This component implements the data collection protocol between Edgee and Segment.
- Download the latest component version from our releases page
- Place the
segment.wasmfile in your server (e.g.,/var/edgee/components) - Add the following configuration to your
edgee.toml:
[[components.data_collection]]
id = "segment"
file = "/var/edgee/components/segment.wasm"
settings.segment_api_key = "..."The component maps Edgee events to Segment events as follows:
| Edgee Event | Segment Event | Description |
|---|---|---|
| Page | page |
Triggered when a user views a page |
| Track | track |
Uses the provided event name directly |
| User | identify |
Used for user identification only |
Each time you make a user call, Edgee will send an identify event to Segment.
But when you make a user call using Edgee's JS library or Data Layer, the user_id, anonymous_id and properties are stored in the user's device.
This allows the user's data to be added to any subsequent page or follow-up calls for the user, so that you can correctly attribute these actions.
[[components.data_collection]]
id = "segment"
file = "/var/edgee/components/segment.wasm"
settings.segment_api_key = "..."
# Optional configurations
settings.edgee_anonymization = true # Enable/disable data anonymization in case of pending or denied consent
settings.edgee_default_consent = "pending" # Set default consent status if not specified by the userControl which events are forwarded to Segment:
settings.edgee_page_event_enabled = true # Enable/disable page event
settings.edgee_track_event_enabled = true # Enable/disable track event
settings.edgee_user_event_enabled = true # Enable/disable user eventBefore sending events to Segment, you can set the user consent using the Edgee SDK:
edgee.consent("granted");Or using the Data Layer:
<script id="__EDGEE_DATA_LAYER__" type="application/json">
{
"data_collection": {
"consent": "granted"
}
}
</script>If the consent is not set, the component will use the default consent status.
| Consent | Anonymization |
|---|---|
| pending | true |
| denied | true |
| granted | false |
Prerequisites:
- Rust
- WASM target:
rustup target add wasm32-wasip2 - wit-deps:
cargo install wit-deps
Build command:
make wit-deps
make buildInterested in contributing? Read our contribution guidelines
Report security vulnerabilities to security@edgee.cloud