Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Customers

How to send customer data to Optimizely Data Platform (ODP) using the Web SDK.

Calling customer() lets you send a new customer object or update a customer object's fields in Optimizely Data Platform (ODP).

The customer() method includes the VUID (cookie ID) on all requests automatically. To make updates that do not include the VUID, use the Legacy Attribute Function.

Customer example

Form submissions connect browser cookie data with known identifiers like email and/or phone number. This lets you track website behavior on ODP customer profiles.

The customer() method requires two objects:

📘

Note

If a customer ID is supplied in the identifiers, ODP associates it with future events in the same web session. See Overview of customer identity and resolution.

Example call of customer()

The JavaScript code automatically passes the customer's cookie identifier and email address, which creates or updates customer profiles in ODP with the data collected from the form submission (in addition to website behavior data).

zaius.customer({ // First object contains any known customer identifiers
    email: "[email protected]"
  },{ // Second object contains customer attributes
    first_name: "Johnny",
    last_name: "Zaius",
    gender: "M",
    custom_field: yourvalue //see note custom field note
  });

📘

Custom Objects & Fields

If there are data fields on your form that do not already exist in ODP, you need to create custom fields for them. Then, add them to the JavaScript code sample above, replacing custom_field with your custom fields.