NAV

Get customer details

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

Ecwid.getTrackingConsent

Get status of customer’s consent to be tracked

Ecwid.getTrackingConsent();

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

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

Fields:

NameTypeDescription
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.

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) {
  console.log(customer.email);
  console.log(customer.billingPerson.countryName);
});

// prints
// supercoder@matrix.com
// United States

Fields:

NameTypeDescription
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.

Fields:

NameTypeDescription
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.

Fields:

NameTypeDescription
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

Fields:

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