Skip to content

Commit bf64b80

Browse files
authored
[DOCS] Migrate Behavioral Analytics docs to ES ref (elastic#100704) (elastic#100799)
* [DOCS] Migrate Behavioral Analytics docs to ES ref * Fix typo * Fix attributes * Rename top level heading, fix requirements * Address review suggestions
1 parent e064650 commit bf64b80

13 files changed

+889
-30
lines changed

docs/reference/redirects.asciidoc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1953,32 +1953,3 @@ coming::[8.11.0]
19531953

19541954
coming::[8.11.0]
19551955

1956-
[role="exclude",id="behavioral-analytics-overview"]
1957-
=== Elastic Behavioral Analytics
1958-
1959-
coming::[8.11.0]
1960-
1961-
[role="exclude",id="behavioral-analytics-start"]
1962-
=== Get started with Behavioral Analytics
1963-
1964-
coming::[8.11.0]
1965-
1966-
[role="exclude",id="behavioral-analytics-api"]
1967-
=== Behavioral Analytics APIs
1968-
1969-
coming::[8.11.0]
1970-
1971-
[role="exclude",id="behavioral-analytics-event"]
1972-
=== View Behavioral Analytics Events
1973-
1974-
coming::[8.11.0]
1975-
1976-
[role="exclude",id="behavioral-analytics-event-reference"]
1977-
=== Behavioral Analytics events reference
1978-
1979-
coming::[8.11.0]
1980-
1981-
[role="exclude",id="behavioral-analytics-cors"]
1982-
=== Set up CORS for Behavioral Analytics
1983-
1984-
coming::[8.11.0]
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[[behavioral-analytics-api]]
2+
=== Behavioral Analytics API overview
3+
++++
4+
<titleabbrev>API overview</titleabbrev>
5+
++++
6+
7+
This page outlines all the APIs available for behavioral analytics and links to their documentation.
8+
9+
[discrete]
10+
[[behavioral-analytics-api-es-rest]]
11+
==== Behavioral Analytics REST APIs
12+
13+
Behavioral Analytics relies on a number of {es} APIs to manage analytics collections.
14+
Refer to the <<behavioral-analytics-apis,API documentation>> for the details.
15+
16+
[discrete]
17+
[[behavioral-analytics-api-clients]]
18+
==== Behavioral Analytics Clients
19+
20+
Behavioral Analytics integrates onto your website using one of our JavaScript clients:
21+
22+
* *Browser tracker* - integrated into your website using a `<script>` tag.
23+
** View the https://github.com/elastic/behavioral-analytics-tracker/tree/main/packages/browser-tracker[`README` in GitHub^].
24+
* *Javascript Tracker* - integrated into your website using a JavaScript module.
25+
** View the https://github.com/elastic/behavioral-analytics-tracker/tree/main/packages/javascript-tracker[`README` in GitHub^].
26+
27+
[discrete]
28+
[[behavioral-analytics-api-search-ui]]
29+
==== Search UI integration
30+
31+
To simplify the integration of Behavioral Analytics into your website, we provide a Search UI integration.
32+
This integration automatically sends Behavioral Analytics events to your collection as your customer interacts with your search experience.
33+
34+
Refer to the https://docs.elastic.co/search-ui/api/core/plugins/analytics-plugin[Search UI analytics plugin documentation^].
35+
36+
[discrete]
37+
[[behavioral-analytics-api-searchkit]]
38+
==== Searchkit integration
39+
40+
Behavioral Analytics also integrates with https://www.searchkit.co[Searchkit^], an open source library for building UIs on top of {es}.
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[[behavioral-analytics-cors]]
2+
=== Set up CORS for Behavioral Analytics
3+
++++
4+
<titleabbrev>Set up CORs</titleabbrev>
5+
++++
6+
7+
Behavioral Analytics sends events directly to the {es} API.
8+
This means that the browser makes requests to the {es} API directly.
9+
{es} supports https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS[Cross-Origin Resource Sharing (CORS)^], but this feature is disabled by default.
10+
Therefore the browser will block these requests.
11+
12+
There are two workarounds for this:
13+
14+
* <<behavioral-analytics-cors-enable-cors-elasticsearch, Enable CORS on {es}>>
15+
* <<behavioral-analytics-cors-proxy-request, Proxy the request through a server that supports CORS>>
16+
17+
[discrete]
18+
[[behavioral-analytics-cors-enable-cors-elasticsearch]]
19+
==== Enable CORS on {es}
20+
21+
This is the simplest option.
22+
Enable CORS on {es} by adding the following to your `elasticsearch.yml` file:
23+
24+
[source,yaml]
25+
----
26+
http.cors.allow-origin: "*" # Only use unrestricted value for local development
27+
# Use a specific origin value in production, like `http.cors.allow-origin: "https://<my-website-domain.example>"`
28+
http.cors.enabled: true
29+
http.cors.allow-credentials: true
30+
http.cors.allow-methods: OPTIONS, POST
31+
http.cors.allow-headers: X-Requested-With, X-Auth-Token, Content-Type, Content-Length, Authorization, Access-Control-Allow-Headers, Accept
32+
----
33+
34+
On Elastic Cloud, you can do this by {cloud}/ec-add-user-settings.html#ec-add-user-settings[editing your {es} user settings].
35+
36+
. From your deployment menu, go to the *Edit* page.
37+
. In the *{es}* section, select *Manage user settings and extensions*.
38+
. Update the user settings with the configuration above.
39+
. Select *Save changes*.
40+
41+
[discrete]
42+
[[behavioral-analytics-cors-proxy-request]]
43+
==== Proxy the request through a server that supports CORS
44+
45+
If you are unable to enable CORS on {es}, you can proxy the request through a server that supports CORS.
46+
This is more complicated, but is a viable option.

0 commit comments

Comments
 (0)