Analytics Viewer

AndroidiOSFlutterReact NativeWeb

The Analytics Viewer streams all analytics events from your app in real time. See exactly what events are fired, with what properties, and when -- without checking your analytics dashboard.

Features

  • Real-time event stream
  • Event name and properties displayed inline
  • Support for Firebase, Segment, and custom analytics providers
  • Custom wrapper pattern for forwarding all events

Basic Usage

Log analytics events to Snapbug by specifying a provider name. Properties are built with the analyticsProperty infix function:

import io.snapbug.sdk.Snapbug
import io.snapbug.sdk.plugins.analytics.model.AnalyticsEvent
import io.snapbug.sdk.plugins.analytics.model.analyticsProperty
 
Snapbug.analytics("firebase").logEvents(
    AnalyticsEvent(
        "add_to_cart",
        "item_id" analyticsProperty "SKU_123",
        "item_name" analyticsProperty "Premium Plan",
        "price" analyticsProperty "9.99",
    )
)

logEvents accepts several events at once (vararg or a list).

Platform Examples

Snapbug.analytics("firebase").logEvents(
    AnalyticsEvent(
        "purchase",
        "currency" analyticsProperty "USD",
        "value" analyticsProperty "29.99",
        "transaction_id" analyticsProperty "T12345",
    )
)

Custom Analytics Wrapper

To automatically forward all analytics events to Snapbug, create a wrapper around your analytics client:

class AnalyticsTracker(
    private val firebaseAnalytics: FirebaseAnalytics
) {
    fun logEvent(name: String, params: Map<String, String>) {
        // Send to your real analytics provider
        firebaseAnalytics.logEvent(name, bundleOf(*params.toList().toTypedArray()))
 
        // Forward to Snapbug for debugging
        Snapbug.analytics("firebase").logEvents(
            AnalyticsEvent(
                eventName = name,
                properties = params.map { (k, v) -> k analyticsProperty v },
            )
        )
    }
}

The provider name (e.g., "firebase", "segment") is a label displayed in the inspector. You can use any string to organize events by source.