Example Projects

Learn how to use the m0rphic SDK through complete example projects. These projects demonstrate best practices for all core features.

React Example App

A complete React application showcasing all features of the @m0rphic/react SDK. Includes event tracking, component rendering, and a real-time debug panel.

Features

  • •M0rphicProvider - Session tracking (session_start/session_end)
  • •M0rphicComponent - AI component rendering with automatic click and view tracking
  • •useTrackComponent - Manual component tracking with hover support
  • •useTrackScroll - Scroll depth tracking (25%, 50%, 75%, 100%)
  • •M0rphicErrorBoundary - Error boundary with automatic error event reporting

Quick Start

bash

Test Mode Note

The example app uses e2e-test-example-app as the default appId, which requires E2E_TEST_MODE=true on the server to bypass authentication.

Event Tracking Overview

The SDK supports the following event types for collecting user behavior data:

Event TypeTriggerAutomatic
session_startProvider mountsYes
session_endPage closes or tab switchesYes
viewElement visible (>50%)Yes
clickUser clicksYes
submitHandler is invokedYes
hoverHover exceeds thresholdOpt-in
scrollScroll reaches milestoneOpt-in
errorError boundary catches errorOpt-in

Source Code

View the complete source code: