Thanks for being patient while we implement your feedback to improve the developer experience.

Storefront Cookie Consent

Specify shopper cookie consent preferences.

For info about API accounts, see our Guide to API Accounts.

For info about authenticating BigCommerce APIs, see Authentication and Example Requests.

Set Cookie Consent Preferences

POST /consent

Request

Sets the status of a customer's consent to allow data collection by cookies and scripts according to the following consent categories:

  1. Analytics — These cookies provide statistical information on site usage so the store owner can improve the website over time.

  2. Functional — These cookies enable enhanced functionality, such as videos and live chat. If a shopper does not allow these, then some or all of these functions may not work properly.

  3. Targeting; Advertising — These cookies allow merchants to create profiles or personalize content to enhance users' shopping experience.

This endpoint only works if the cookie consent feature is enabled. It is assumed the shopper has not consented to anything until a value is explicitly set. The request body must be populated with a complete set of allowed and denied categories.

Once set, consent preferences will be saved as a cookie for guest shoppers. Consent preferences will be persisted to a shopper's account to be used for future sessions once they have logged in. Consent preferences can also be managed using the Update customer consent endpoint.

Note

  • Substitute your storefront domain for yourstore.example.com.

Parameters

  • store_domain in path - string

Data sent to the Update customer consent endpoint when creating a customer during checkout.

Body

object | application/json

List of allowed and denied consent categories. Must be populated with a complete set of allowed and denied categories.

Configurable categories are:

2 - Functional 3 - Analytics 4 - Targeting; Advertising

For further definition of these categories, see Scripts API.

  • allow
    array[integer]
    required

    Explicitly allowed consent categories. Allowed values are 2, 3, 4.

  • deny
    array[integer]
    required

    Denied consent categories. Allowed values are 2, 3, 4.

Example

{ "allow": [ 2, 3 ], "deny": [ 4 ] }

Response

Consent Settings Saved