Overview
The Nexus SDK includes built-in analytics powered by PostHog to help improve the SDK and understand usage patterns. Analytics are enabled by default (opt-out system) but can be easily customized or disabled.By default, the SDK sends anonymous telemetry data to Avail’s PostHog instance. All data collection is covered by Avail’s Privacy Policy and PostHog’s GDPR-compliant Data Processing Agreement.
Data Collection
What is Collected
By default, the SDK collects:- Session metrics — Duration, success rates, operation counts
- Operation performance — Timing, errors, operation types
- Wallet type — Provider information (e.g., MetaMask, Coinbase Wallet)
- Network/chain usage — Which chains are being used
- Error tracking — Error types and occurrences (without sensitive data)
What is NOT Collected
The following data is never collected by default:- Wallet addresses — Unless you explicitly call
analytics.identify() - Transaction amounts — Can be excluded via
privacy.anonymizeAmounts - Personal information — No PII is collected
Configuration
Disabling Analytics
To completely disable analytics:Privacy Controls
Control what data is sent:When enabled, wallet addresses are hashed using SHA-256 before being sent to analytics. The SDK uses a session-specific salt for additional privacy.
When enabled, sensitive financial fields like
valueUsd, totalValueUsd, gasUsed, and value are removed from analytics events.Custom PostHog Instance
Use your own PostHog instance for analytics:Your PostHog project API key. This is a write-only key that can only send events, not read or modify data.
Your PostHog API host URL. Use this if you’re self-hosting PostHog or using a different region.
Optional metadata about your application that will be included in all events:
appName— Your application nameappVersion— Your application versionappUrl— Your application URL
Session Recording
Enable PostHog session recording (disabled by default):Debug Mode
Enable debug logging for analytics:Programmatic Access
Track Custom Events
Identify Users
The SDK does not automatically call
analytics.identify(). You must explicitly identify users if you want to track them across sessions.Runtime Control
Error Tracking
Tracked Events
The SDK automatically tracks the following event categories:SDK Lifecycle
nexus_sdk_initialized— SDK initialization successfulnexus_sdk_initialization_failed— SDK initialization failednexus_sdk_deinitialized— SDK cleanup/deinitialization
Session Events
nexus_session_started— New session startednexus_session_ended— Session ended (includes duration and success rate)
Wallet Events
nexus_wallet_connected— Wallet connectednexus_wallet_disconnected— Wallet disconnectednexus_wallet_changed— Active wallet account changednexus_wallet_network_changed— Network/chain changed in wallet
Operation Events
- Bridge:
nexus_bridge_initiated,nexus_bridge_transaction_success,nexus_bridge_transaction_failed - Transfer:
nexus_transfer_initiated,nexus_transfer_transaction_success,nexus_transfer_transaction_failed - Swap:
nexus_swap_initiated,nexus_swap_transaction_success,nexus_swap_transaction_failed - Execute:
nexus_execute_initiated,nexus_execute_transaction_success,nexus_execute_transaction_failed - Bridge & Execute:
nexus_bridge_and_execute_initiated,nexus_bridge_and_execute_transaction_success
Performance Events
nexus_operation_performance— Operation timing and success metrics
Error Events
nexus_error_occurred— General error trackingnexus_user_rejected— User rejected transaction/approval
Event Properties
All events include base properties:Privacy & Security
Wallet Address Hashing
WhenanonymizeWallets is enabled, the SDK uses SHA-256 hashing with a session-specific salt:
- Original address:
0x742d35Cc6634C0532925a3b8D4C9db96c4b4Db45 - Hashed version:
anon_a3f8e9b2c1d4e5f6
Data Sanitization
The SDK automatically:- Validates properties — Prevents prototype pollution attacks
- Sanitizes URLs — Removes query parameters and sensitive data
- Filters sensitive fields — Removes financial data when
anonymizeAmountsis enabled
PostHog API Key Security
The default PostHog API key in the SDK is intentionally public and safe to commit:- It’s a write-only project API key (not a Personal API Key)
- Cannot read or modify existing data
- Can only send events to Avail’s PostHog instance
- PostHog project is configured to reject malicious data
If you want to use your own PostHog instance, provide your own
posthogApiKey in the configuration.Best Practices
For Privacy-Conscious Applications
For Enterprise Applications
For Development
FAQ
Can I opt out of analytics?
Can I opt out of analytics?
Yes, set
analytics: { enabled: false } when initializing the SDK.Are wallet addresses tracked?
Are wallet addresses tracked?
Not by default. The SDK only tracks wallet addresses if you explicitly call
sdk.analytics.identify(). Even then, you can enable anonymizeWallets to hash addresses before sending.Can I see what data is being sent?
Can I see what data is being sent?
Yes, enable debug mode with
analytics: { debug: true } to log all analytics events to the console.Is the PostHog API key in the source code a security risk?
Is the PostHog API key in the source code a security risk?
No. It’s a write-only project API key that can only send events, not read or modify data. This is standard practice for client-side analytics.
Can I use a different analytics provider?
Can I use a different analytics provider?
The SDK currently supports PostHog only. However, you can access the raw event data by providing your own PostHog instance and implementing custom event handlers.
Related Resources
Privacy Policy
Review Avail’s privacy policy and data handling practices
PostHog Documentation
Learn more about PostHog features and capabilities