Google Analytic Issue with Search in X theme Part 2

Reference: Google Analytic Issue with Search in X theme

Could you include an option to add a custom data- attribute or an ignore flag to the Search Element’s tracking script? Alternatively, ensuring that internal ajax-based searches do not push unneeded history states or trigger page_view virtual events would prevent GA4 from double-counting or incorrectly logging search behaviors.

Hey @sbxstrategies,

1: Adding a Custom data- Attribute (Ignore Flag)

Cornerstone’s Search Element natively supports adding custom attributes directly via the page builder. Update to the latest version if you don’t see the option. You can use this to mark the search form/input with an ignore flag (e.g., data-ga-ignore="true"), which your Google Tag Manager (GTM) or GA4 script can then respect.

image

image

How to apply it:

  1. In the Pro/Cornerstone Builder:

    • Select the Search Element (Inline, Modal, or Dropdown).
    • Go to the Customize tab in the inspector.
    • Under the Custom Attributes section, click Add Custom Attribute.
    • Enter your key and value:
      • Name: data-ga-ignore (or data-gtm-ignore)
      • Value: true
    • This will render directly on the <form> wrapper element since Cornerstone compiles custom attributes into the form tag.
  2. In Google Tag Manager (GTM) or GA4:

    • Modify the trigger of your GTM/GA4 tag (e.g., for Form Submissions or History Change events).
    • Add a trigger filter condition:
      • Form Element -> does not match CSS selector -> [data-ga-ignore="true"], [data-ga-ignore="true"] *

2: Preventing GA4 from tracking AJAX History is not configured in the search form and the search element doesn’t have an ajax feature.

Thank you for the information regarding using custom attributes such as data-ga-ignore="true" on the Search Element.

However, after reviewing the implementation, this solution still requires significant manual work on the user side and is difficult to scale across multiple websites.

The main issue is that GA4 Enhanced Measurement does not natively respect custom attributes like data-ga-ignore . Even if we add the attribute on the X Theme search form, users still need to:

  1. Configure additional filters manually inside Google Tag Manager (GTM)
  2. Modify GA4 triggers and conditions
  3. Potentially disable default GA4 form tracking
  4. Create custom definitions and reporting logic
  5. Repeat this setup across every website/property/container

This becomes inconvenient and difficult to maintain, especially for agencies or users managing multiple X Theme websites.

Currently, the proposed setup depends heavily on the GA4/GTM side rather than solving the issue at the theme level.

Our question is:

Would it be possible for X Theme to handle this directly on the frontend/theme side so that GA4 automatically ignores X Theme search elements without requiring users to modify GA4 or GTM configurations?

For example:

  • rendering the search UI in a way that GA4 does not classify as a standard form interaction
  • adding frontend logic that prevents GA4 from detecting X Theme utility/search forms
  • using a non-trackable search implementation
  • providing a built-in compatibility mode specifically for GA4

The goal would be:

  • normal contact/lead forms still track normally in GA4
  • X Theme search/navigation utility forms are automatically ignored
  • users do not need to touch GTM/GA4 settings manually

We believe this would provide a much cleaner and more scalable experience for X Theme users.

Thank you.

Thank you for your feedback. We’ll forward this as a feature request to our development team. For now, this is not possible.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.