Newsletter agreements

You can enable newsletter agreements by using an HTML form or calling the SDK. For the API method, see Managing newsletter agreements with API.

Note: Custom agreements, such as agreement to receive alcohol commercials, are saved as custom profile attributes (for example, "agreeToAlcoholAds": true). They can be managed like other custom attributes.
If you want to collect custom attributes for use as agreements with an HTML form or JS SDK methods, see Tracking form data.

Prerequisites

These prerequisites apply to HTML forms and SDK methods.

HTML form

Use the data-synerise="newsletterAgreement" and data-synerise-value="enabled" attributes (both attributes are required) on an input element in the form.

Option 1: Invisible input element; customer only provides the email

<form action="" method="post" data-synerise="newsletter">
    <input type="text" name="email" data-synerise="email" placeholder="Email" value="john.doe@synerise.com" />
    <input type="submit" value="Subscribe">
    <input type="hidden" data-synerise="newsletterAgreement" data-synerise-value="enabled" id="newsletterAgreement">
    <!-- Additional fields --> 
</form>

Option 2: A visible checkbox

Important: The value and additional attributes of the checkbox are sent only if the checkbox is selected.
<form action="" method="post" data-synerise="newsletter">
    <input type="text" name="email" data-synerise="email" placeholder="Email" value="john.doe@synerise.com" />
    <input type="checkbox" data-synerise="newsletterAgreement" data-synerise-value="enabled" id="newsletterAgreement" checked>
    <label for="newsletterAgreement">I want to receive the newsletter</label>
    <input type="submit" value="Subscribe">
    <!-- Additional fields --> 
</form>

This information is processed in the following way:

  1. A form.submit event with the data is saved to the customer’s account.
  2. The customer’s profile is updated with the 'newsletter_agreement_enabled': 'enabled' attribute.
  3. An event with details of the profile update is created and triggers the workflow that collects newsletter agreements.
  4. One of the following happens:
    • If single opt-in is used, the agreement is enabled. Depending on the workflow configuration, the customer may receive an email with a notification.
    • If double opt-in is used, the customer receives an email and must click the link in that email to confirm the subscription.

JavaScript SDK

Enabling a newsletter agreement

To enable a customer’s newsletter agreement, use the SR.event.sendFormData() method. As the profile identifier, you can use the email or the custom ID:

Email can be used as an identifier only when non-unique emails are disabled.

SR.event.sendFormData('newsletter-agreement', {
    email: 'john.doe@synerise.com',
    newsletterAgreement: 'enabled' //translates to "newsletter_agreement_enabled: 'enabled'" for the backend
})

This information is processed in the following way:

  1. A form.submit event with the data is saved to the customer’s account.
  2. The customer’s profile is updated with the 'newsletter_agreement_enabled': 'enabled' attribute.
  3. An event with details of the profile update is created and triggers the workflow that collects newsletter agreements.
  4. One of the following happens:
    • If single opt-in is used, the agreement is enabled. Depending on the workflow configuration, the customer may receive an email with a notification.
    • If double opt-in is used, the customer receives an email and must click the link in that email to confirm the subscription.

Disabling a newsletter agreement

To disable a customer’s newsletter agreement, use the SR.event.sendFormData() method. As the profile identifier, you can use the email address or the custom ID:

Email can be used as an identifier only when non-unique emails are disabled.

SR.event.sendFormData('newsletter-agreement', {
    email: 'john.doe@synerise.com',
    newsletterAgreement: 'disabled'
})

The agreement is disabled immediately and a form.submit event with the data is saved to the customer’s account.

😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker