The diff shows a change in `src/metriki/app.py` within the `BaseView.insert` method. The original code directly passed `dict(data)` to the database insert, which could fail if `data` contains non-serializable types like `datetime` objects. The fix converts the data to a JSON string and back using `json.loads(json.dumps(data))`, ensuring all values are plain Python types (strings, numbers, lists, dicts) before insertion. This prevents serialization errors when the database backend expects JSON-compatible data.
- Wrap ws.send in try-catch to handle connection failures gracefully
- Set isConnected to false and schedule retry via emitVisit after 500ms on error
- Add early return guard in emitVisit to skip emission when not rendered or connected
Introduce a new `click_fields` list alongside existing document fields, implement `is_click_record` method to identify click events by checking for 'click' event type, and extend `get_record` to extract click-specific fields. In the `post` method, route click records to a new 'click' collection with associated visit_id, enabling separate storage and analysis of click interactions distinct from document and general event records.