Configure forms & custom fields
The widget form is fully configurable — add any fields you need. Standard fields
(name,
email,
phone) map to lead columns.
Every other field is stored as Additional Info and shown in the dashboard automatically.
1. The floating button
This is what visitors see on your site before clicking — a small branded button anchored to the corner of the screen.
Desktop (bottom-right)
Mobile (bottom-right)
Icon-only on small screens
Controls
| data-title | Button label (e.g. "Talk to us", "Get a quote") |
| data-accent | Button colour — any hex (e.g. #E53935) |
| data-position | "left" or "right" |
2. The open form — with custom fields
When the visitor clicks the button, a form panel slides up. You control exactly which fields appear using data-fields.
Here's an example with four fields — two standard, two custom.
Your snippet
data-fields='[
{"name":"name", "label":"Your name", "required":true},
{"name":"email", "label":"Email", "required":true},
{"name":"company", "label":"Company", "required":false},
{"name":"message", "label":"How can we help?", "required":false}
]'
Desktop — form open
Mobile — form open
name
email
phone
are stored as searchable lead columns.
Everything else — company, message, budget, any name you choose —
is stored as Additional Info and is always visible on the lead detail page.
3. What gets sent to the API
When the visitor submits the form above, the widget automatically builds and POSTs this JSON to https://swiftcrm.in/api/public/lead:
{
"name": "Jane Smith",
"email": "[email protected]",
"attributes": {
"company": "Acme Corp",
"message": "I'd like a demo of the product."
},
"source_url": "https://yoursite.com/pricing",
"referrer": "https://google.com",
"utm": {
"utm_source": "google",
"utm_medium": "cpc",
"utm_campaign": "spring-sale"
}
}
source_url, referrer, and utm are captured automatically by the widget — you don't need to configure them.
Equivalent curl
curl -X POST "https://swiftcrm.in/api/public/lead" \
-H "Content-Type: application/json" \
-H "X-Api-Key: YOUR_PROJECT_API_KEY" \
-d '{
"name": "Jane Smith",
"email": "[email protected]",
"attributes": {
"company": "Acme Corp",
"message": "I'\''d like a demo of the product."
}
}'
Success response 201 Created:
{
"code": "LEAD_CREATED",
"message": "Lead captured.",
"request_id": "req_01j9abc123",
"lead_id": 42
}
4. How it looks in the dashboard
Open any lead in SwiftCRM → the right sidebar shows all captured data. Custom fields appear under Additional Info as a clean key-value table — no configuration needed.
Details
Capture info
Source: yoursite.com/pricing
UTM Parameters
Additional Info
The yellow-highlighted rows are your custom fields — they appear automatically for any attributes data.
5. Field configuration reference
Each item in data-fields is a JSON object:
| Property | Type | Description |
|---|---|---|
| name | string | Field key. Use name, email, phone for standard columns; anything else becomes an attribute. |
| label | string | Display label shown above the input. |
| required | boolean | Whether the field is required. Required fields show a red asterisk (*) and block submission if empty. |
Common examples
Minimal — just email
data-fields='[{"name":"email","label":"Your email","required":true}]'
Contact form — name + email + message
data-fields='[
{"name":"name", "label":"Full name", "required":true},
{"name":"email", "label":"Email", "required":true},
{"name":"message", "label":"Message", "required":false}
]'
Sales enquiry — name + email + company + budget
data-fields='[
{"name":"name", "label":"Your name", "required":true},
{"name":"email", "label":"Work email", "required":true},
{"name":"company", "label":"Company", "required":false},
{"name":"budget", "label":"Budget (USD)","required":false}
]'
Support request — email + subject + description
data-fields='[
{"name":"email", "label":"Email", "required":true},
{"name":"subject", "label":"Subject", "required":true},
{"name":"description", "label":"Description", "required":false}
]'
Next: API reference for the full payload spec, or Examples for curl, JavaScript, and PHP.