Customer tags
You can add and remove tags to a customer with the customer.addTag
and customer.removeTag
methods. After calling customer.save
, the customer record will be updated with the new changes. Before you can get started, you’ll need to whitelist the tags you intend on applying.
Whitelisted tags
Tags are required to be whitelisted to prevent tampering, as some apps depend on tags to identify certain customers in order to provide functionality to them that would otherwise be limited.
If you’re submitting changes with a formId
, any fields that have the autotag featured enabled will automatically whitelist the values listed within that field. However, you may want to manage a unique tag. To do so, go to Edit > Settings > Whitelisted Tags (at the bottom), and input the comma-separated tags you’d like to whitelist.
Note
Keep the
formId
in mind, because you’ll need it when you want to save the customer.
Add tag
CF.customer.addTag("my_tag");
CF.customer.save({ formId: '<form id that contains whitelisted tags>' });
Undo added tag
Perhaps you wish to undo an added tag, but not remove it in case the customer already has it. Here’s what you’d need to do:
CF.customer.removeTagFromTagsToAdd("my_tag");
Remove tag
CF.customer.removeTag("my_tag");
CF.customer.save({ formId: '<form id that contains whitelisted tags>' });
Undo removed tag
CF.customer.removeTagFromTagsToRemove("my_tag");
Next up: Customer events