Skip to main content
Frontend analytics only tell half the story. Contract events complete it. A user might visit your DeFi app 10 times but never make a transaction. Or a user may skip your site altogether and execute a $50k swap. Smart contract event tracking bridges that visibiity gap. With Formo, you can monitor contract activity in real time, link it to your users, and use it in funnels, flows, and dashboards.

Part 1: Navigate to Project Settings > Contracts

In the Formo dashboard:
  • Go to your project settings
  • Select Contracts.
  • You’ll see a list of contracts you’re already and an Add Contract button.
Contract settings page showing list of tracked contracts and add button

Part 2: Add a Contract

Click Add Contract. A modal opens.
  1. Paste your contract address (e.g., 0x6B175474E89094C44Da98b954EedeAC495271d0F for DAI on Ethereum)
  2. Select the chain from the dropdown (Ethereum, Polygon, Arbitrum, Optimism, Base, etc.)
  3. Click Auto-Detect ABI
Formo fetches the contract’s ABI from Etherscan (or equivalent block explorer). If successful, you’ll see a list of all events in the contract. If auto-detection fails, you can paste the ABI manually (copy from Etherscan, Hardhat build output, or your IDE).
For proxy contracts, paste the implementation ABI, not the proxy ABI.

Part 3: Select Events to Track

The ABI reveals all events defined in the contract. Formo shows checkboxes for each. Common events to track:
  • Swap: When a user executes a trade (typically includes amount_in, amount_out, user)
  • Transfer: When tokens move (includes from, to, value)
  • Approval: When user approves a spender
  • Deposit / Withdraw: For lending/staking protocols
  • Mint / Burn: For token creation/destruction
Check the events you want to track. You don’t need to track every event, only the ones relevant to your analytics. Example: For a DEX, track Swap. For a token, track Transfer and Approval.

Part 4: Deploy the Pipeline

Once events are selected, click Deploy. Formo provisions the pipeline in the background. Pipeline states progress as: Draft > Initializing > Active This typically takes a few minutes. Monitor the status in the Project Settings > Contracts panel. Once Active, your smart contract events will start flowing into your Formo project.
You can add more contracts later. Just add it, select events, and deploy to update the pipeline.

Part 5: See Contract Events in Activity Feed

Navigate to Activity in the sidebar. You’ll see a unified feed of offchain events (web page views, mobile events) and onchain events (smart contract events e.g. swaps, transfers). Scroll through to verify events are being captured. Filter for events by name like “Swap” or “Transfer” and properties like amount, token address, and timestamp. Each contract event is automatically linked to a wallet address and session, so you can associate it with the user who executed the transaction.

Part 6: Use Contract Events as Funnel Steps

Now that contract events are flowing, use them as steps in funnels and other charts. Click Dashboards > Add Chart > Funnel. In the funnel builder, you’ll see a list of all of your events including events from the frontend (page views, wallet connects) and contract events (swaps, transfers) in the step dropdown. Example funnel:
  1. “Wallet Connected” (frontend event with type connect)
  2. “Transaction” (frontend event with type transaction)
  3. “Swap” (contract event: Swap)
This funnel measures: Of users who connected a wallet, how many made a transaction, and of those, how many executed a swap?
Funnel builder showing mix of frontend and contract events

Part 7: Query Contract Events with SQL

For advanced analysis, use the Explorer (SQL editor). Navigate to Explorer in the sidebar. The schema browser on the left shows available tables: events, users, anonymous_users. The events table includes contract events with columns like:
  • type: Event type (e.g., decoded_log for contract events, connect for wallet connections)
  • event: Specific event name like “Swap”, “Transfer”, etc. (populated for decoded_log and track events)
  • address: User’s wallet address
  • timestamp: When the event occurred
  • properties: Event-specific data stored as JSON string (includes contract address, amounts, tokens, etc.)

Essential Contract Event Queries

Query 1: Daily Swap Volume
SELECT 
  toDate(timestamp) as date,
  sum(JSONExtractFloat(properties, 'amount_out')) as total_volume
FROM events
WHERE type = 'decoded_log' AND event = 'Swap' AND JSONExtractString(properties, 'contract_address') = '0x...'
GROUP BY date
ORDER BY date DESC
Query 2: Top Swappers (By Transaction Count)
SELECT 
  address,
  count(*) as swap_count,
  sum(JSONExtractFloat(properties, 'amount_out')) as total_volume
FROM events
WHERE type = 'decoded_log' AND event = 'Swap'
GROUP BY address
ORDER BY swap_count DESC
LIMIT 10
Query 3: Time to First Swap (After Wallet Connect)
SELECT 
  avg(dateDiff('minute',
    first_connect_time,
    first_swap_time)) as avg_minutes_to_swap
FROM (
  SELECT 
    address,
    min(if(type = 'connect', timestamp, null)) as first_connect_time,
    min(if(type = 'decoded_log' AND event = 'Swap', timestamp, null)) as first_swap_time
  FROM events
  GROUP BY address
)
WHERE first_swap_time IS NOT NULL

Part 8: Build Dashboard Charts from Contract Events

In Dashboards, create charts filtered to contract events. Example charts:
  • Line Chart: Daily swap volume over time
  • Bar Chart: Top 5 tokens swapped
  • Pie Chart: Swap size distribution (small, medium, large)
  • Number Card: Total transactions, unique swappers, total volume
Contract event data is as queryable as frontend events. Use it to build your on-chain analytics dashboard.

Part 9: Set Up Alerts for Contract Events

Navigate to Project Settings > Alerts. Create alerts for important contract events:
  • “Alert me when a high-net-worth wallet connects”
  • “Alert me when a whale executes a swap”
  • “Alert me when a specific contract event fires”
Alerts notify you in real time or on a daily digest, keeping you informed of important onchain activity.

Pipeline Management

Check Pipeline Status

In Project Settings > Contracts, each contract shows its pipeline state:
  • Draft: Not yet deployed
  • Active: Live and ingesting events
  • Paused: Temporarily disabled
  • Error: Pipeline failed (check logs)

Pause a Pipeline

If you need to stop tracking a contract, click Pause next to its name. Events stop being ingested. You can resume anytime.

Redeploy After Changes

If you add new events or update your contract, deploy again. The pipeline seamlessly updates.

Next Steps

Once contract events are flowing, explore advanced use cases:

FAQ

Formo supports Ethereum, Polygon, Arbitrum, Optimism, Base, BNB Chain, Avalanche, Linea, Scroll, zkSync, Blast, and more. Full list at Supported Chains.
Formo queries Etherscan, Polygonscan, and other block explorers. If your contract is verified on the explorer, the ABI is detected instantly. If not, paste the ABI manually.
You can paste the ABI manually. Formo will use it to decode transactions and events.
Yes. For example, swap on Contract A, then bridge to Contract B. Both appear as funnel steps. Formo links them by wallet address and timestamp.
Yes. Each contract event counts as 1 event in your plan. For high-volume contracts (millions of events daily), consider filtering or segmenting.