This functionality is in beta and is subject to change. The design and code is less mature than official GA features and is being provided as-is with no warranties. Beta features are not subject to the support SLA of official GA features.
Post an event to a Behavioral Analytics Collection.
-
<collection_name>
- (Required, string) Analytics collection name you want to ingest event in.
-
<event_type>
-
(Required, string) Analytics event type. Can be one of
page_view
,search
,search_click
.
Full request body parameters can be found in: Events reference.
-
202
- Event has been accepted and will be ingested.
-
404
-
Analytics Collection
<collection_name>
does not exists. -
400
- Occurs either when the event type is unknown or when event payload contains invalid data.
The following example send a search_click
event to an Analytics Collection called my_analytics_collection
:
resp = client.search_application.post_behavioral_analytics_event( collection_name="my_analytics_collection", event_type="search_click", payload={ "session": { "id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9" }, "user": { "id": "5f26f01a-bbee-4202-9298-81261067abbd" }, "search": { "query": "search term", "results": { "items": [ { "document": { "id": "123", "index": "products" } } ], "total_results": 10 }, "sort": { "name": "relevance" }, "search_application": "website" }, "document": { "id": "123", "index": "products" } }, ) print(resp)
const response = await client.transport.request({ method: "POST", path: "/_application/analytics/my_analytics_collection/event/search_click", body: { session: { id: "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9", }, user: { id: "5f26f01a-bbee-4202-9298-81261067abbd", }, search: { query: "search term", results: { items: [ { document: { id: "123", index: "products", }, }, ], total_results: 10, }, sort: { name: "relevance", }, search_application: "website", }, document: { id: "123", index: "products", }, }, }); console.log(response);
POST _application/analytics/my_analytics_collection/event/search_click { "session": { "id": "1797ca95-91c9-4e2e-b1bd-9c38e6f386a9" }, "user": { "id": "5f26f01a-bbee-4202-9298-81261067abbd" }, "search":{ "query": "search term", "results": { "items": [ { "document": { "id": "123", "index": "products" } } ], "total_results": 10 }, "sort": { "name": "relevance" }, "search_application": "website" }, "document":{ "id": "123", "index": "products" } }