Skip to content

edgee-cloud/piano-analytics-component

Piano Analytics Component for Edgee

This component implements the data collection protocol between Edgee and Piano Analytics.

Quick Start

  1. Download the latest component version from our releases page
  2. Place the piano.wasm file in your server (e.g., /var/edgee/components)
  3. Add the following configuration to your edgee.toml:
[[destinations.data_collection]]
name = "piano"
component = "/var/edgee/components/piano.wasm"
credentials.piano_site_id = "..."
credentials.piano_collection_domain = "..."

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

[[destinations.data_collection]]
name = "piano"
component = "/var/edgee/components/piano.wasm"
credentials.piano_site_id = "..."
credentials.piano_collection_domain = "..."

# Optional configurations
config.anonymization = true        # Enable/disable data anonymization in case of pending or denied consent
config.default_consent = "pending" # Set default consent status if not specified by the user

Event Controls

Control which events are forwarded to Piano Analytics:

config.page_event_enabled = true   # Enable/disable page event
config.track_event_enabled = true  # Enable/disable track event
config.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:

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 Piano Analytics Consent
pending true Exempt
denied true Exempt
granted false Opt-in

Development

Building from Source

Prerequisites:

  • Rust
  • WASM target: rustup target add wasm32-wasip2
  • wit-deps: cargo install wit-deps

Build command:

make wit-deps
make build

Contributing

Interested in contributing? Read our contribution guidelines

Security

Report security vulnerabilities to security@edgee.cloud