https://github.com/edgee-cloud/piano-analytics-component
Piano Analytics Edgee Component
https://github.com/edgee-cloud/piano-analytics-component
edge-computing edgee piano-analytics rust wasm wasm-component
Last synced: 10 months ago
JSON representation
Piano Analytics Edgee Component
- Host: GitHub
- URL: https://github.com/edgee-cloud/piano-analytics-component
- Owner: edgee-cloud
- License: apache-2.0
- Created: 2024-10-30T14:32:11.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-11-25T05:38:05.000Z (over 1 year ago)
- Last Synced: 2024-11-25T06:24:34.575Z (over 1 year ago)
- Topics: edge-computing, edgee, piano-analytics, rust, wasm, wasm-component
- Language: Rust
- Homepage: https://www.edgee.cloud
- Size: 21.5 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
Piano Analytics Component for Edgee
[](https://coveralls.io/github/edgee-cloud/piano-analytics-component)
[](https://github.com/edgee-cloud/piano-analytics-component/issues)
[](https://www.edgee.cloud/edgee/piano-analytics)
This component implements the data collection protocol between [Edgee](https://www.edgee.cloud) and [Piano Analytics](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/collection-api).
## Quick Start
1. Download the latest component version from our [releases page](../../releases)
2. Place the `piano.wasm` file in your server (e.g., `/var/edgee/components`)
3. Add the following configuration to your `edgee.toml`:
```toml
[[components.data_collection]]
id = "piano"
file = "/var/edgee/components/piano.wasm"
settings.piano_site_id = "..."
settings.piano_collection_domain = "..."
settings.piano_collect_utm_as_properties = "true"
```
## Event Handling
### Event Mapping
The component maps Edgee events to Piano Analytics events as follows:
| Edgee Event | Piano Analytics Event | Description |
|-------------|----------------------- |-------------|
| Page | `page.display` | Triggered when a user views a page |
| Track | Custom Event | Uses the provided event name directly |
| User | N/A | Used for user identification only |
### User Event Handling
While User events don't generate Piano Analytics events directly, they serve an important purpose:
- 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 = "piano"
file = "/var/edgee/components/piano.wasm"
settings.piano_site_id = "..."
settings.piano_collection_domain = "..."
settings.piano_collect_utm_as_properties = "true"
# 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 user
```
To find out more about using `piano_collect_utm_as_properties`, please refer to [Piano documentation](https://developers.atinternet-solutions.com/piano-analytics/data-collection/how-to-send-events/marketing-campaigns#collect-utm-as-properties).
### Event Controls
Control which events are forwarded to Piano Analytics:
```toml
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 event
```
### Consent Management
Before sending events to Google Analytics, 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 | Piano Analytics Consent |
|---------|---------------|-------------------------|
| pending | true | Exempt |
| denied | true | Exempt |
| granted | false | Opt-in |
## Development
### Building from Source
Prerequisites:
- [Rust](https://www.rust-lang.org/tools/install)
- WASM target: `rustup target add wasm32-wasip2`
Build command:
```bash
make build
```
### Contributing
Interested in contributing? Read our [contribution guidelines](./CONTRIBUTING.md)
### Security
Report security vulnerabilities to [security@edgee.cloud](mailto:security@edgee.cloud)