Set tracking consent

If your website already asks user for consent, you can provide that information to Ecwid, so that visitors don't have to do this again on store pages.
First, set the value for the boolean variable ec.config.tracking.ask_consent: true – if Ecwid needs to ask for consent, false otherwise.
Next, provide visitor's response to Ecwid in the ec.config.tracking.user_response variable with one of these values:
"ACCEPT" - user agreed to collect all types of cookies,
"DECLINE" - user declined all additional cookies, and agreed to collect only essential cookies,
"UNDEFINED" - variable is not defined,
"ANALYTICS_ONLY" - user agreed to collect essential and analytics cookies,
"PERSONALIZATION_ONLY" - user agreed to collect essential and personalization cookies.

📘

Set ec.config.tracking.ask_consent: true to define ec.config.tracking.user_response and put config before productBrowser script!

Set status of customer's consent to be tracked:

ec.config = ec.config || {};
ec.config.tracking = ec.config.tracking || {};
ec.config.tracking.ask_consent = true;
ec.config.tracking.user_response = "DECLINE";

Set the consent value

Ecwid.setTrackingConsent(); sets the value of consent. Can be:
"ACCEPT" - user agreed to collect all types of cookies,
"DECLINE" - user declined all additional cookies, and agreed to collect only essential cookies,
"UNRECOGNIZED_VALUE" - variable is not defined,
"ANALYTICS_ONLY" - user agreed to collect essential and analytics cookies,
"PERSONALIZATION_ONLY" - user agreed to collect essential and personalization cookies.

Ecwid.setTrackingConsent("ACCEPT");
Ecwid.getTrackingConsent();
//{userResponse: "ACCEPTED", askConsent: <as per settings>}

Ecwid.setTrackingConsent("DECLINE");
Ecwid.getTrackingConsent();
//{userResponse: "DECLINED", askConsent: <as per settings>}

Ecwid.setTrackingConsent("UNRECOGNIZED_VALUE");
Ecwid.getTrackingConsent();
//{userResponse: "UNDEFINED", askConsent: <as per settings>}

Ecwid.setTrackingConsent("ANALYTICS_ONLY");
Ecwid.getTrackingConsent();
//{userResponse: "ANALYTICS_ONLY", askConsent: <as per settings>}

Ecwid.setTrackingConsent("PERSONALIZATION_ONLY");
Ecwid.getTrackingConsent();
//{userResponse: "PERSONALIZATION_ONLY", askConsent: <as per settings>}

Track changes in consent value

Ecwid.OnConsentChanged tracks changes in consent value:

Ecwid.OnConsentChanged.add(function(consent) {
    console.log("consent changed to " + consent);
});
Ecwid.setTrackingConsent("DECLINE");
//consent changed to DECLINED