LaraCopilot
LaraCopilot
Integrations

Ask AI Widget

Embed a floating "Ask AI" button on a website so visitors can ask questions and get answers drawn straight from the LaraCopilot documentation.

The Ask AI Widget is a lightweight, embeddable assistant. It adds a floating Ask AI button to a web page; clicking it opens a chat panel where visitors can ask questions in plain English and get answers generated from the LaraCopilot documentation — without leaving the page or signing in.

It's a single script tag with no build step, no dependencies, and no API keys to manage on the page.

Adding the widget

Drop this script tag into the page, just before the closing </body>:

<script src="https://docs.laracopilot.com/ask-ai-widget.js" async defer></script>

That's all that's required — the script injects the button, the chat panel, and all of its styling on its own. The panel loads in an isolated iframe, so it won't clash with the host page's CSS or JavaScript.

The widget only loads on approved domains. The list of allowed origins is configured by LaraCopilot, so the script works on LaraCopilot properties out of the box. If you need it enabled for another domain, contact support.

Positioning options

Two optional data- attributes control where the button sits:

AttributeValuesDefaultPurpose
data-positionbottom-right, bottom-left, top-right, top-leftbottom-rightWhich corner the button anchors to
data-offset020020Distance, in pixels, from the corner

For example, to pin the button to the bottom-left with a larger margin:

<script
  src="https://docs.laracopilot.com/ask-ai-widget.js"
  data-position="bottom-left"
  data-offset="32"
  async defer
></script>

What visitors experience

  • A floating Ask AI button appears in the chosen corner.
  • Clicking it opens a chat panel; on small screens it expands to fill the viewport.
  • Visitors type a question and the answer streams back, sourced from the LaraCopilot docs.
  • The panel follows the host page's light or dark theme.
  • No account or login is needed — it works anonymously.

Managing widgets (administrators)

On a LaraCopilot instance, the script tag is added through Admin → Widgets rather than by editing page templates. From there an administrator can:

  • Add a widget by giving it a name and pasting the script tag
  • Restrict it to specific pages (by route), or leave it on every non-admin page
  • Toggle a widget active or inactive without deleting it
  • Delete a widget

Widgets never render on admin pages.

Rate limits

To prevent abuse, requests are limited to 30 questions per hour per visitor (by IP address). A visitor who exceeds the limit sees a message asking them to wait before trying again.

Troubleshooting

ProblemSolution
Button doesn't appearConfirm the script tag is present and that the page's domain is on the approved-origins list.
Answers stop with a "please wait" messageThe hourly per-visitor rate limit was reached — wait and retry.
Button overlaps other page elementsAdjust data-position and data-offset to move it to a clear corner.

On this page