This example application demonstrates the integration between Formo Analytics SDK and Reown AppKit for comprehensive wallet analytics tracking.
This example showcases the following key features:
- Connect/Disconnect: Wallet connection management with Reown AppKit
- Network Switching: Multi-chain support with network selection
- Wallet Information: Display connected wallet details
- Page Events: Automatic page view tracking
- Wallet Events: Connect/disconnect event tracking
- Signature Events: Message signing tracking with success/failure states
- Transaction Events: Transaction attempt and result tracking
- Custom Events: Application-specific event tracking with custom properties
- Ethereum Mainnet
- Arbitrum
- Polygon
- Base
- Optimism
Copy the environment example file and configure your keys:
cp .env.example .envEdit .env with your actual values:
# Get your Reown Project ID from https://cloud.reown.com
NEXT_PUBLIC_REOWN_PROJECT_ID=your_project_id_here
# Get your Formo Analytics Write Key from your dashboard
NEXT_PUBLIC_FORMO_WRITE_KEY=your_formo_write_key_herepnpm installpnpm devOpen http://localhost:3000 to view the application.
The example includes several test components to verify the integration:
- Connect wallet using various providers
- Test network switching
- Manual disconnect functionality
- Sign test messages
- Track successful signatures
- Handle signature errors
- Send test transactions (small amounts to self)
- Track transaction attempts
- Handle transaction failures
- Track button clicks
- Track feature usage
- Track user interactions
- Track performance metrics
The integration automatically tracks the following events:
page: Page views with URL and referrerWallet Connected: When user connects walletWallet Disconnected: When user disconnects walletNetwork Changed: When user switches networks
Message Signed: When user signs messagesSignature Failed: When signature failsTransaction Sent: When transactions are sentTransaction Failed: When transactions fail- Custom application events
All events include relevant metadata:
address: Connected wallet addresschainId: Current network chain IDtimestamp: ISO timestamp of the eventconnector: Wallet connector name- Additional context-specific properties
src/
├── app/
│ ├── layout.tsx # Root layout with providers
│ ├── page.tsx # Main application page
│ └── globals.css # Global styles
├── components/
│ ├── providers/
│ │ ├── AppKitProvider.tsx # Reown AppKit provider
│ │ └── FormoProvider.tsx # Formo Analytics provider
│ ├── ui/ # UI components
│ ├── WalletComponents.tsx # Wallet interaction components
│ ├── CustomEventTest.tsx # Custom event testing
│ └── WalletInfo.tsx # Wallet information display
├── config/
│ ├── wagmi.ts # Wagmi configuration
│ └── appkit.ts # AppKit configuration
└── lib/
└── utils.ts # Utility functions
FormoProvider
└── AppKitProvider (WagmiProvider + QueryClientProvider)
└── App Components
Edit src/config/wagmi.ts to add new networks:
import { mainnet, arbitrum, polygon, base, optimism, yourNetwork } from '@reown/appkit/networks';
export const networks = [mainnet, arbitrum, polygon, base, optimism, yourNetwork];Add custom events anywhere in your application:
import { useFormo } from '@formo/analytics';
function YourComponent() {
const formo = useFormo();
const trackCustomEvent = () => {
formo?.track('Custom Event', {
property1: 'value1',
property2: 'value2',
timestamp: new Date().toISOString(),
});
};
}The application uses Tailwind CSS with a custom design system. Modify src/app/globals.css and tailwind.config.ts to customize the appearance.
This example is provided as-is for demonstration purposes.