Custom Fields vs Metadata vs JSON

Article author
Memberstack Team

Aside from updating a Member’s email & password, there are 3 types of member data that you have access to. They are; Custom Fields, Metadata, and JSON.

You can update JSON and Custom Fields using the frontend & backend API, with forms & data attributes in Webflow, and through the dashboard. Metadata can only be updated from the backend

Custom Fields

Custom fields are global key-value pairs that you want to store across all members. Meaning, that when you create a custom field property - that property becomes available to ALL members.

Important: Custom fields have a limit of 100. We suggest using the Member JSON below for data that does not need to be shown to members.

EXAMPLE → You can use custom fields to store data I want every member to have like name, username, etc.

Learn more about custom fields

Screenshot__26_.png

Metadata

Can be used to store information on a Member like custom fields. There are a few key differences though... 

  • Metadata is read-only via the frontend
  • Metadata can only be updated via the backend.
  • Metadata comes in key-value pairs.
  • Metadata is unique to each member, which means each member can have different sets of key-value pairs in their metadata. 
  • Metadata is limited to 500 characters per member

EXAMPLE → You can use metadata to store info that might look different across members - like a set of external IDs you collected from having them connect with 3rd party integrations:
Member 1 might have GitHub ID, Intercom ID, Active Campaign ID, etc
While member 2 might have Instagram ID, Facebook ID, and Slack ID

Screenshot__25_.png

To get the logged-in member Metadata use the following code from our DOM package

window.$memberstackDom.getCurrentMember().then(({ data : member }) => {

if(member) {
let metadata = member.metaData
// Do stuff with logged in member data here
}
})

Member JSON

You can use the member JSON feature if you need to store more complex data on a Member. JSON objects can be nested, whereas custom fields and metadata only accept boolean types (true/false), strings and integers, as valid values.

EXAMPLE → You can use JSON to achieve something similar that you'd want to do with a database:

  • storing a list of tweets that a user published
  •  an array of member IDs that the user added as friends
  • JSON is limited to 5,000 characters per member

Screenshot__24_.png

To get the logged-in member JSON data use the following from our DOM package

window.$memberstackDom.getMemberJSON();

To update the logged-in member JSON data use the following from our DOM package

window.$memberstackDom.updateMemberJSON({ 
  json: {
    "nickname": "https://www.media.com/buckets/nicolas/avatar.jpg"
  }
});

Was this article helpful?

Comments

5 comments

  • Comment author
    Daniel Valencia

    Please make an article on how to get the JSON of a member using the front-end JavaScript API. Thank you.

    6
  • Comment author
    Fredi Fdez

    It'd be awesome to have an article on how to access and update the User's Json via Webflow's script in the front-end. Thanks Team! 

    5
  • Comment author
    Hugh Laverty

    In dire need of a guidance article here, specifically for accessing the JSON from a Webflow front-end. Thanks in advance 🙂

    2
  • Comment author
    Josh Lopez
    • Edited

    Just updated the article. To get JSON data use: 

    window.$memberstackDom.getMemberJSON();

    You can read more in our DOM package docs

    1
  • Comment author
    Jan Horubała

    Are you going to lift up limit for Member JSON? 5,000 characters is okey at the begging, but I'd like to keep more user data at memberstack side ;)

    2

Please sign in to leave a comment.