cookieconsent.getUserPreferences()
[v2.7.0+]
+
+
+ The `.getUserPreferences()` returns the following object (for analytics/logging purposes):
+ ```javascript
+ {
+ accept_type: string, // 'all', 'necessary', 'custom'
+ accepted_categories: string[], // e.g. ['necessary', 'analytics']
+ rejected_categories: string[] // e.g. ['ads']
+ }
+ ```
+
+
### All available options
@@ -560,6 +572,7 @@ Below a table which sums up all of the available options (must be passed to the
| `autorun` | boolean | true | If enabled, show the cookie consent as soon as possible (otherwise you need to manually call the `.show()` method) |
| `delay` | number | 0 | Number of `milliseconds` before showing the consent-modal |
| `cookie_expiration` | number | 182 | Number of days before the cookie expires (182 days = 6 months) |
+| `cookie_necessary_only_expiration` | number | - | Specify if you want to set a different number of days - before the cookie expires - when the user accepts only the necessary categories |
| `cookie_path` | string | "/" | Path where the cookie will be set |
| `cookie_domain` | string | location.hostname | Specify your domain (will be grabbed by default) or a subdomain |
| `cookie_same_site` | string | "Lax" | SameSite attribute |
@@ -574,8 +587,9 @@ Below a table which sums up all of the available options (must be passed to the
| `remove_cookie_tables`| boolean | false | Enable if you want to remove the html cookie tables (but still want to make use of `autoclear_cookies`) |
| `hide_from_bots` | boolean | false | Enable if you don't want the plugin to run when a bot/crawler/webdriver is detected |
| `gui_options` | object | - | Customization option which allows to choose layout, position and transition. Check [layout options & customization](#layout-options--customization) |
-| __`onAccept`__ | function | - | Method run `once` either when: