-
Notifications
You must be signed in to change notification settings - Fork 532
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
feat(insights): add hits and attributes to InsightsEvent #4667
Conversation
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7f9adfa:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see why it's not in payload, since that would cause the default implementation to need to strip them, but I kinda feel like it fits better under payload or metadata than as top-level key
(looks like some tests have failed due to the delete instead of spreading) |
you're right. |
Summary
This PR adds
hits
andattributes
to InsightsEvent.Detail
Previously we had this:
For example,
window.aa(insightsMethod, payload);
just worked, which meanspayload
is a tailored object for Algolia Insights.When users want to send events to third party trackers, they might need more information other than what is in the
payload
.In case of
Hits Viewed
,payload
containseventName
,index
andobjectIDs
. When they need to send events to, for example, Segment, they need other data like position, product name, etc.So we're passing the whole
hits
object inside theInsightsEvent
.In case of facet widgets, we're adding
attribute
toInsightsEvent
. It's to easily filter out events like: