Skip to content

Kai Code: Keep the start URL's query when redirecting to start a product tour - #218

Merged
TobiasDuelli merged 1 commit into
masterfrom
kai-code/6afb09cb89dd294a61737312-addb9dd0-e586-40d7-80dd-0c08d96f8b8f
Nov 16, 2026
Merged

TobiasDuelli merged 1 commit into
masterfrom
kai-code/6afb09cb89dd294a61737312-addb9dd0-e586-40d7-80dd-0c08d96f8b8f

Conversation

@kai-by-gleap

@kai-by-gleap kai-by-gleap Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Root cause: When a checklist step starts a product tour from another page, the SDK sends the visitor to the tour's start page with the tour ID added to the address. It always added it after a "?". This tour's start address already contains a "?" (?view=list), so the link ended up with two "?" marks. The customer's app then showed a different view, and the SDK couldn't find the tour ID, so the tour never started. Gleap still listed the visitor as a recipient, because it records the tour as sent before it is drawn on the page.

Tip

Fix: The redirect now adds the tour ID to the address's existing settings (?view=list&gleap_tour=…) and keeps any # part at the end. The tour starts after the redirect. The change is in JavaScript-SDK/src/Gleap.js, and src/GleapProductTourStart.test.js tests it.

Automated changes by Kai Code.

When a checklist step (or banner/modal/messenger action) starts a product tour on another page, Gleap.startProductTour redirected to ${startURL}?gleap_tour=…&gleap_tour_delay=1. A start URL that already has a query (e.g. /workspaces?view=list) became ?view=list?gleap_tour=…: the host app got a corrupted view value and checkForUrlParams found no gleap_tour param, so the tour never started after the redirect (Gleap #229004).

The redirect URL is now built with the URL API (Gleap.buildTourStartUrl), which appends the tour params to the existing query, keeps the hash, and resolves relative start URLs; a string fallback picks & vs ? if the URL can't be parsed. Regression tests in src/GleapProductTourStart.test.js cover a start URL without a query, with a query, and with a hash.

Not changed: the server still records the tour as sent when the config is fetched, before the tour renders.

🤖 Generated with Claude Code

Gleap ticket: View in Gleap

Checked by Kai Code

  • ✅ JavaScript-SDK: src/GleapProductTourStart.test.js fails on the base branch and passes with this change (npm test -- $KAI_TESTS)
  • ✅ test (3 s)

…#229004)

A start URL with a query string got a second '?', so the gleap_tour
param was lost after the redirect and the tour never started.

Co-Authored-By: Claude <noreply@anthropic.com>
@TobiasDuelli
TobiasDuelli merged commit a66df38 into master Nov 16, 2026
1 check passed
@TobiasDuelli
TobiasDuelli deleted the kai-code/6afb09cb89dd294a61737312-addb9dd0-e586-40d7-80dd-0c08d96f8b8f branch November 18, 2026 20:33
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