Skip to content

Add Google Analytics tracking for searches that return no results. #270

Description

@karenmajewicz

Instructions from GA:

Track zero-result searches in GA4 via GTM dataLayer
Summary
Add a dataLayer push that fires when an internal search returns zero results, enabling GA4 to capture no-result search terms via Google Tag Manager.

Implementation
Push the following event when a search response returns zero results. Populate search_term dynamically from the active query string (search?q=):

dataLayer.push({
'event': 'search_no_results',
'search_term': '<query_string_value>'
});

Validation
Verify event appears in GTM Preview mode with correct event name and search_term value
Confirm push fires only on zero-result searches

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Fields

    Priority

    Medium

    Effort

    None yet

    Projects

    Status
    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions