Get customer details

Find out more about customer that is currently logged in a store.

Get status of customer’s consent to be tracked


// {  userResponse: "ACCEPTED", askConsent: true }

Ecwid.getTrackingConsent(); provides information about customer’s consent to be tracked on store pages.


userResponsestringCustomer’s preferred choice for being tracked. Possible values: "ACCEPTED", "DECLINED" or empty
askConsentbooleantrue if store requests customer consent to be tracked. false otherwise

Subscribe to the Ecwid.OnAPILoaded JS API event to ensure availability of this function.

Set status of customer’s consent to be tracked

ec.config.tracking.ask_consent = false;
ec.config.tracking.user_response = "ACCEPTED";

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: "ACCEPTED", "DECLINED" or "" if you don’t know the response yet.

Customer Object

Customer object describes details of a logged in customer in a store.

Get customer email and billing country example

Ecwid.OnSetProfile.add(function(customer) {

// prints
// United States


billingPerson<Person>Customer’s name along with his/her billing address, as entered in the last order.
emailStringEmail address of a customer
idNumberUnique customer ID in Ecwid
membership<CustomerGroup>Customer group details. Present only if customer belongs to a customer group
ownerIdnumberStore ID this customer belongs to
registeredUNIX TimestampRegistration date of this customer
shippingAddressesArray of <ShippingAddress>A list of addresses in the customer’s address book

ShippingAddress Object

The customer’s address as stored in the address book.


idintegerThe unique address id Ecwid database
personObject (Person)The object describing the address along with the person’s name and phone number.

Person Object

Describes the person name, company and address.


namestringThe first and the last name of the person, separated by a space.
companyNamestring, optionalThe person’s company name, if applicable
streetstring, optionalThe street address of the person, if applicable. If there are two address lines, they are separated by a newline character ‘\n’
citystring, optionalThe person’s city, if applicable
countryCodestring, optionalThe person’s country code, as listed in ISO 3166-2
postalCodestring, optionalThe person’s postal code or ZIP code, if applicable
stateOrProvinceCodestring, optionalThe person’s region/state/province code by ISO 3166-2. Please note that not all countries regional codes are listed in the Ecwid database so far.
countryNamestring, optionalCountry name, if applicable
phonestring, optionalPhone number, if applicable

CustomerGroup Object

Customer group information


idnumberThe unique id of a customer group
namestringName of the customer group
owneridnumberEcwid store ID

We use cookies and similar technologies to remember your preferences, measure effectiveness of our campaigns, and analyze depersonalized data to improve performance of our site. By choosing «Accept», you consent to the use of cookies.