Example of tracking a lead conversion:
// userId is the id from the grouping service when a
// user creates an account or logs in
LeadTracker.recordLead(userId, {
email: userEmail,
});
Example of tracking a purchase:
window.LeadTracker?.recordPurchase(userId, {
email: billingAddress.personPrimaryEmail,
firstName: billingAddress.personFirstName,
lastName: billingAddress.personLastName,
phone: billingAddress.personPrimaryPhone,
store: storeName,
exchangeId: storeExchangeId,
purchaseCode: orderToSave.id,
purchaseAmount: {
currencyCode: 'USD',
value: amount,
},
items: products.map(product => {
return {
id: product.id,
description: product.name,
amount: {
currencyCode: 'USD',
value: parseFloat(product.price),
},
}
})
});