Customer API
Customer Fields provides a robust set of tools available at your disposal that use data columns.
Our JavaScript API can:
- Register customers
- Mutate data of logged in customers
- Manage customer tags
- Emit customer events for tracking purposes
Getting started
Make sure you’ve followed the instructions on how to install developer tools in order to include our lightweight API for your usage.
Our script will add a helper function to the window
that you can use to ensure that CF.customer
will always be available:
// Add the following after including API
CF.customerReady(function() {
// CF.customer is reliably available for use here!
});
Since our script is loading asynchronously, it isn’t available for use immediately. For this exact reason our script will emit a cf:customer_ready
event when it is. CF.customerReady
waits for this event if CF.customer
isn’t already present, then fires the callback passed to it.
Next up: Customer data