Skip to content

Send the fdh_not_opened survey trigger from the dashboard #14144

Todo

Description

@techanvil

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_opened survey 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_TTL constant, set to 2,147,483,647 seconds (2 ** 31 - 1, the largest signed 32-bit integer), to assets/js/googlesitekit/datastore/user/constants.js. It is used as the ttl for triggers that must be sent once per user, and is shared with Send the fdh_opened_* survey triggers from the hub #14145.
  • Add the survey trigger ID, fdh_not_opened, to assets/js/components/feature-discovery/constants.ts, next to FEATURE_DISCOVERY_VISITED_ITEM_SLUG.
  • Add the hook useFeatureDiscoveryNotOpenedSurveyTrigger in assets/js/components/feature-discovery/, following useExpressSetupDashboardSurveyTriggers. The hook does nothing unless the featureDiscoveryHub flag is on. It sends the trigger when all of these are true:
    • isAuthenticated() is true.
    • isItemDismissed( FEATURE_DISCOVERY_VISITED_ITEM_SLUG ) is false.
    • getNewFeatureCount() is 1 or more.
    • getAvailableFeatures() has 2 or more items.
  • Wait until every value the hook reads has loaded (each selector returns undefined while loading) before deciding. Never send the trigger on a partial result.
  • Send the trigger with triggerSurvey() from CORE_USER, using SURVEY_TRIGGER_MAX_TTL as the ttl.
  • Call the hook from DashboardMainEffectComponent.

Test Coverage

  • Add tests for the hook in useFeatureDiscoveryNotOpenedSurveyTrigger.test.ts covering:
    • The trigger is sent with SURVEY_TRIGGER_MAX_TTL once all conditions are met.
    • No trigger when the hub was already visited.
    • No trigger when the featureDiscoveryHub flag is off.
    • No trigger when the user is not authenticated.
    • No trigger while any value the hook reads is still loading.
  • Fix any existing DashboardMainApp or 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 featureDiscoveryHub feature 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 POST to core/user/data/survey-trigger with triggerID fdh_not_opened and ttl 2147483647.
  • Reload the dashboard. Verify no new survey-trigger request is sent.
  • Open Add features, then return to the main dashboard. Verify no survey-trigger request 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

  1. self-assigned this
    on Nov 11, 2026
  2. added
    P0
    Type: Enhancement
    Team M
    on Nov 11, 2026
  3. removed their assignment
    on Nov 11, 2026
  4. added
    Next Up
    on Nov 12, 2026
  5. self-assigned this
    on Nov 12, 2026
  6. techanvil commented on Nov 12, 2026

    @techanvil
    CollaboratorAuthor

    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_TTL in datastore/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.

  7. ncoetzer commented on Nov 12, 2026

    @ncoetzer
    Collaborator

    @techanvil Thank you for the review and feedback. I've replaced the dismissed item with a SURVEY_TRIGGER_MAX_TTL constant. 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!

  8. removed their assignment
    on Nov 12, 2026
  9. 4 remaining items

  10. self-assigned this
    on Nov 23, 2026
  11. kelvinballoo commented on Nov 23, 2026

    @kelvinballoo
    Collaborator

    ⚠️ QA Update

    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

    • featureDiscoveryHub flag on
    • Tester plugin: Force initial Site Kit plugin version set to 1.178.0
    • Admin signed in to Site Kit with Google, who has never opened Add features
    • DevTools Network tab filtered by survey-trigger, with Preserve log on

    Steps

    1. Opened the main Site Kit dashboard.
      ✅ One POST to core/user/data/survey-trigger with triggerID: fdh_not_opened and ttl: 2147483647.
    2. Reloaded the dashboard.
      ❌ Another POST to core/user/data/survey-trigger with fdh_not_opened. Expected no new request.
    3. Reloaded again a few more times.
      ❌ The trigger was sent on every reload.
    4. Opened Add features, then went back to the dashboard.
      ✅ No survey-trigger request. 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
  12. ncoetzer commented on Nov 24, 2026

    @ncoetzer
    Collaborator

    @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_dashboard and fdh_not_opened overlap 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.

  13. techanvil commented on Nov 24, 2026

    @techanvil
    CollaboratorAuthor

    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?

  14. removed their assignment
    on Nov 24, 2026
  15. ncoetzer commented on Nov 24, 2026

    @ncoetzer
    Collaborator

    @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, and view_ads_setup_cta. On the next reload, only two were sent: view_pdf_export_not_used and fdh_not_opened, meaning the other two were saved successfully. On the last reload, only fdh_not_opened was triggered again. If you reload one more time, the last fdh_not_opened should not trigger again.

  16. removed their assignment
    on Nov 24, 2026
  17. kelvinballoo commented on Nov 24, 2026

    @kelvinballoo
    Collaborator

    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
  18. removed their assignment
    on Nov 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P0Team MType: Enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions