curl
curl --request POST \
--url https://insights.us.algolia.io/1/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"events": [
{
"eventName": "Products Clicked",
"eventType": "click",
"index": "test-index",
"userToken": "anonymous-user-1",
"authenticatedUserToken": "user-1",
"objectIDs": [
"object-1"
],
"positions": [
1
],
"queryID": "7dfe2ada7bca48bdd0629649df0bee07"
}
]
}
'// Initialize the client
var client = new InsightsClient(
new InsightsConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.PushEventsAsync(
new InsightsEvents
{
Events = new List<EventsItems>
{
new EventsItems(
new ClickedObjectIDsAfterSearch
{
EventType = Enum.Parse<ClickEvent>("Click"),
EventName = "Product Clicked",
Index = "products",
UserToken = "user-123456",
AuthenticatedUserToken = "user-123456",
Timestamp = 1641290601962L,
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
QueryID = "43b15df305339e827f0ac0bdc5ebcaa7",
Positions = new List<int> { 7, 6 },
}
),
},
}
);
// print the response
Console.WriteLine(response);// Initialize the client
final client = InsightsClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
region: 'ALGOLIA_APPLICATION_REGION');
// Call the API
final response = await client.pushEvents(
insightsEvents: InsightsEvents(
events: [
ClickedObjectIDsAfterSearch(
eventType: ClickEvent.fromJson("click"),
eventName: "Product Clicked",
index: "products",
userToken: "user-123456",
authenticatedUserToken: "user-123456",
timestamp: 1641290601962,
objectIDs: [
"9780545139700",
"9780439784542",
],
queryID: "43b15df305339e827f0ac0bdc5ebcaa7",
positions: [
7,
6,
],
),
],
),
);
// print the response
print(response);// Initialize the client with your application region, eg. insights.ALGOLIA_APPLICATION_REGION
client, err := insights.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", insights.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.PushEvents(client.NewApiPushEventsRequest(
insights.NewEmptyInsightsEvents().SetEvents(
[]insights.EventsItems{*insights.ClickedObjectIDsAfterSearchAsEventsItems(
insights.NewEmptyClickedObjectIDsAfterSearch().SetEventType(insights.ClickEvent("click")).SetEventName("Product Clicked").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1641290601962).SetObjectIDs(
[]string{"9780545139700", "9780439784542"}).SetQueryID("43b15df305339e827f0ac0bdc5ebcaa7").SetPositions(
[]int32{7, 6}))})))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)// Initialize the client
InsightsClient client = new InsightsClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
EventsResponse response = client.pushEvents(
new InsightsEvents().setEvents(
Arrays.asList(
new ClickedObjectIDsAfterSearch()
.setEventType(ClickEvent.CLICK)
.setEventName("Product Clicked")
.setIndex("products")
.setUserToken("user-123456")
.setAuthenticatedUserToken("user-123456")
.setTimestamp(1641290601962L)
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
.setQueryID("43b15df305339e827f0ac0bdc5ebcaa7")
.setPositions(Arrays.asList(7, 6))
)
)
);
// print the response
System.out.println(response);// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initInsights({ region: 'us' });
// Call the API
const response = await client.pushEvents({
events: [
{
eventType: 'click',
eventName: 'Product Clicked',
index: 'products',
userToken: 'user-123456',
authenticatedUserToken: 'user-123456',
timestamp: 1641290601962,
objectIDs: ['9780545139700', '9780439784542'],
queryID: '43b15df305339e827f0ac0bdc5ebcaa7',
positions: [7, 6],
},
],
});
// print the response
console.log(response);// Initialize the client
val client =
InsightsClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION",
)
// Call the API
var response =
client.pushEvents(
insightsEvents =
InsightsEvents(
events =
listOf(
ClickedObjectIDsAfterSearch(
eventType = ClickEvent.entries.first { it.value == "click" },
eventName = "Product Clicked",
index = "products",
userToken = "user-123456",
authenticatedUserToken = "user-123456",
timestamp = 1641290601962L,
objectIDs = listOf("9780545139700", "9780439784542"),
queryID = "43b15df305339e827f0ac0bdc5ebcaa7",
positions = listOf(7, 6),
)
)
)
)
// print the response
println(response)// Initialize the client
$client = InsightsClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
// Call the API
$response = $client->pushEvents(
['events' => [
['eventType' => 'click',
'eventName' => 'Product Clicked',
'index' => 'products',
'userToken' => 'user-123456',
'authenticatedUserToken' => 'user-123456',
'timestamp' => 1641290601962,
'objectIDs' => [
'9780545139700',
'9780439784542',
],
'queryID' => '43b15df305339e827f0ac0bdc5ebcaa7',
'positions' => [
7,
6,
],
],
],
],
);
// print the response
var_dump($response);# Initialize the client
# In an asynchronous context, you can use InsightsClient instead, which exposes the exact same methods.
client = InsightsClientSync(
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)
# Call the API
response = client.push_events(
insights_events={
"events": [
{
"eventType": "click",
"eventName": "Product Clicked",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
"9780439784542",
],
"queryID": "43b15df305339e827f0ac0bdc5ebcaa7",
"positions": [
7,
6,
],
},
],
},
)
# print the response
print(response)# Initialize the client
client = Algolia::InsightsClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
# Call the API
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]
)
]
)
)
# print the response
puts(response)// Initialize the client
val client = InsightsClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = Option("ALGOLIA_APPLICATION_REGION")
)
// Call the API
val response = Await.result(
client.pushEvents(
insightsEvents = InsightsEvents(
events = Seq(
ClickedObjectIDsAfterSearch(
eventType = ClickEvent.withName("click"),
eventName = "Product Clicked",
index = "products",
userToken = "user-123456",
authenticatedUserToken = Some("user-123456"),
timestamp = Some(1641290601962L),
objectIDs = Seq("9780545139700", "9780439784542"),
queryID = "43b15df305339e827f0ac0bdc5ebcaa7",
positions = Seq(7, 6)
)
)
)
),
Duration(100, "sec")
)
// print the response
println(response)// Initialize the client
let client = try InsightsClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
// Call the API
let response = try await client
.pushEvents(insightsEvents: InsightsEvents(events: [EventsItems
.clickedObjectIDsAfterSearch(ClickedObjectIDsAfterSearch(
eventName: "Product Clicked",
eventType: ClickEvent.click,
index: "products",
objectIDs: ["9780545139700", "9780439784542"],
positions: [7, 6],
queryID: "43b15df305339e827f0ac0bdc5ebcaa7",
userToken: "user-123456",
authenticatedUserToken: "user-123456",
timestamp: Int64(1_641_290_601_962)
))]))
// print the response
print(response){
"status": 200,
"message": "OK"
}Insights API
Send events
Sends a list of events to the Insights API.
POST
/
1
/
events
curl
curl --request POST \
--url https://insights.us.algolia.io/1/events \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--header 'x-algolia-api-key: ALGOLIA_API_KEY' \
--header 'x-algolia-application-id: ALGOLIA_APPLICATION_ID' \
--data '
{
"events": [
{
"eventName": "Products Clicked",
"eventType": "click",
"index": "test-index",
"userToken": "anonymous-user-1",
"authenticatedUserToken": "user-1",
"objectIDs": [
"object-1"
],
"positions": [
1
],
"queryID": "7dfe2ada7bca48bdd0629649df0bee07"
}
]
}
'// Initialize the client
var client = new InsightsClient(
new InsightsConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);
// Call the API
var response = await client.PushEventsAsync(
new InsightsEvents
{
Events = new List<EventsItems>
{
new EventsItems(
new ClickedObjectIDsAfterSearch
{
EventType = Enum.Parse<ClickEvent>("Click"),
EventName = "Product Clicked",
Index = "products",
UserToken = "user-123456",
AuthenticatedUserToken = "user-123456",
Timestamp = 1641290601962L,
ObjectIDs = new List<string> { "9780545139700", "9780439784542" },
QueryID = "43b15df305339e827f0ac0bdc5ebcaa7",
Positions = new List<int> { 7, 6 },
}
),
},
}
);
// print the response
Console.WriteLine(response);// Initialize the client
final client = InsightsClient(
appId: 'ALGOLIA_APPLICATION_ID',
apiKey: 'ALGOLIA_API_KEY',
region: 'ALGOLIA_APPLICATION_REGION');
// Call the API
final response = await client.pushEvents(
insightsEvents: InsightsEvents(
events: [
ClickedObjectIDsAfterSearch(
eventType: ClickEvent.fromJson("click"),
eventName: "Product Clicked",
index: "products",
userToken: "user-123456",
authenticatedUserToken: "user-123456",
timestamp: 1641290601962,
objectIDs: [
"9780545139700",
"9780439784542",
],
queryID: "43b15df305339e827f0ac0bdc5ebcaa7",
positions: [
7,
6,
],
),
],
),
);
// print the response
print(response);// Initialize the client with your application region, eg. insights.ALGOLIA_APPLICATION_REGION
client, err := insights.NewClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", insights.US)
if err != nil {
// The client can fail to initialize if you pass an invalid parameter.
panic(err)
}
// Call the API
response, err := client.PushEvents(client.NewApiPushEventsRequest(
insights.NewEmptyInsightsEvents().SetEvents(
[]insights.EventsItems{*insights.ClickedObjectIDsAfterSearchAsEventsItems(
insights.NewEmptyClickedObjectIDsAfterSearch().SetEventType(insights.ClickEvent("click")).SetEventName("Product Clicked").SetIndex("products").SetUserToken("user-123456").SetAuthenticatedUserToken("user-123456").SetTimestamp(1641290601962).SetObjectIDs(
[]string{"9780545139700", "9780439784542"}).SetQueryID("43b15df305339e827f0ac0bdc5ebcaa7").SetPositions(
[]int32{7, 6}))})))
if err != nil {
// handle the eventual error
panic(err)
}
// print the response
print(response)// Initialize the client
InsightsClient client = new InsightsClient("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION");
// Call the API
EventsResponse response = client.pushEvents(
new InsightsEvents().setEvents(
Arrays.asList(
new ClickedObjectIDsAfterSearch()
.setEventType(ClickEvent.CLICK)
.setEventName("Product Clicked")
.setIndex("products")
.setUserToken("user-123456")
.setAuthenticatedUserToken("user-123456")
.setTimestamp(1641290601962L)
.setObjectIDs(Arrays.asList("9780545139700", "9780439784542"))
.setQueryID("43b15df305339e827f0ac0bdc5ebcaa7")
.setPositions(Arrays.asList(7, 6))
)
)
);
// print the response
System.out.println(response);// Initialize the client
// Replace 'us' with your Algolia Application Region
const client = algoliasearch('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY').initInsights({ region: 'us' });
// Call the API
const response = await client.pushEvents({
events: [
{
eventType: 'click',
eventName: 'Product Clicked',
index: 'products',
userToken: 'user-123456',
authenticatedUserToken: 'user-123456',
timestamp: 1641290601962,
objectIDs: ['9780545139700', '9780439784542'],
queryID: '43b15df305339e827f0ac0bdc5ebcaa7',
positions: [7, 6],
},
],
});
// print the response
console.log(response);// Initialize the client
val client =
InsightsClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = "ALGOLIA_APPLICATION_REGION",
)
// Call the API
var response =
client.pushEvents(
insightsEvents =
InsightsEvents(
events =
listOf(
ClickedObjectIDsAfterSearch(
eventType = ClickEvent.entries.first { it.value == "click" },
eventName = "Product Clicked",
index = "products",
userToken = "user-123456",
authenticatedUserToken = "user-123456",
timestamp = 1641290601962L,
objectIDs = listOf("9780545139700", "9780439784542"),
queryID = "43b15df305339e827f0ac0bdc5ebcaa7",
positions = listOf(7, 6),
)
)
)
)
// print the response
println(response)// Initialize the client
$client = InsightsClient::create('ALGOLIA_APPLICATION_ID', 'ALGOLIA_API_KEY', 'ALGOLIA_APPLICATION_REGION');
// Call the API
$response = $client->pushEvents(
['events' => [
['eventType' => 'click',
'eventName' => 'Product Clicked',
'index' => 'products',
'userToken' => 'user-123456',
'authenticatedUserToken' => 'user-123456',
'timestamp' => 1641290601962,
'objectIDs' => [
'9780545139700',
'9780439784542',
],
'queryID' => '43b15df305339e827f0ac0bdc5ebcaa7',
'positions' => [
7,
6,
],
],
],
],
);
// print the response
var_dump($response);# Initialize the client
# In an asynchronous context, you can use InsightsClient instead, which exposes the exact same methods.
client = InsightsClientSync(
"ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION"
)
# Call the API
response = client.push_events(
insights_events={
"events": [
{
"eventType": "click",
"eventName": "Product Clicked",
"index": "products",
"userToken": "user-123456",
"authenticatedUserToken": "user-123456",
"timestamp": 1641290601962,
"objectIDs": [
"9780545139700",
"9780439784542",
],
"queryID": "43b15df305339e827f0ac0bdc5ebcaa7",
"positions": [
7,
6,
],
},
],
},
)
# print the response
print(response)# Initialize the client
client = Algolia::InsightsClient.create("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
# Call the API
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]
)
]
)
)
# print the response
puts(response)// Initialize the client
val client = InsightsClient(
appId = "ALGOLIA_APPLICATION_ID",
apiKey = "ALGOLIA_API_KEY",
region = Option("ALGOLIA_APPLICATION_REGION")
)
// Call the API
val response = Await.result(
client.pushEvents(
insightsEvents = InsightsEvents(
events = Seq(
ClickedObjectIDsAfterSearch(
eventType = ClickEvent.withName("click"),
eventName = "Product Clicked",
index = "products",
userToken = "user-123456",
authenticatedUserToken = Some("user-123456"),
timestamp = Some(1641290601962L),
objectIDs = Seq("9780545139700", "9780439784542"),
queryID = "43b15df305339e827f0ac0bdc5ebcaa7",
positions = Seq(7, 6)
)
)
)
),
Duration(100, "sec")
)
// print the response
println(response)// Initialize the client
let client = try InsightsClient(appID: "ALGOLIA_APPLICATION_ID", apiKey: "ALGOLIA_API_KEY", region: .us)
// Call the API
let response = try await client
.pushEvents(insightsEvents: InsightsEvents(events: [EventsItems
.clickedObjectIDsAfterSearch(ClickedObjectIDsAfterSearch(
eventName: "Product Clicked",
eventType: ClickEvent.click,
index: "products",
objectIDs: ["9780545139700", "9780439784542"],
positions: [7, 6],
queryID: "43b15df305339e827f0ac0bdc5ebcaa7",
userToken: "user-123456",
authenticatedUserToken: "user-123456",
timestamp: Int64(1_641_290_601_962)
))]))
// print the response
print(response){
"status": 200,
"message": "OK"
}You can include up to 1,000 events in a single request,
but the request body must be smaller than 2 MB.
Required ACL:
searchAuthorizations
Your Algolia application ID.
Your Algolia API key with the necessary permissions to make the request. Permissions are controlled through access control lists (ACL) and access restrictions. The required ACL to make a request is listed in each endpoint's reference.
Body
application/json
events
(Clicked object IDs after search · object | Added to cart object IDs after search · object | Purchased object IDs after search · object | Converted object IDs after search · object | Clicked object IDs · object | Purchased object IDs · object | Added to cart object IDs · object | Converted object IDs · object | Clicked filters · object | Converted filters · object | Viewed object IDs · object | Viewed filters · object)[]
required
Click and conversion events.
All events must be valid, otherwise the API returns an error.
Required array length:
1 - 1000 elementsClick event after an Algolia request. Use this event to track when users click items in the search results. If you're building your category pages with Algolia, you'll also use this event.
- Clicked object IDs after search
- Added to cart object IDs after search
- Purchased object IDs after search
- Converted object IDs after search
- Clicked object IDs
- Purchased object IDs
- Added to cart object IDs
- Converted object IDs
- Clicked filters
- Converted filters
- Viewed object IDs
- Viewed filters
Show child attributes
Show child attributes
Last modified on March 23, 2026
Was this page helpful?
⌘I