Sep 20, 2024
Send events
Sends a list of events to the Insights API.
You can include up to 1,000 events in a single request, but the request body must be smaller than 2 MB.
Usage
Copy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require "algolia"
client = Algolia::InsightsClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
response = client.push_events(
Algolia::Insights::InsightsEvents.new(
events: [
Algolia::Insights::ClickedObjectIDsAfterSearch.new(
event_type: "click",
event_name: "Product Clicked",
index: "products",
user_token: "user-123456",
authenticated_user_token: "user-123456",
timestamp: 1641290601962,
object_ids: ["9780545139700", "9780439784542"],
query_id: "43b15df305339e827f0ac0bdc5ebcaa7",
positions: [7, 6]
)
]
)
)
Did you find this page helpful?