A comprehensive example application demonstrating the integration of Formo Analytics with Thirdweb wallet connectivity. This project showcases automatic event tracking for wallet interactions, signatures, transactions, and custom events.
- Wallet Connection/Disconnection: Automatically tracks when users connect or disconnect their wallets
- Page View Events: Tracks page navigation and user sessions
- User Identification: Links wallet addresses to user sessions
- Error Tracking: Captures and reports connection and transaction errors
- Message Signing: Test signature events with custom messages
- Transaction Testing: Send test transactions and track events
- Custom Events: Fire custom events with configurable data
- Page Events: Manually trigger page view events
- MetaMask
- Coinbase Wallet
- WalletConnect
- And more through Thirdweb's wallet infrastructure
- Node.js 18+
- npm or yarn
- A Thirdweb Client ID
- A Formo Analytics Write Key
-
Clone the repository
git clone <repository-url> cd formo-example-thirdweb
-
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env.local
Edit
.env.localand add your API keys:NEXT_PUBLIC_THIRDWEB_CLIENT_ID=your_thirdweb_client_id_here NEXT_PUBLIC_FORMO_WRITE_KEY=your_formo_write_key_here
-
Run the development server
npm run dev
-
Open your browser Navigate to http://localhost:3000
- Visit Thirdweb Dashboard
- Create a new project or select an existing one
- Copy your Client ID from the project settings
- Visit Formo Analytics Dashboard
- Create a new project or select an existing one
- Navigate to Settings > API Keys
- Copy your Write Key
- Click on any of the wallet connection buttons
- Follow the wallet-specific connection flow
- Once connected, the app will automatically track the connection event
- Enter a custom message in the signature testing section
- Click "Sign Message"
- Approve the signature in your wallet
- The signature event will be tracked automatically
- Click "Send Test Transaction"
- This sends 0 ETH to your own address (safe test transaction)
- Approve the transaction in your wallet
- The transaction event will be tracked
- Enter a custom event name
- Modify the JSON data as needed
- Click "Send Custom Event"
- The event will be sent to Formo Analytics
formo-example-thirdweb/
βββ src/
β βββ app/
β β βββ layout.tsx # Root layout with providers
β β βββ page.tsx # Main application page
β β βββ globals.css # Global styles
β βββ components/
β βββ analytics-provider.tsx # Formo Analytics wrapper
β βββ connect-wallet.tsx # Wallet connection UI
β βββ event-tester.tsx # Event testing interface
β βββ formo-analytics.tsx # Analytics status display
β βββ thirdweb-provider.tsx # Thirdweb configuration
βββ package.json # Dependencies and scripts
βββ tailwind.config.js # Tailwind CSS configuration
βββ tsconfig.json # TypeScript configuration
βββ README.md # This file
Page View- Tracked on page load and navigationWallet Connected- When a wallet is successfully connectedWallet Disconnected- When a wallet is disconnectedWallet Connection Attempted- When connection is initiatedWallet Connection Failed- When connection fails
Message Signed- When a message is successfully signedSignature Failed- When message signing failsTransaction Sent- When a transaction is successfully sentTransaction Failed- When transaction submission failsCustom Test Event- User-defined custom eventsPage Event Triggered- Manually triggered page events
- Connect your wallet and verify the connection event is tracked
- Sign a message to test signature event tracking
- Send a test transaction to verify transaction events
- Create custom events to test flexible event tracking
- Check the analytics dashboard to see all tracked events
Edit src/components/connect-wallet.tsx and add new wallet instances to the wallets array:
import { NewWallet } from '@thirdweb-dev/wallets';
const wallets = [
new MetaMaskWallet(),
new CoinbaseWallet(),
new WalletConnect(),
new NewWallet(), // Add your new wallet here
];Modify the event data in any component by updating the analytics tracking calls:
analytics.track('Your Event Name', {
custom_property: 'custom_value',
wallet_address: address,
timestamp: new Date().toISOString(),
// Add any custom properties here
});This project uses Tailwind CSS. Modify the classes in any component file to customize the appearance.
After running the application and generating events, you can view them in your Formo Analytics dashboard:
- Log in to Formo Analytics
- Navigate to your project
- View real-time events in the Events tab
- Create custom dashboards and funnels based on the tracked events
- Push your code to GitHub
- Connect your repository to Vercel
- Add your environment variables in the Vercel dashboard
- Deploy
This is a standard Next.js application and can be deployed to any platform that supports Node.js:
- Netlify
- Railway
- Heroku
- AWS
- Google Cloud Platform
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.