Smart Intake
Universal Script
Capture forms from any website with zero code.
The Universal Script is a lightweight JavaScript file (~3KB gzipped) that automatically captures form submissions from any website and sends them to your Kantos CRM.
Installation
Add the following script tag to your website's <head> section:
<script
src="https://kantos.ai/intake.js"
data-org-id="YOUR_ORG_ID"
data-api-key="pk_live_your_key_here"
async>
</script>Use Publishable Keys Only
Only use publishable API keys (pk_live_...) in client-side code. Never expose secret keys.
Configuration Attributes
Required Attributes
| Attribute | Description |
|---|---|
data-org-id | Your organization UUID from the Kantos dashboard |
data-api-key | Publishable API key starting with pk_live_ |
Optional Attributes
| Attribute | Default | Description |
|---|---|---|
data-debug | false | Enable console logging for debugging. Set to true to see script activity in browser console. |
data-ignore-selectors | "" | Comma-separated CSS selectors for forms to ignore. Example: .no-track, #internal-form |
data-capture-hidden | false | Include hidden input fields in captured data. Useful for tracking IDs. |
data-identify-field | email | Field name to use for contact identification. |
Example with All Options
<script
src="https://kantos.ai/intake.js"
data-org-id="abc123-def456-..."
data-api-key="pk_live_xyz789..."
data-debug="true"
data-ignore-selectors=".internal-form, #admin-login"
data-capture-hidden="true"
data-identify-field="email"
async>
</script>How It Works
1. Initialization
When the script loads:
- Reads configuration from script tag attributes
- Waits for DOM to be ready
- Initializes form discovery
2. Form Discovery
The script automatically:
- Finds all
<form>elements on the page - Uses
MutationObserverto detect dynamically added forms - Skips forms with
data-kantos-ignoreattribute - Skips forms matching ignore selectors
3. Honeypot Injection
For spam protection, the script:
- Adds a hidden honeypot field to each form
- Uses CSS to hide it (not display:none, which bots detect)
- Bots that fill this field are flagged as spam
4. Submit Interception
When a form is submitted:
- Script captures all form field values
- Collects metadata (URL, referrer, timestamp, screen size)
- Sends data via
navigator.sendBeacon()(non-blocking) - Does NOT prevent default - form submits normally
Data Payload
Each submission sends the following structure:
{
"source": "intake.js",
"version": "1.0.0",
"page_url": "https://example.com/contact",
"referrer": "https://google.com",
"form_id": "contact-form",
"form_action": "/submit",
"fields": {
"name": "John Doe",
"email": "john@example.com",
"message": "Hello..."
},
"metadata": {
"timestamp": "2024-01-15T10:30:00Z",
"user_agent": "Mozilla/5.0...",
"screen_width": 1920
}
}Ignoring Forms
Using data-kantos-ignore
Add the attribute directly to forms you want to exclude:
<!-- This form will NOT be captured -->
<form action="/login" data-kantos-ignore>
<input type="email" name="email" />
<input type="password" name="password" />
<button type="submit">Log In</button>
</form>Using Ignore Selectors
Or use CSS selectors in the script configuration:
<script
src="https://kantos.ai/intake.js"
data-org-id="..."
data-api-key="..."
data-ignore-selectors=".internal, #login-form, [data-internal]"
async>
</script>Error Handling
The script is designed to fail silently:
- Never breaks your website functionality
- Warnings only appear in console when
data-debug="true" - Network errors are logged but don't affect form submission
Debugging
Enable data-debug="true" during development to see detailed logs in your browser console.
Browser Support
The script supports all modern browsers:
- Chrome 60+
- Firefox 55+
- Safari 11+
- Edge 79+
Internet Explorer is not supported due to lack of navigator.sendBeacon().
Performance
- Script size: ~3KB gzipped
- Load time: <50ms
- Form capture overhead: <5ms
- Non-blocking: Uses async loading and sendBeacon
API Endpoint
Submissions are sent to POST /api/ingest:
POST https://kantos.ai/api/ingest
Content-Type: application/json
X-Api-Key: pk_live_...
{
"source": "intake.js",
"fields": { ... },
"metadata": { ... }
}Alternative: Direct Form Action
For platforms where you can't add JavaScript, use the form action method:
<form
action="https://kantos.ai/api/ingest?org_id=...&api_key=...&redirect_to=https://mysite.com/thanks"
method="POST"
>
<input type="text" name="name" />
<input type="email" name="email" />
<button type="submit">Submit</button>
</form>This method redirects to your thank-you page after submission. See Wix Integration for webhook-based alternatives.
Troubleshooting
Forms not being captured
- Check that
data-org-idanddata-api-keyare correct - Enable
data-debug="true"and check console - Verify the form doesn't have
data-kantos-ignore - Check that the form isn't in an iframe from a different domain
CORS errors
The intake endpoint supports CORS from any origin. If you see CORS errors:
- Ensure you're using a publishable key
- Check that the request is going to
kantos.ai
Rate limiting
If you exceed 100 requests/minute, submissions may be throttled. Consider:
- Using separate keys for different sites
- Implementing client-side throttling
- Contact support for higher limits