This repository contains JSON Schema definitions for analytics events, organized into base properties and event-specific schemas.
Contains the base AnalyticsEvent
schema with fields that are required for ALL events. These properties should be abstracted out in your application code and automatically included with every analytics event.
Base Properties:
timestamp
- ISO 8601 timestamp when the event was recordedeventName
- The name of the analytics eventsystemProps
- System-level properties (locale, debug mode, app version, SDK version)props
- Event properties including OS namesessionId
- Session identifierfirebase_user_id
- Firebase user identifier (optional)user_properties
- User-specific properties (application, wallet type, network, etc.)
Individual schema files (like dapp-browser.schema.json
) contain the specific properties for each event type.
Example Events:
DappBrowserOpen
- When a dapp browser is openedDappPin
- When a dapp is pinnedDappClick
- When a dapp is clicked- etc.
- Add a new schema file in the
schemas
directory. - Add the new schema to the
index.json
file.
Abstract the base properties in your analytics service:
class AnalyticsService {
private getBaseProperties(): BaseAnalyticsEvent {
return {
timestamp: new Date().toISOString(),
systemProps: {
locale: this.getBrowserLocale(),
isDebug: this.isDebug,
appVersion: this.appVersion,
sdkVersion: 'custom_0.0.1'
},
props: {
osName: this.getOSName()
},
sessionId: this.sessionId,
firebase_user_id: this.firebaseUserId,
user_properties: {
application: 'wallet-app',
walletType: this.walletType,
network: this.network,
accounts: this.accountCount,
version: this.version,
platform: this.platform
}
};
}
trackDappPin(url: string, location: string) {
const event = {
...this.getBaseProperties(),
eventName: 'dapp_pin',
name: 'dapp_pin',
url: url,
location: location
};
this.sendEvent(event);
}
}
Don't manually add base properties to every event - use the abstraction layer instead.
Use the schemas to validate your events before sending them to your analytics service. The schemas ensure data quality and consistency across your application.
schemas/
├── _main.schema.json # Base properties for all events
├── dapp-browser.schema.json # Dapp browser specific events
└── ton-connect.schema.json # TON Connect specific events