npm install @easyfunnel/sdk @easyfunnel/react
Add the provider to your root layout:
import { EasyFunnelProvider } from '@easyfunnel/react'
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<EasyFunnelProvider apiKey="ef_your_key_here">
{children}
</EasyFunnelProvider>
</body>
</html>
)
}Track events from any component:
import { useTrack } from '@easyfunnel/react'
function PricingButton() {
const track = useTrack()
return (
<button onClick={() => track('click_subscribe', { plan: 'indie' })}>
Subscribe
</button>
)
}<script defer data-api-key="ef_your_key_here" src="https://easyfunnel.co/sdk.js" ></script>
import { EasyFunnel } from '@easyfunnel/sdk'
const ef = EasyFunnel.init({
apiKey: 'ef_your_key_here',
debug: true, // logs events to console in development
})
// Track custom events
ef.track('click_signup', { plan: 'indie' })
// Identify users after login
ef.identify('user_123')The SDK automatically tracks:
data-ef-track attribute<!-- This button automatically fires a "click" event -->
<!-- with { element: "signup_cta" } in properties -->
<button data-ef-track="signup_cta">Sign Up</button>Before a user signs up, they are anonymous (tracked by session ID). When you call ef.identify('user_123'), all their previous anonymous events are retroactively linked to that user ID.
// Call after login/signup
ef.identify('user_123')
// Or with the React hook:
const identify = useIdentify()
identify('user_123')The MCP server lets Claude instrument your code and query your analytics directly from the editor.
claude mcp add easyfunnel -e EASYFUNNEL_API_KEY=efa_your_account_api_key -- npx @easyfunnel/mcp
{
"mcpServers": {
"easyfunnel": {
"command": "npx",
"args": ["@easyfunnel/mcp"],
"env": {
"EASYFUNNEL_API_KEY": "efa_your_account_api_key"
}
}
}
}Find your account API key in Settings.
list_projectsList all your projectscreate_projectCreate a new projectsetup_sdkInstall SDK and add provider to your codebasescan_for_actionsFind trackable buttons, forms, and linksinstrument_codeAdd tracking attributes or calls to elementscreate_funnelDefine a conversion funnel from event stepsget_funnel_healthGet conversion and drop-off dataquery_eventsQuery event counts, recent events, or breakdownsPOST https://easyfunnel.co/api/collect
Content-Type: application/json
{
"api_key": "ef_your_project_key",
"events": [
{
"session_id": "anonymous-uuid",
"event_name": "page_view",
"properties": {
"url": "/pricing",
"referrer": "https://google.com"
}
}
]
}
Response: 202 AcceptedMax 20 events per request. Max 4KB per event. Rate limit: 100 req/s per API key.