Privacy Controller - Liquid Controller Reference
On this page
Description
The Privacy controller handles requests related to privacy functionality in your StoreConnect storefront.
| Property | Value |
|---|---|
| Controller | PrivacyController |
| Liquid Template Path | controllers/privacy/ |
Actions
| Action | HTTP Method | Route | Liquid Page |
|---|---|---|---|
set |
PATCH | /privacy/set |
— |
enable_all |
GET | /privacy/enable-all |
— |
disable_all |
GET | /privacy/disable-all |
— |
Liquid templates
Each action runs the template below, if your theme has one.
| Action | Template |
|---|---|
disable_all |
controllers/privacy/disable_all.liquid |
enable_all |
controllers/privacy/enable_all.liquid |
set |
controllers/privacy/set.liquid |
Liquid Controller Lifecycle
For each action, Liquid controller templates are executed in three phases:
- Before — runs before the Rails action
- After — runs after the Rails action but before the response is sent
- Final — runs after the response, useful for cleanup
Available Liquid Tags
Inside controller templates, these tags are available:
| Tag | Description |
|---|---|
{% params %} |
Set request parameters (e.g. {% params foo: "bar" %}) |
{% variables %} |
Set template variables (e.g. {% variables title: "Hello" %}) |
{% respond %} |
Respond with custom content, alert, or notice |
{% redirect %} |
Redirect the request (e.g. {% redirect to: "/products" %}) |
{% action %} |
Execute a server-side action (e.g. {% action "cart.add", product_identifier: "blue-widget", quantity: 1 %}) |
Example
Create controllers/privacy/disable_all.liquid. The final phase runs after the response is sent, so it can record the choice in the audit log without changing what the visitor sees:
```liquid
{% final %} {% audit_event “privacy_opt_out”, message: “Visitor turned off all optional cookies” %} {% endfinal %} ```
The entry appears only when the store records the CUSTOM audit category. See audit_event.
Was this article helpful?
Thanks for your feedback! It helps us improve our docs.