Skip to content

Send the page and its section with Webchat messages - #101

Merged
rockwellll merged 3 commits into
mainfrom
webchat-page
Nov 3, 2026
Merged

rockwellll merged 3 commits into
mainfrom
webchat-page

Conversation

@rockwellll

@rockwellll rockwellll commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Lets store integrations tell the SDK which kind of page the visitor is on, and sends that page with Webchat messages and opens. The Webchat report counts where conversations start from it: homepage, product pages (details and collections) and other pages.

The backend that stores it is hellotext/hellotext#6844. The Shopify storefront block and the VTEX pixel already work out the section for the Smart Alert; setting Hellotext.page.section there comes next.

Behavior

  • Hellotext.page.section. Settable to homepage, product_collection or product_details, the values Hellotext.alert.show already takes. Any other value clears it. The section belongs to the page route it was set on: the path plus its hash route (#/… or #!/…), the same route Hellotext uses for page views. It clears itself when the visitor navigates, including client-side and hash-route navigation, and stays on the same route when only the query string or a plain anchor changes. Page.route now holds that rule, and Hellotext.pageRoute uses it.
  • Tracked events. trackingData.page includes section when one is set, so every Hellotext.track call reports it. An event tracked with its own url builds a fresh page and has no section.
  • Webchat messages. WebchatMessagesAPI#create adds message[page][url], [title], [path] and [section] from Hellotext.page, which covers typed messages, quick replies, and button and product replies.
  • Webchat opens. webchat.opened no longer passes its own url, so it is tracked with the current page and its section. The backend falls back to page.url for the open's URL.

index.d.ts types Hellotext.page, and docs/tracking.md documents setting the section.

Build

lib/ and dist/ rebuilt with yarn build from a fresh yarn install --frozen-lockfile.

Test plan

  • Page: a known section is kept and tracked, an unknown one clears it, and it clears on navigation and on a hash route change but not on a new query string or anchor
  • Webchat messages send the page and its section
  • webchat.opened is tracked without its own url
  • yarn test: 1,137 tests pass

🤖 Generated with Claude Code

Store integrations know which kind of page the visitor is on. They can
now set Hellotext.page.section to homepage, product_collection or
product_details; it belongs to the path it was set on and clears itself
on navigation. Every tracked event reports it with the page, and Webchat
messages send the same page, so the Webchat report can count where
conversations start.

webchat.opened no longer passes its own url, so it is tracked with the
current page and its section.

Rebuilt lib and dist.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-03T16:29:01.707856Z 47ba541 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c7369e8ebd

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/models/page.js Resolved
rockwellll and others added 2 commits November 3, 2026 13:25
On hash-routed storefronts the pathname stays the same between pages, so
a section set on /#/products/shirt was still reported on /#/checkout.
The section now belongs to the page route Hellotext already uses for page
views: the path plus its hash route, without the query string or a plain
anchor. Page.route holds that rule, and Hellotext.pageRoute uses it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Page.route fell back to document.location and a localhost URL when
window.location had no href, which no browser does. It now resolves
against window.location.href alone, and the Hellotext specs that mocked
a location without an href give it one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rockwellll
rockwellll merged commit b2d00b7 into main Nov 3, 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