braze-inc / braze-web-sdk

Public repo for the Braze Web SDK
https://www.braze.com
Other
73 stars 25 forks source link

Question: Is there any difference using alias methods e.g. setFirstName vs setCustomUserAttribute("first_name")? #87

Closed nobbyclark closed 4 years ago

nobbyclark commented 4 years ago

I'm implementing the Web SDK for a client and just curious if there's a difference between using these alias methods and using the setCustomUserAttribute method as it's easier to use the latter for my use case.

froodian commented 4 years ago

Hi @nobbyclark,

Those calls are slightly different, yeah - setCustomUserAttribute("first_name") will set a custom attribute of "first_name", and does not set the built-in first name attribute. The built-in user attributes have more advanced validation, more convenient templating in the Braze dashboard, and enable more advanced functionality - for instance, the built-in email and phone fields are used for sending messaging campaigns from the Braze dashboard, the built-in language field integrates with the Braze dashboard composers, and several of the built-in fields have more advanced segmentation filters than you would get using custom attributes by the same name. It is best therefore to use the built-in methods instead of setCustomUserAttribute where applicable - apologies for any extra effort.

nobbyclark commented 4 years ago

@froodian Awesome, thanks for the detailed explanation and speedy response appreciate it.