An optional marketing opt-in toggle to enable users to give their permission for you to use their personal data for marketing purposes when creating an account can be added to the account create form. The toggle is optional to the user by default and therefore does not need to be checked in order for them to create an account.
The value of the toggle will be sent to your backend in the customer create request as a custom attribute containing a boolean value (true/false) This value will then need to be saved in your database. See below for specific platform implementations. It is also possible to add additional toggles to the account create screen allowing the user to consent to multiple different topics.
Technical Implementation details
Sales Force Commerce Cloud
The attribute will be added to the payload when creating the customer with the POST /customers
endpoint
POST /customers?locale=en-NL
{
"password":"12345!aBcD",
"customer": {
"login": "jsmith"
"email":"jsmith@test.com",
"last_name":"Smith",
"first_name: "john",
"c_marketing_toggle": true ** Additional attribute **
}
}
Magento 2
The graphQL createCustomer
mutation is used to create an account and the attribute will be added to the payload
{
"query": "mutation($input: CustomerInput!) {
createCustomer(input: $input) {
customer {
id
email
firstname
lastname
default_billing
default_shipping
marketing_toggle
addresses {
id
firstname
lastname
company
street
postcode
city
country_id
telephone
region {
region_id
region
}
}
}
}
}",
"variables": {
"input": {
"email": "jsmith@test.com",
"password": "Password",
"firstname": "John",
"lastname": "Smith"
"marketing_toggle": true
}
}
}
Bridge API
The value of the toggle will be sent as a custom attribute accordingly to the regular API spec that has already been implemented
Shopify
This is not a supported feature on the Shopify platform integration