Funnel Setup for Custom Websites
For custom websites, the tracking script records visits, the RapidMetrics JavaScript SDK links each visitor to their email, and your server sends every sale and lead to RapidMetrics.
Step 1 - Install the Tracking Script
Go to Funnels and click the code icon on your Custom Website funnel. Copy the Tracking Script and paste it into the <head> of every page you want to track.
Step 2 - Identify Users
As soon as you know the visitor's email (a form, a login or your checkout), call:
RapidMetrics.identify({
email: '[email protected]',
first_name: 'John', // optional
last_name: 'Doe' // optional
});
Use the same email your server sends in Step 3. That is how a sale gets linked to the visit and the ad that brought the buyer.
Step 3 - Send Purchases From Your Server
When a payment succeeds, your server (or an automation tool like Zapier or Make) sends the sale to your funnel's webhook:
POST https://api.rapidmetrics.ai/v1/webhook/custom/YOUR_FUNNEL_ID
Content-Type: application/json
x-api-key: YOUR_API_KEY
{
"event": "purchase",
"email": "[email protected]",
"amount": 97.00,
"currency": "USD",
"product_name": "My Course",
"order_id": "ORD-123"
}
- YOUR_FUNNEL_ID is the ID after
Funnel:in the first line of your tracking script. - YOUR_API_KEY is under Integrations → Custom / API → Setup. Keep it on your server and never put it in a web page.
Step 4 - Send Leads From Your Server
Send each opt-in to the same URL with "event": "lead". Every lead you send counts in the funnel's F/E Leads for that day.
{
"event": "lead",
"email": "[email protected]",
"first_name": "Jane"
}
To also send a Lead event to Facebook, call RapidMetrics.track('Lead'); in the browser. It only sends the Lead to Facebook. It does not add a lead in RapidMetrics.
RapidMetrics.track('Purchase') for real sales. The server webhook in Step 3 already sends the Purchase to Facebook. A browser Purchase adds no revenue in RapidMetrics and makes Facebook count the sale twice.All request fields, responses and error codes are in the RapidMetrics developer docs.

