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

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using Algolia.Search.Clients;
using Algolia.Search.Http;
using Algolia.Search.Models.Insights;

var client = new InsightsClient(
  new InsightsConfig("ALGOLIA_APPLICATION_ID", "ALGOLIA_API_KEY", "ALGOLIA_APPLICATION_REGION")
);

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 },
        }
      ),
    },
  }
);
Did you find this page helpful?
C# API clients v7