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. You can find this in your dashboard under Smart Intake → Connect Your Site:

index.htmlhtml
<script
  src="https://kantos.ai/api/intake/script/YOUR_ORG_SLUG"
  async>
</script>

Pre-Configured Script

This org-specific script URL has your credentials baked in — no extra attributes needed. Your intake key is scoped to your allowed domains for security.

Configuration Attributes

When using the org-specific script URL (/api/intake/script/YOUR_ORG_SLUG), no required attributes are needed — credentials are baked in. You can optionally add these attributes for advanced configuration:

Optional Attributes

AttributeDefaultDescription
data-debugfalseEnable 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-hiddenfalseInclude hidden input fields in captured data. Useful for tracking IDs.
data-identify-fieldemailField name to use for contact identification.

Example with All Options

<script
  src="https://kantos.ai/api/intake/script/YOUR_ORG_SLUG"
  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 MutationObserver to detect dynamically added forms
  • Skips forms with data-kantos-ignore attribute
  • 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:

payload.jsonjson
{
  "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/api/intake/script/YOUR_ORG_SLUG"
  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: kantos_...

{
  "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 your script src URL contains the correct org slug
  • 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
    Universal Script - Smart Intake | Kantos Docs