Guides
Lead forms and webhook
Create the lead form with a webhook, link it to the campaign, receive leads with google_key, respond correctly and query lead_form_submission_data.
A lead form is an asset (leadFormAsset) linked to a campaign. When a user submits the form, Google sends a POST to your webhook with the data. The webhook is not signed: authenticity comes from the google_key field in the body, which equals the googleSecret you configured.
1. Create the form
curl --request POST \
--url https://google-ads.mimicr.dev/v26/customers/2220330728/assets:mutate \
--header 'Authorization: Bearer <token>' \
--header 'login-customer-id: 6446154552' \
--header 'Content-Type: application/json' \
--data '{
"operations": [{
"create": {
"name": "Formulário Revenda",
"leadFormAsset": {
"businessName": "Revenda Goiânia",
"callToActionType": "GET_QUOTE",
"callToActionDescription": "Receba o preço",
"headline": "Peça seu gás",
"description": "Deixe seu contato.",
"privacyPolicyUrl": "https://revenda.example.com/privacidade",
"fields": [{ "inputType": "FULL_NAME" }, { "inputType": "PHONE_NUMBER" }, { "inputType": "EMAIL" }],
"deliveryMethods": [{ "webhook": { "advertiserWebhookUrl": "https://seu-servico.example.com/google-leads", "googleSecret": "segredo-do-formulario", "payloadSchemaVersion": "3" } }]
}
}
}]
}'{ "results": [{ "resourceName": "customers/2220330728/assets/54542600318" }] }Required fields: businessName, callToActionType, callToActionDescription, headline, description, privacyPolicyUrl and fields. Only one webhook per form. The form also goes through review and is approved like ads (or immediately with asset.approve). In Mimicr, the webhook URL can be localhost or an IP, for local receivers; Google requires public HTTPS.
2. Link it to the campaign
curl --request POST \
--url https://google-ads.mimicr.dev/v26/customers/2220330728/campaignAssets:mutate \
--header 'Authorization: Bearer <token>' \
--header 'login-customer-id: 6446154552' \
--header 'Content-Type: application/json' \
--data '{ "operations": [{ "create": { "campaign": "customers/2220330728/campaigns/54542599977", "asset": "customers/2220330728/assets/54542600318", "fieldType": "LEAD_FORM" } }] }'{ "results": [{ "resourceName": "customers/2220330728/campaignAssets/54542599977~54542600318~LEAD_FORM" }] }Linking the same asset twice gives mutateError: RESOURCE_ALREADY_EXISTS. To unlink, remove the campaign asset (assets have no remove).
3. Generate a lead
In Mimicr, you play the user:
npx mimicr action google-ads lead.submit campaignId=54542599977 fields='{"FULL_NAME":"Maria Souza","PHONE_NUMBER":"+5511987654321"}'The lead generates a click (with gcl_id), a row in lead_form_submission_data and the webhook delivery. Fields you don't provide are filled with sample data. lead.send_test sends the same body with is_test: true, like Google Ads' "send test data" button, without storing a lead or a click.
The webhook body
POST {advertiserWebhookUrl} with Content-Type: application/json, fields in snake_case:
{
"lead_id": "Q2pTdmxlYWQtMTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkw",
"user_column_data": [
{ "column_name": "Full Name", "string_value": "Maria Souza", "column_id": "FULL_NAME" },
{ "column_name": "User Phone", "string_value": "+5511987654321", "column_id": "PHONE_NUMBER" },
{ "column_name": "User Email", "string_value": "maria@example.com", "column_id": "EMAIL" }
],
"api_version": "1.0",
"form_id": 54542600318,
"campaign_id": 54542599977,
"google_key": "segredo-do-formulario",
"is_test": false,
"gcl_id": "Cj0KCQ…",
"lead_submit_time": "2026-11-05T17:30:00Z"
}form_idandcampaign_idare JSON numbers: read them as 8-byte integers.column_nameis deprecated and may be missing; usecolumn_id. Custom questions come asCUSTOM_QUESTION_1,CUSTOM_QUESTION_2…- In Search campaigns,
adgroup_idandcreative_idare absent;asset_group_idonly appears in Performance Max.lead_stageonly appears afterlead.set_stage. - Test leads have
is_test: trueand alead_idstarting withTeSter-.
Verify and respond
app.post("/google-leads", express.json(), (req, res) => {
if (req.body.google_key !== process.env.GOOGLE_LEAD_SECRET) return res.status(401).json({ message: "invalid key" });
if (seen.has(req.body.lead_id)) return res.json({});
seen.add(req.body.lead_id);
queue.push(req.body);
res.json({});
});| Your response | What happens |
|---|---|
200 with {} | Delivered |
4xx | Not retried |
5xx, timeout (10 s) or connection error | Retried |
In Mimicr, retries happen 1 minute, 5 minutes, 30 minutes, 2 hours and 6 hours after the failure (6 attempts in total), and then the delivery becomes failed. Delivery is not exactly-once: deduplicate by lead_id. The webhook chaos (webhookDuplicateRate) sends the same lead twice so you can test this.
Track deliveries
npx mimicr wait google-ads delivery lead_id=<lead_id> status=delivered curl --url 'https://api.mimicr.dev/v1/google-ads/deliveries?status=failed' --header 'Authorization: Bearer mk_...'
Each delivery stores every attempt (status, response body, latency). POST /v1/google-ads/deliveries/{id}/resend or webhook.resend tries again.
Query leads through the API
SELECT lead_form_submission_data.id, lead_form_submission_data.gclid, lead_form_submission_data.lead_form_submission_fields, lead_form_submission_data.submission_date_time, lead_form_submission_data.campaign FROM lead_form_submission_data WHERE lead_form_submission_data.campaign = 'customers/2220330728/campaigns/54542599977'
In Mimicr, leads are available for 30 days after submission. See GAQL.