Skip to content

Prevent 422 Insights Event - Autocomplete Click #1763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

PromInc
Copy link
Contributor

@PromInc PromInc commented Jun 10, 2025

The Algolia event debugger shows error events with a 422 status code from Autocomplete click insights events due to a missing index field.

Summary
Bug Fix: Clicking a hit within the Autocomplete product section does not pass the index to the insights click event thus creating a 422 status code.

Result

  1. Open the dev tools to the Network tab
  2. Check the Preserve Log check box
  3. Go to a page with the Algolia autcomplete box
  4. Search for any term triggering the autocomplete results
  5. Click on any hit (product) in the autocomplete dropdown
  6. In the Network panel of the dev tools, select All and filter by insights.algolia.io
  7. Look at the requests, viewing the Payload tab. Expand the Request Payload for an event where the eventType = click
    • If the bug is fixed, the index property with the correct index name as the value will be present

This change will use the data-index property that is defined by the templates from https://github.com/algolia/algoliasearch-magento-2/tree/main/view/frontend/web/js/template/autocomplete

Illustration of the issue

Error events in the Algolia Events Debugger

image

Illustration of the 422 status code occurring in the browser

image

The Algolia event debugger indicates a large number of `422` status codes from Autocomplete click insights events due to a missing `index` field.
@PromInc PromInc changed the title Prevent 422 Insights Event Prevent 422 Insights Event - Autocomplete Click Jun 24, 2025
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