Navigation

Embedding & Snippet Parameters

Complete reference for all snippet attributes and customization options.

4 min read

AI Anywhere uses a JavaScript initialization pattern. After loading the Helper script, you initialize it with a configuration object. This reference explains each parameter, when to use it, and what values are valid.

Complete Integration Example

Here's a complete integration with all available parameters:

<!-- Load the Helper script with site ID (shared across site) -->
<script src="https://ai-anywhere.ai/sdk/v1/loader.js" data-site="your-site-id"></script>

<!-- Add Helper anchor next to your text area -->
<textarea id="message"></textarea>
<span data-helper-anchor data-helper-token="your-helper-token"></span>

Parameter Reference

Parameter Type Required Description
data-site String Yes Your site ID that identifies your account. This is shared across all pages on your site. Found in your dashboard when you create a site.
data-helper-anchor Attribute Yes This attribute marks where the Helper button should appear. Place it next to your text area or input field.
data-helper-token String Yes Unique token that identifies this specific Helper configuration. Each Helper instance requires its own unique token. Found in your dashboard when you create a Helper.

Script Tag: Site ID

The script tag that loads the Helper library requires:

  1. Script URL: The SDK loader script URL: /sdk/v1/loader.js
  2. Site ID: A data attribute that identifies your site and is shared across all pages on your site
<script src="https://ai-anywhere.ai/sdk/v1/loader.js" data-site="your-site-id"></script>

Site ID: Your site ID is provided when you create a site in your dashboard. Use the same site ID across all pages on your site. The script will automatically load all active Helpers for your site.

Required Parameters Explained

data-site

The site ID identifies your account and site. This is shared across all pages on your site. The script will automatically discover and load all active Helpers configured for your site.

Where to find it: When you create a site in your dashboard, you'll receive a unique site ID. Use the same site ID in the script tag on all pages where you want Helpers to be available.

data-helper-anchor

The anchor attribute marks where the Helper button should appear. Place the anchor span next to your text area or input field where you want the Helper button to be displayed.

Placement: The anchor can be placed anywhere near your text area. The Helper button will appear at this location when the page loads.

data-helper-token

The unique token that identifies this specific Helper configuration. Each Helper you create in your dashboard has its own unique token. This token tells the Helper which configuration (Helper Answer, keywords, button styling, etc.) to use.

Where to find it: When you create a Helper in your dashboard, you'll receive a unique Helper token. Each Helper instance on your page should use its own unique token. If you have multiple text areas, each can have its own Helper with a different token.

Minimal Working Example

At minimum, you need the script tag with site ID and an anchor span with Helper token:

<!-- In <head> section -->
<script src="https://ai-anywhere.ai/sdk/v1/loader.js" data-site="your-site-id"></script>

<!-- Next to your text area -->
<textarea id="message"></textarea>
<span data-helper-anchor data-helper-token="your-helper-token"></span>

That's it! The Helper will automatically attach to the anchor and display the button.