analytics library
Shotik Analytics: sessions, screens, taps, rage and dead taps, scroll depth, errors, stalls, purchases, custom events, identify and wireframes, packed byte-compatible with wire.ts (PROTOCOL.md section 4).
Classes
- Analytics
- Batch
- DeviceContext
- FileStorage
- HttpTransport
- MemoryStorage
- RenderShotikMask
- Shotik
- ShotikAnalytics
- ShotikConfig
- ShotikDevice
- ShotikMask
- Hides what's inside from tap labels and wireframes (one grey block). EditableText is always masked.
- ShotikNative
- ShotikResponse
- ShotikRoot
- ShotikRootState
- ShotikScreen
-
Names the screen it is on:
ShotikScreen(name: 'Paywall', child: ...). Wins over the route name. - ShotikSocket
- ShotikStorage
- ShotikTransport
- TapTarget
- WireEvent
- Wireframe
Enums
Constants
- batchSize → const int
-
eventTypes
→ const List<
String> - Event types. Codes are the list position, so append only.
- kOffIsolateEvents → const int
- Batches with more events than this are packed and encoded on a background isolate (see test/perf_test.dart).
- maxQueue → const int
- wireVersion → const int
Functions
-
describeTarget(
Element root, RenderBox box, Offset global) → TapTarget - The element under a point, from the render tree (hit test) and the element tree along the hit path.
-
encodeBatch(
Batch b) → String - The request body for a batch. Top-level so it can run on a background isolate via compute().
-
encodeJson(
Object? value) → String -
flushInterval(
int flushMs, int backoff) → Duration - Analytics flush interval: flushMs × 2^backoff, backoff capped at 5.
-
localId(
String prefix) → String - prefix + time in base 36 + 8 random characters, like the reference's localId().
-
pack(
Batch b) → Map< String, Object?> -
{ v, a, u, f?, c?, t0, d, e } with e =
dt, type, seq, session, screen, name, props | 0. -
reconnectDelay(
int n, [Random? random]) → Duration - Reconnect delay: min(30 s, 500 ms × 2^n) × uniform(0.8, 1.2), n = consecutive failures.
-
retryDelay(
int attempts) → Duration - Send retry delay: min(30 s, 500 ms × 2^attempts).
-
unpack(
Map< String, Object?> p) → Batch -
wireframe(
Element from, RenderBox root, {int cap = 400}) → List< WireNode> -
The screen under
fromas wireframe nodes inroot's coordinates (logical points), at mostcapnodes. Walks the element tree to read each render object's geometry and kind (RenderParagraph t, RenderImage i, RenderEditable n, ShotikMask m, tap handlers b, viewports s) and, for plain boxes, the fill from the widget (ColoredBox, DecoratedBox, Material). Offstage, transparent, tiny and off-screen boxes are skipped.