Documentation

GuideAI SDK Installation & Usage

Install the browser SDK (guideai.js), configure it with data-*attributes, and learn what's sent automatically vs. what you should send manually.

1) Install the SDK on your website

Add this to your HTML (usually near the end of <body>):

html
<script
  src="https://cdn.3guideai.com/sdk/guideai.js"
  data-site-id="YOUR_SITE_ID"
  data-token="YOUR_PUBLIC_TOKEN"
  data-api-url="https://api.3guideai.com"
  data-cdn-url="https://cdn.3guideai.com"
></script>

Notes

  • data-site-id and data-token are required. If either is missing, the SDK will not initialize.
  • data-api-url is strongly recommended. The SDK has a default, but you should set it explicitly.
  • data-cdn-url is the CDN base URL.

2) Public API (what you can call)

The SDK exposes a global window.guideai object (and a legacy alias window.__guideai) once loaded.

3) What the SDK sends automatically

When not in extensionMode, the SDK automatically emits:

Session + page basics

  • session_start (includes metadata like entry URL, referrer, device info, viewport, session number, etc.)
  • Initial page_view (with metadata.entry_page: true)
  • page_view on SPA navigations
  • page_exit with engagement + scroll metadata (time_on_page_ms, active_time_ms, idle_time_ms, max_scroll_depth_pct)

Interaction + friction

  • click, double_click, right_click
  • rage_click, dead_click
  • scroll
  • form_start, form_submit, form_abandon, form_error
  • js_error, network_error, ui_error

UTM + referrer capture

On the first load, if UTMs or referrer are present, the SDK emits an identify event with metadata.utm_* and metadata.referrer.

  • The SDK does not currently send a dedicated referrer_host; derive it from referrer server-side.
  • The SDK does notautomatically label clicks as “CTA clicks” unless your dashboard logic / click classifier marks them.

4) Configuration reference (script tag data-*)

Configuration is read from the <script> tag.

Required

AttributeTypeMeaning
data-site-idstringYour site/workspace ID
data-tokenstringPublic token (pk_live_...) used by the browser SDK

Endpoints

AttributeDefaultNotes
data-api-urlhttps://api.3guideai.comRecommended: set to https://api.3guideai.com
data-cdn-urlhttps://cdn.3guideai.comBase URL used for KB/assets (not /sdk/guideai.js)

Sessions + batching

AttributeDefaultMeaning
data-idle-timeout20000Idle threshold for engagement calculations (ms)
data-session-timeout-ms1800000Rotate session after inactivity (ms)
data-batch-size50Max events per batch
data-batch-interval-ms30000Flush interval (ms)

Privacy / enrichment

AttributeValuesDefaultMeaning
data-geolocationoff | granted-only | promptoffOptional browser geo enrichment

Guides + bubble

AttributeDefaultMeaning
data-guides-enabledtrueWhen false, guide playback is disabled
data-auto-advance-on-target-clicktrueAuto-advance guides on target click (when applicable)
data-bubble-enabledtrueShow the bubble entry point
data-bubble-positionbottom-rightBubble placement
data-bubble-labelHelpBubble label
data-bubble-iconrobotMascot id (or use data-bubble-image)
data-bubble-imageemptyCustom image URL that overrides icon
data-bubble-modedriftBubble motion mode
data-widget-modeguideHow bubble behaves when support is enabled

Recording + feedback

AttributeDefaultMeaning
data-recordingfalseEnables session recording
data-feedback-auto-prompttrueAuto-prompt feedback
data-feedback-prompt-delay-ms30000Delay before prompting (ms)
data-feedback-prompt-min-pageviews2Minimum page views before prompting

Extension mode

AttributeDefaultMeaning
data-extension-modefalseWhen true, disables analytics/tracking/support because the “visitor” is an extension user

Announcements

AttributeDefaultMeaning
data-announcement-surfacemodalDefault surface when opening from beacon
data-announcement-close-on-backdroptrueClose announcement when clicking backdrop

Attributes that are currently ignored

These script attributes are currently not read by parseConfig():

  • data-track-all
  • data-behavioral-triggers

5) How to update configuration

Update via dashboard (recommended)

Some settings are applied from the backend knowledge base load. Update settings in the dashboard, then reload the page (or re-initialize the SDK) to apply changes.

Update via script tag

Change <script data-*> attributes and redeploy your site. These are read during initialization.

Runtime updates

updateOptions() is for visitor/account identity metadata, not for changing widget configuration at runtime. To hot swap config:

  1. call guideai.destroy()
  2. remove the script tag (optional)
  3. re-insert the script tag with updated data-*

6) Knowledge Base & Scanner (how GuideAI understands your UI)

GuideAI's knowledge base (KB) describes your app routes, interactive elements, and a hierarchical UI map used by AI for more accurate guidance.

Ways to get a KB into GuideAI

  1. Run the scanner (recommended for most teams)
  2. Upload a KB JSON directly from the dashboard Knowledge Base page

Privacy note: the scanner is designed to extract structure needed for guidance (routes/elements/UI map). It is not intended to collect secrets.

Scanner source (public): github.com/3gensolution/guideai-scanner

7) GuideAI Scanner — Installation & Usage Guide

GuideAI Scanner scans your web app, detects your framework, extracts routes and interactive elements, and builds a knowledge base for AI-powered guidance.

Installation

bash
npm i @guideai/scanner

Or globally:

bash
npm i -g @guideai/scanner

Quick Start

Command-Line Options

OptionDescriptionDefaultRequired
--dry-runOutput JSON without uploadingfalseNo
--dirProject root directorycwdNo
--outputSave scan result to JSON fileNo
--api-urlGuideAI API endpointhttps://cdn.3guideai.comNo
--keySite API key for uploadsYes (unless --dry-run)

Common Usage Patterns

bash
# Preview scan:
npx guideai-scan --dry-run

# Save results to a file:
npx guideai-scan --dry-run --output scan-results.json

# Upload:
npx guideai-scan --key sk_live_your_api_key

# Scan a specific directory:
npx guideai-scan --dir /path/to/project --dry-run

# Scan, save, and upload:
npx guideai-scan --key sk_live_your_api_key --output scan-results.json

Knowledge Base Output Structure

json
{
  "framework": "nextjs-app-router",
  "routes": [],
  "elements": [],
  "ui_map": { "root": {} },
  "duration_ms": 1234
}

Upload KB JSON from the dashboard

If you already have a scan JSON (from CI, from a teammate, or from a dry-run output file), you can upload it from the dashboard Knowledge Base page.

8) Troubleshooting

Need help? Contact us from Privacy Policy or explore Pricing.