https://github.com/edgee-cloud/amplitude-component
Amplitude Edgee Component
https://github.com/edgee-cloud/amplitude-component
amplitude component edge-computing edgee rust wasm wasm-component
Last synced: 26 days ago
JSON representation
Amplitude Edgee Component
- Host: GitHub
- URL: https://github.com/edgee-cloud/amplitude-component
- Owner: edgee-cloud
- License: apache-2.0
- Created: 2024-07-12T06:04:30.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-03-12T16:13:18.000Z (2 months ago)
- Last Synced: 2025-03-29T16:41:23.875Z (about 2 months ago)
- Topics: amplitude, component, edge-computing, edgee, rust, wasm, wasm-component
- Language: Rust
- Homepage: https://www.edgee.cloud
- Size: 135 KB
- Stars: 2
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
Amplitude Component for Edgee
[](https://coveralls.io/github/edgee-cloud/amplitude-component)
[](https://github.com/edgee-cloud/amplitude-component/issues)
[](https://www.edgee.cloud/edgee/amplitude)This component enables seamless integration between [Edgee](https://www.edgee.cloud) and [Amplitude](https://amplitude.com), allowing you to collect and forward analytics data while respecting user privacy settings.
## Quick Start
1. Download the latest component version from our [releases page](../../releases)
2. Place the `amplitude.wasm` file in your server (e.g., `/var/edgee/components`)
3. Add the following configuration to your `edgee.toml`:```toml
[[components.data_collection]]
id = "amplitude"
file = "/var/edgee/components/amplitude.wasm"
settings.amplitude_api_key = "..." # Your Amplitude API Key
```## Event Handling
### Event Mapping
The component maps Edgee events to Amplitude events as follows:| Edgee Event | Amplitude Event | Description |
|-------------|----------------|-------------|
| Page | `[Amplitude] Page Viewed` | Triggered when a user views a page (includes session_start/session_end if needed) |
| Track | Custom Event | Uses the provided event name directly |
| User | `identify` | Used for user identification |### User Event Handling
User events in Amplitude serve multiple purposes:
- Triggers an `identify` call to Amplitude
- Stores `user_id`, `anonymous_id`, and `properties` on the user's device
- Enriches subsequent Page and Track events with user data
- Enables proper user attribution across sessions## Configuration Options
### Basic Configuration
```toml
[[components.data_collection]]
id = "amplitude"
file = "/var/edgee/components/amplitude.wasm"
settings.amplitude_api_key = "..."# Optional configurations
settings.amplitude_endpoint = "..." # The default value is https://api2.amplitude.com/2/httpapi
settings.edgee_anonymization = true # Enable/disable data anonymization
settings.edgee_default_consent = "pending" # Set default consent status
```### Event Controls
Control which events are forwarded to Amplitude:
```toml
settings.edgee_page_event_enabled = true # Enable/disable page view tracking
settings.edgee_track_event_enabled = true # Enable/disable custom event tracking
settings.edgee_user_event_enabled = true # Enable/disable user identification
```### Consent Management
Before sending events to Amplitude, you can set the user consent using the Edgee SDK:
```javascript
edgee.consent("granted");
```Or using the Data Layer:
```html{
"data_collection": {
"consent": "granted"
}
}```
If the consent is not set, the component will use the default consent status.
| Consent | Anonymization |
|---------|---------------|
| pending | true |
| denied | true |
| granted | false |## Development
### Building from Source
Prerequisites:
- [Rust](https://www.rust-lang.org/tools/install)
- WASM target: `rustup target add wasm32-wasip2`
- wit-deps: `cargo install wit-deps`Build command:
```bash
make wit-deps
make build
```### Contributing
Interested in contributing? Read our [contribution guidelines](./CONTRIBUTING.md)### Security
Report security vulnerabilities to [[email protected]](mailto:[email protected])