Skip to content

Commit 3dd63ff

Browse files
committed
document new cookie behavior for algolia
See quarto-dev/quarto-cli#13525
1 parent 462f4db commit 3dd63ff

File tree

2 files changed

+37
-2
lines changed

2 files changed

+37
-2
lines changed

docs/websites/website-search.qmd

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,34 @@ website:
167167
analytics-events: true
168168
```
169169

170-
You can confirm that events are being properly sent to Algolia using the [Event Debugger](https://www.algolia.com/events/debugger). Note that the click and conversion events use cookies to maintain an anonymous user identifier---if [cookie consent](website-tools.qmd#cookie-consent) is enabled, search events will only be enabled if cookie consent has been granted.
170+
You can confirm that events are being properly sent to Algolia using the [Event Debugger](https://www.algolia.com/events/debugger).
171+
172+
#### Cookie Consent and User Tracking
173+
174+
Algolia Insights uses user tokens to track click and conversion events. By default, Quarto uses a **privacy-first approach** that does not store cookies:
175+
176+
- **Default behavior (no cookies)**: A random session token is generated for each browser session. This allows tracking of search interactions during a single visit without storing persistent cookies. This default is compliant with privacy regulations like GDPR.
177+
178+
- **Persistent tracking (with cookies)**: To track users across multiple sessions, you must enable [cookie consent](website-tools.qmd#cookie-consent). When cookie consent is enabled, Algolia will only use cookies after the user grants "tracking" consent:
179+
180+
``` yaml
181+
website:
182+
cookie-consent: true
183+
search:
184+
algolia:
185+
index-name: <my-index-name>
186+
application-id: <my-application-id>
187+
search-only-api-key: <my-search-only-api-key>
188+
analytics-events: true
189+
```
190+
191+
With this configuration, the Algolia Insights API will use cookies to maintain an anonymous user identifier across sessions, but only after the user has explicitly granted consent.
192+
193+
::: {.callout-note}
194+
## Privacy and Compliance
195+
196+
The default session-only tracking provides meaningful analytics about search usage patterns while respecting user privacy. Enabling persistent cookie tracking may require compliance with privacy regulations in your jurisdiction, which is why Quarto requires explicit configuration of cookie consent.
197+
:::
171198

172199
### Advanced Configuration
173200

docs/websites/website-tools.qmd

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ If you choose `none` for storage, this will have the following effects:
258258

259259
Quarto includes the ability to request cookie consent before enabling scripts that set cookies, using [Cookie Consent](https://www.cookieconsent.com).
260260

261-
The user's cookie preferences will automatically control [Google Analytics] (if enabled) and can be used to control custom scripts you add as well (see [Custom Scripts and Cookie Consent]). You can enable the default request for cookie consent using the following:
261+
The user's cookie preferences will automatically control [Google Analytics] and [Algolia search analytics](/docs/websites/website-search.qmd#algolia-insights) (if enabled) and can be used to control custom scripts you add as well (see [Custom Scripts and Cookie Consent]). You can enable the default request for cookie consent using the following:
262262

263263
``` yaml
264264
website:
@@ -313,8 +313,16 @@ website:
313313
google-analytics:
314314
tracking-id: "G-XXXXXXX"
315315
anonymize-ip: true
316+
search:
317+
algolia:
318+
index-name: <my-index-name>
319+
application-id: <my-application-id>
320+
search-only-api-key: <my-search-only-api-key>
321+
analytics-events: true
316322
```
317323

324+
Note that with cookie consent enabled, both Google Analytics and Algolia search analytics will only use cookies after the user has granted "tracking" consent. Without cookie consent enabled, Algolia will use session-only tracking without cookies. See [Algolia Insights](/docs/websites/website-search.qmd#algolia-insights) for more details.
325+
318326
### Cookie Preferences
319327

320328
In addition to requesting consent when a new user visits your website, Cookie Consent will also add a cookie preferences link to the footer of the website. You can control the text of this link using `prefs-text`. If you would rather position this link yourself, just add a link with the id `#open_preferences_center` to the website and Cookie Consent will not add the preferences link to the footer. For example:

0 commit comments

Comments
 (0)