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:
Name | Type | Description |
---|---|---|
userResponse | string | Customer’s preferred choice for being tracked. Possible values: "ACCEPTED" , "DECLINED" or empty |
askConsent | boolean | true 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:
Name | Type | Description |
---|---|---|
billingPerson | <Person> | Customer’s name along with his/her billing address, as entered in the last order. |
String | Email address of a customer | |
id | Number | Unique customer ID in Ecwid |
membership | <CustomerGroup> | Customer group details. Present only if customer belongs to a customer group |
ownerId | number | Store ID this customer belongs to |
registered | UNIX Timestamp | Registration date of this customer |
shippingAddresses | Array 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:
Name | Type | Description |
---|---|---|
id | integer | The unique address id Ecwid database |
person | Object (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:
Name | Type | Description |
---|---|---|
name | string | The first and the last name of the person, separated by a space. |
companyName | string, optional | The person’s company name, if applicable |
street | string, optional | The street address of the person, if applicable. If there are two address lines, they are separated by a newline character ‘\n’ |
city | string, optional | The person’s city, if applicable |
countryCode | string, optional | The person’s country code, as listed in ISO 3166-2 |
postalCode | string, optional | The person’s postal code or ZIP code, if applicable |
stateOrProvinceCode | string, optional | The 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. |
countryName | string, optional | Country name, if applicable |
phone | string, optional | Phone number, if applicable |
CustomerGroup Object
Customer group information
Fields:
Name | Type | Description |
---|---|---|
id | number | The unique id of a customer group |
name | string | Name of the customer group |
ownerid | number | Ecwid store ID |