Use the identify method in the Castled JS SDK to create/update users with their unique traits. It also lets you record the traits about them such as their name, email address, etc. in your data warehouse.

A sample identify() call is shown below:

castledanalytics.identify(
  "user-12345", // unique user-id
  {
    // user traits
    fname: "hello",
    lname: "user",
    age: 34,
    email: "name@domain.com",
  },
  () => {
    console.log("in identify call")
  }
)
  • user-id is a unique id used within your organisation to identify a user. Preferable to not use any PII such as email, phone no, etc as user-id.
  • traits is a flat-map of user attributes.