Repository navigation
Todo
Labels
Description
Feature Description
Send the fdh_not_opened survey trigger from the main dashboard, so the Site Kit service can survey admins who haven't opened the Feature Discovery Hub ("Add features") yet. The service decides when to show the survey, and stops showing it once the user has opened the hub.
Do not alter or remove anything below. The following sections will be managed by moderators only.
Acceptance criteria
- When an authenticated user opens the main dashboard, the plugin sends the
fdh_not_openedsurvey trigger if all the following conditions are true:- They have never opened the "Add features" page.
- At least one feature is unread.
- At least two features aren't set up yet.
- The trigger is sent at most once per user.
Implementation Brief
- Add a
SURVEY_TRIGGER_MAX_TTLconstant, set to 2,147,483,647 seconds (2 ** 31 - 1, the largest signed 32-bit integer), toassets/js/googlesitekit/datastore/user/constants.js. It is used as thettlfor triggers that must be sent once per user, and is shared with Send thefdh_opened_*survey triggers from the hub #14145. - Add the survey trigger ID,
fdh_not_opened, toassets/js/components/feature-discovery/constants.ts, next toFEATURE_DISCOVERY_VISITED_ITEM_SLUG. - Add the hook
useFeatureDiscoveryNotOpenedSurveyTriggerinassets/js/components/feature-discovery/, followinguseExpressSetupDashboardSurveyTriggers. The hook does nothing unless thefeatureDiscoveryHubflag is on. It sends the trigger when all of these are true:isAuthenticated()istrue.isItemDismissed( FEATURE_DISCOVERY_VISITED_ITEM_SLUG )isfalse.getNewFeatureCount()is 1 or more.getAvailableFeatures()has 2 or more items.
- Wait until every value the hook reads has loaded (each selector returns
undefinedwhile loading) before deciding. Never send the trigger on a partial result. - Send the trigger with
triggerSurvey()fromCORE_USER, usingSURVEY_TRIGGER_MAX_TTLas thettl. - Call the hook from
DashboardMainEffectComponent.
Test Coverage
- Add tests for the hook in
useFeatureDiscoveryNotOpenedSurveyTrigger.test.tscovering:- The trigger is sent with
SURVEY_TRIGGER_MAX_TTLonce all conditions are met. - No trigger when the hub was already visited.
- No trigger when the
featureDiscoveryHubflag is off. - No trigger when the user is not authenticated.
- No trigger while any value the hook reads is still loading.
- The trigger is sent with
- Fix any existing
DashboardMainAppor effect-component tests that start failing because of the new survey request. - No Storybook story is needed because the change adds no UI. No VRT changes expected.
QA Brief
- Use a site with the
featureDiscoveryHubfeature flag on. - In the tester plugin settings (General), set Force initial Site Kit plugin version to
1.178.0, so that at least one feature counts as unread. - Use an administrator who is signed in to Site Kit with Google and has never opened Add features.
- Open DevTools, go to the Network tab, filter by
survey-trigger, and tick Preserve log. - Open the main Site Kit dashboard. Verify there is one
POSTtocore/user/data/survey-triggerwithtriggerIDfdh_not_openedandttl2147483647. - Reload the dashboard. Verify no new
survey-triggerrequest is sent. - Open Add features, then return to the main dashboard. Verify no
survey-triggerrequest is sent.
Notes for the tester
- The trigger has no visible UI, so the Network request is the only thing to check.
- Survey timeouts are stored on the server for each user. After the first request, this administrator never sends it again, so the last step passes whatever the conditions are. To repeat the positive check, use another administrator who has not opened the hub.
- Opening Add features marks the features as read and the hub as visited, so the trigger also stops for that user for those reasons.
Changelog entry
- N/A.
Activity
techanvil commentedon Nov 12, 2026
Hi @ncoetzer, thanks for drafting this IB.
Rather than using a dismissed item, let's set the survey TTL to a maximum safe value - 2,147,483,647 seconds (2³¹ - 1, the highest signed 32 bit integer, to support 32 bit PHP).
This is about 68 years, which is good enough for "once per user".
Please define it in a constant:
SURVEY_TRIGGER_MAX_TTLindatastore/user/constants.js. We'll use the same constant in #14145.Another, smaller detail - the hook doesn't need to check the view context, as it's only invoked on the main dashboard anyway.
ncoetzer commentedon Nov 12, 2026
@techanvil Thank you for the review and feedback. I've replaced the dismissed item with a
SURVEY_TRIGGER_MAX_TTLconstant. This also drops the failed-request handling and the "second send" guard. Also removed the view context. The IB is updated and ready for another review. Thanks!4 remaining items
kelvinballoo commentedon Nov 23, 2026
I tested the happy path from the QA Brief. The trigger fires correctly on the first dashboard load, but it fires again on every reload. The AC says it should be sent at most once per user.
Setup
featureDiscoveryHubflag on1.178.0survey-trigger, with Preserve log onSteps
✅ One
POSTtocore/user/data/survey-triggerwithtriggerID: fdh_not_openedandttl: 2147483647.❌ Another
POSTtocore/user/data/survey-triggerwithfdh_not_opened. Expected no new request.❌ The trigger was sent on every reload.
✅ No
survey-triggerrequest. It only stopped because I visited the hub.Expected: Sent once per user. Later reloads send nothing, whatever the conditions are (per the QAB's "Notes for the tester").
Actual: Sent on every dashboard load until the user opens the hub.
Details
14144.-.01.-.reload.and.fired.not.ok.mov
ncoetzer commentedon Nov 24, 2026
@kelvinballoo Thanks for the review and for flagging the issue.
@techanvil While re-running through the QAB steps again, I reproduced what Kelvin reported where survey triggers can sometimes be sent again on reload. The same thing happens with the triggers from #14145.
Cause: the server keeps all "already sent" survey timeouts in one list. Each trigger request reads the list, adds its own entry and writes the whole list back (
Survey_Timeouts::add). When two requests overlap, the later write replaces the earlier one, so one timeout is lost. The next reload sends that trigger again. Once it is sent alone, its timeout saves and nothing more is sent.For example, on my local dashboard,
view_dashboardandfdh_not_openedoverlap and only one is saved. On the next reload, the remaining one is triggered again. On a third reload, nothing triggers again since both were already saved. This means if a larger set of triggers are competing/overlapping at the same time, only a few triggers win, and the others are lost. The cycle continues through subsequent reloads until all are saved. The risk is that some survey triggers might not fire just once per user as the AC asks.Is this behavior expected/accepted? If a repeated trigger can cause a survey to show again, perhaps a workaround is needed to queue triggers with a
ttl, so they are sent one at a time and avoid overlapping triggers to get lost.techanvil commentedon Nov 24, 2026
Hi @ncoetzer @kelvinballoo, thanks for flagging this.
It's actually harmless for these survey triggers to be sent multiple times, as the service will only send the survey once regardless of how many times it's triggered.
We still want to fix this, but to be pragmatic we can allow this to pass QA and address this in a followup.
Neil, please can you create an issue for this?
ncoetzer commentedon Nov 24, 2026
@techanvil Thank you for the clarification. I’ve created the follow-up issue under #14258
@kelvinballoo Can you retest based on the feedback here? Subsequent reloads may resend triggers, but after a few reloads, the repeats stop once the trigger is saved.
For example, in your recording on the first load, there were four triggers:
view_dashboard,view_pdf_export_not_used,fdh_not_opened, andview_ads_setup_cta. On the next reload, only two were sent:view_pdf_export_not_usedandfdh_not_opened, meaning the other two were saved successfully. On the last reload, onlyfdh_not_openedwas triggered again. If you reload one more time, the lastfdh_not_openedshould not trigger again.kelvinballoo commentedon Nov 24, 2026
QA Update ✅
Thanks @ncoetzer @techanvil
Retested and actually this round, I did not see the request a second time.
Moving this to approval.
Details
14144.retest.ok.mov