Skip to content

Chat widget: Report opens and ratings for the usage dashboard - #289

Merged
Petr-Klinger-1 merged 1 commit into
mainfrom
petr/docs
Oct 28, 2026
Merged

Petr-Klinger-1 merged 1 commit into
mainfrom
petr/docs

Conversation

@Petr-Klinger-1

Copy link
Copy Markdown
Contributor

What

The chat widget reports three usage events to the chatbot backend, which counts them on a ThingsBoard device (app.hardwario.cloud) for a usage dashboard:

  • chat_opened when the panel opens
  • rating_up / rating_down when an answer is rated

Only the event name is sent ({"event": "chat_opened"}), with no question, answer or page. The endpoint is derived from chatApiUrl (/api/chat → /api/event). The request is text/plain (no CORS preflight) with keepalive, fire and forget: a failure never affects the chat. Ratings still go to the Google Form as before.

question_sent is counted by the backend itself, so the widget doesn't send it.

Depends on

Petr-Klinger-1/docs-chatbot#6, which adds /api/event. Merge and deploy that first. Until then these requests 404 silently and nothing is counted.

Testing

tsc reports no errors in the widget. Only events from https://docs.hardwario.com are counted, so local and preview builds won't show up on the dashboard.

🤖 Generated with Claude Code

Posts chat_opened, rating_up and rating_down to the backend's /api/event,
which counts them on the ThingsBoard device. Only the event name is sent;
the Google Form ratings are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
website-hardwario-docs f2fb159 Commit Preview URL

Branch Preview URL
Oct 28 2026, 09:08 AM

@Petr-Klinger-1
Petr-Klinger-1 merged commit e5dcf85 into main Oct 28, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant