Skip to content

feat(iot-hub): track hero dropdown search queries in dataLayer#532

Merged
vvlladd28 merged 1 commit into
mainfrom
feat/iot-hub-hero-search-tracking
Jul 1, 2026
Merged

feat(iot-hub): track hero dropdown search queries in dataLayer#532
vvlladd28 merged 1 commit into
mainfrom
feat/iot-hub-hero-search-tracking

Conversation

@vvlladd28

Copy link
Copy Markdown
Member

Summary

The IoT Hub hero search popup on /iot-hub/ runs its own fetch/render code path (IotHubHero.astro) and never pushed an iot_hub_query event to the GTM dataLayer. As a result, live dropdown queries — what users type directly on the home page hero — were invisible to GTM/GA4. Only submitted searches that land on /iot-hub/search/ were tracked, via trackQuery() in iot-hub-dynamic-search.ts.

This mirrors that tracking in the hero popup so the dropdown counts as a search surface too.

Changes

  • Add trackQuery() in the hero popup's setupPopup, called from the fetch .then once results resolve:
    • fires once per distinct trimmed term (de-duped via lastTrackedQuery)
    • skips empty terms (empty-input focus doesn't count)
    • search_results_count uses the shown item count (incl. 0 for zero-result queries)
    • search_surface: 'all', search_filters: '', search_sort: DEFAULT_IOT_HUB_SORT_ID

Ref: PROD-8434

The IoT Hub hero search popup ran its own fetch/render path and never
pushed an iot_hub_query event, so live dropdown queries were invisible
to GTM/GA4 (only submitted searches landing on /iot-hub/search/ were
tracked). Mirror trackQuery() from iot-hub-dynamic-search.ts in the
hero popup: push once per distinct trimmed term after the fetch
resolves, skipping empty terms.

PROD-8434
@vvlladd28 vvlladd28 merged commit 222b6f6 into main Jul 1, 2026
4 of 5 checks passed
@vvlladd28 vvlladd28 deleted the feat/iot-hub-hero-search-tracking branch July 1, 2026 15:14
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