Conversion tracking from your code
Version 0.1 · Last updated: 16 November 2026
Meta finds more of the people who pay you when it can see who signs up, who reaches the important steps, and who pays. Your website's pixel sees some of that. Your servers see all of it: verified sign-ups, approvals, payments, renewals. This guide sends those steps to Iraa, which counts every one for you and forwards the allowed ones to Meta through the Conversions API.
It works for any business: a shop, a SaaS, a clinic, a course, or a lending app with an Android app, a backend, a website and an admin panel in separate repos and a 20-step funnel.
The short version
- Payments, no code. In Iraa, open Tracking for developers and connect Razorpay or Stripe. Each payment becomes a Purchase in Meta. Renewals never count twice.
- Everything else, about 10 minutes per repo. Run the setup tool on your repos. It maps your code on your machine, Iraa designs the tracking plan, and you get exact instructions (or ready edits) for each repo.
- Test, then go live. Send test events, watch them arrive, and let real traffic show which places fire.
Security: what leaves your machine and what doesn't
We built this so a careful security team can say yes.
| Never | Only this | |
|---|---|---|
| Your source code | Code, comments, string values, config values, hostnames | Names of routes, handlers, screens and files, with line numbers. You see the exact file before anything is sent. |
| Secrets | .env*, keys, certificates, keystores, google-services.json, credentials files: never even opened | Nothing. Path segments that look like tokens are replaced with :redacted, and the server redacts again. |
| Your repos | No commits, no pushes, no access to GitHub or your servers | Files written to an iraa-tracking/ folder. apply edits only on a new local branch, and you review the diff. |
| Your users | Raw emails, phones, names, addresses, IDs of documents. Iraa refuses events that contain them. | SHA-256 hashes of email and phone, made on your server. Your own user id, hashed again before it reaches Meta. |
| Sensitive businesses | Loan amounts, health details, page paths and custom events to Meta | Standard events only, with no value. Every step is still counted for you inside Iraa. |
- The server key (
iraa_sk_…) belongs on your servers only, in an environment variable. Never in a website, an app bundle or a repo. Apps tell your backend; your backend tells Iraa. Iraa stores only its hash for lookups and an encrypted copy so you can copy it again. Make a new key any time; the old one stops at once. - Consent first.
planshows what it will send and asks before sending.--offlinenever touches the network. - Payment webhooks are accepted only with a valid Razorpay or Stripe signature. Stripe signatures older than 5 minutes are refused. Each payment counts once, even when the provider retries.
- Transport is HTTPS only. Requests are rate limited per key.
1. Payments with no code
Razorpay
- In Iraa: Tracking for developers, Razorpay, Connect. Iraa shows a webhook URL and a secret.
- In Razorpay: Account & Settings, Webhooks, Add New Webhook. Paste the URL and the secret.
- Tick
payment.capturedandsubscription.charged, then Create Webhook.
Stripe
- In Iraa: Stripe, Connect. Copy the webhook URL.
- In Stripe: Developers, Webhooks, Add endpoint. Paste the URL and pick
checkout.session.completedandinvoice.paid. - Copy the Signing secret (
whsec_…) and paste it in Iraa.
What counts. A paid one-off checkout or payment becomes Purchase with its value. The first charge of a subscription becomes Purchase and Subscribe. Renewals send nothing. By default only a customer's first payment counts as a Purchase, which is what helps Meta find new payers.
2. The setup tool, for every step of your funnel
Needs Node 18 or newer. Nothing to install: npx runs it from iraa.ai. The alias keeps the commands short.
export IRAA_KEY=iraa_sk_... # from Iraa: Tracking for developers
alias iraa-setup="npx -y --package=https://iraa.ai/sdk/iraa-setup.tgz iraa-setup"
iraa-setup scan ./backend ./web ./android ./admin
iraa-setup plan # shows what it sends, asks first
iraa-setup brief # instructions and helpers per repo
iraa-setup test # sends test events, shows them arrive
iraa-setup status # counts per place in your code
scan
Reads the repos on your machine and writes iraa-tracking/map.json and REPORT.md. It finds:
- Routes and handlers: Express, Koa, Fastify, Hono, NestJS, Next.js, Django, DRF, Flask, FastAPI, Spring, Ktor, Laravel, Rails, Go (net/http, gin, echo, chi).
- Who calls them: Retrofit and OkHttp on Android, fetch and axios on web and admin panels, Flutter http and dio.
- Screens and pages, sign-up, OTP, KYC and login flows, payment providers, and analytics you already have (Meta pixel and CAPI, Firebase, GA4, Segment, Mixpanel, AppsFlyer, Adjust, Branch, CleverTap, MoEngage and more).
- Unused and deprecated APIs. An endpoint no scanned client calls is marked unused.
@Deprecated,deprecated=Trueand similar markers, legacy folders, and/v1/routes with a/v2/twin are marked deprecated. The plan never puts tracking on them.
Scan all your repos in one command so callers in the app are matched to routes in the backend.
plan
Sends map.json (after showing it to you) and gets back one tracking plan for all your repos:
- The funnel: every step from first visit to the money moment and after, in order. A lending app might have sign-up, OTP, KYC started and done, bank linked, application submitted, credit check, approval, agreement signed, disbursal and first repayment.
- Places: for each step, the file and line where the step is truly complete, preferring the backend (clients can be skipped, retried or faked).
- What goes to Meta: 3 to 6 steps that help Meta find people who reach the money moment, using Meta's standard names where they fit. Every other step is counted for you only.
- Mode:
livesteps go to Meta.observesteps are counted but held, for places the scan wasn't sure about. Switch any step in Iraa.
brief and apply
brief writes iraa-tracking/<repo>/IRAA_AGENT.md: for each step in that repo, the file and line, the exact call in that repo's language, the allowed properties and the rules. Give it to your developer, or to your AI coding tool ("follow IRAA_AGENT.md"). It also writes a small helper for the stack (Node, Python, Java/Kotlin, PHP, Go, Ruby).
apply is optional. For Node and TypeScript backends it adds the calls itself, only where the handler is found without doubt, on a new local branch iraa/tracking. It never commits. Anything uncertain stays in the brief.
Many repos
One plan covers all of them. Two rules keep the data clean across apps:
- One user id everywhere. Send the same
userIdfrom every repo (your database id). Iraa hashes it before Meta sees it. - One event id per action. When the browser and the server both report the same step, use the same
id. Meta keeps one.
3. The events API
Any language. Server to server only.
POST https://iraa.ai/api/dev/events
Authorization: Bearer $IRAA_KEY
Content-Type: application/json
{"events": [{
"name": "CompleteRegistration", // a step from your plan, or a Meta standard event
"id": "signup.8812", // unique per action; reuse the browser's id to dedupe
"time": 1794830000, // unix seconds, last 7 days
"userId": "8812", // your id; hashed before Meta
"emailSha256": "…", "phoneSha256": "…", // lowercase-trimmed email, digits-only phone, SHA-256
"value": 499, "currency": "INR", // money steps only
"url": "https://you.com/welcome", "ip": "…", "userAgent": "…", "fbp": "…", "fbc": "…",
"source": {"repo": "backend", "point": "auth.verifyEmail"},
"test": "AB12CD34" // optional, from a test session
}]}
The response has one result per event: sent (to Meta), held (counted, not sent, with the reason) or rejected (with the reason). Up to 100 events per call.
Browser details matter. Pass the IP, user agent and the _fbp/_fbc cookies from the user's request when you have them. For events with no request (a payment webhook, a loan approval job), Iraa uses the browser details it last saw for that hashed email or user id, so Meta can still match the person.
Node SDK
npm i https://iraa.ai/sdk/iraa-track.tgz
import { createIraa } from "@iraa/track";
const iraa = createIraa({ repo: "backend" }); // reads IRAA_KEY
// in your handler, after the step is really done:
iraa.track("CompleteRegistration", { id: `signup.${user.id}`, userId: user.id, email: user.email, req, point: "auth.verifyEmail" });
The SDK hashes email and phone before sending, reads IP, user agent and Meta cookies from req, batches, times out after 3 seconds and never throws. Without a key it does nothing, so local development stays quiet.
Other endpoints
| Call | What it does |
|---|---|
GET /api/dev/plan | Your current tracking plan. |
POST /api/dev/plan | {"map": …} from the setup tool. Returns a new plan version. |
POST /api/dev/test | Starts a 30-minute test session. Returns {code} to put in events as test. |
GET /api/dev/status | Counts per step and per place in your code for 7 days, and planned places that never fired. |
4. Test, then let real traffic decide
iraa-setup testsends one test event per step and shows each one arrive.- Deploy. Watch Tracking for developers in Iraa: each step shows how many fired in 7 days, from which repo and place.
- Places that never fire are listed. They are usually old or unused code the scan couldn't rule out. Move the call, or leave it.
- Switch observe steps to live when they look right. Iraa's optimizer then aims at the deepest step with real volume, and moves up as more people reach the money moment.
Restricted businesses: finance, lending, insurance, health
Meta limits what these businesses may share. Iraa detects them from your business details and enforces the rules for you: only Meta's standard events are sent, with no value, no page path and no custom data. Steps like KYC or disbursal are counted inside Iraa and stay out of Meta. Your funnel report stays complete; Meta sees only what it allows.
Questions
Do I need the pixel too? Yes, keep it on your website. It catches visits and browsing; your server catches the steps that matter. Share event ids for steps both report.
Monorepo? Point scan at the folders of each app inside it.
Mobile apps? Report steps from the app to your own backend, which calls Iraa. For install ads, keep Meta's app SDK in the app.
Can I see what was sent? iraa-tracking/outbox.json is exactly what plan sends. Events you send are your own requests.
How do I stop it? Make a new key in Iraa (the old one stops at once) or remove the calls. Disconnect payments with one tap.
Questions or a security review? Write to security@iraa.ai.