ThoughtMetric

JavaScript API

identify()

Attach customer details to a visitor from the pixel.

Use identify to identify the customer who placed an order. Call it after a customer has completed an order.

thoughtmetric('identify', [customerID], [properties])

Parameters

ParameterDescriptionRequired
customerIDUnique identifier for this userRequired
propertiesJavaScript object of properties describing the customerRequired

Supported properties

Field nameDescriptionTypeRequired
emailCustomer emailstringRequired
created_atDate the customer was createdstringRecommended
orders_countTotal number of orders this customer has placednumberRecommended
total_spentTotal amount spent by this customernumberRecommended
first_nameCustomer first namestringOptional
last_nameCustomer last namestringOptional
companyCustomer companystringOptional
address1Customer address line 1stringOptional
address2Customer address line 2stringOptional
cityCustomer citystringOptional
stateCustomer statestringOptional
countryCustomer countrystringOptional
zipCustomer zipstringOptional
phoneCustomer phone numberstringOptional

Examples

Basic call

The most basic identify call sends only the required fields.

thoughtmetric('identify', 'john@snow.com', {
email: 'john@snow.com'
})

Detailed customer

This example sends more detailed customer spend information along with the identify call, including total_spent and orders_count.

thoughtmetric('identify', '0001', { 
email: 'john@snow.com',
created_at: '2022-09-06 20:12:44 -0400',
total_spent: 55.00,
orders_count: 3,
first_name: 'Aegon',
last_name: 'Targaryen'
})