Opt-in forms

An opt-in form is a form you can add to your website, where your users can sign up for email or SMS messaging.

About opt-in forms

Airship provides the methods to render an opt-in form via plugin in our Web SDK.

You can choose either to embed the form in your site or display in a modal window. Both embedded and modal versions are available in large and small formats.

The forms require the Airship Web SDK, and will adopt the stylings from your site’s CSS, but can be customized or adjusted further.

User registration handling:

The SMS or Email channel will be associated with a named user if one has already been set at the time the channel is added. If the channel is created prior to a Named User being set, the information and all other data collected will be associated with an Anonymous ContactAirship can set targeting data on a user before the user is associated with your internal ID and becomes a Named User. In this state, the user is an Anonymous Contact.. The Anonymous Contact will be set by Airship, and when a new Named User is set, this data will be transferred to it.

 Note

You must use individual forms for email and SMS; you cannot use the same for both channels.

Adding a form to your website

To add an opt-in form to your website, you must have the Airship Web SDK installed, and to render the form you must load the Opt-in Forms plugin.

Once the SDK is installed and you are loading the plugin, you can choose to embed the form into an existing element on the page, or by displaying a modal to the user.

 Important

The suggested opt-in text and the design and usage guidelines provided in the Documentation are not intended to be legal advice. The suggested text should not be used “as is”, and is instead an example of what may meet opt-in standards or requirements. Please consult your legal counsel before implementing particular language for your campaigns to address your specific use case or regulatory requirements in your jurisdiction.

Here’s an example of an embedded email form, specifying only the required options, targeting the email-opt-in element.

Place the HTML code anywhere on your website:

HTML
<div rel="email-opt-in"></div>

Add the Javascript code to the same page:

JavaScript
var element = document.querySelector("[rel=email-opt-in]")
var options = {
  platform: "email",
  size: "large", // or `small` for a smaller form
  doubleOptIn: false, // or `true` to require double opt-in, after configuring your opt-in message
  i18n: {
    en: {
      terms:
        'By checking this box, I agree that [COMPANY NAME] can be in touch with me by email to provide [insert purpose of communications - e.g. updates and marketing offers]. I understand that I can change my mind and opt out at any time by clicking the unsubscribe link in the footer of any email I receive from [COMPANY], or by contacting [email address]. I understand that I do not need to provide consent to these messages as a condition for any purchase. I understand that my information will be used as described here and in compliance with the <a href="https://brand.example/privacy">privacy policy</a>.',
      footer:
         '<a href="https://brand.example/terms">Our Terms of Service are available here</a>.'
    }
  }
}

UA.then(function (sdk) {
  return sdk.plugins.load("subscription-form", "https://aswpsdkus.com/notify/v1/ua-subscription-form.min.js")
}).then(function (formFactory) {
  formFactory.embedForm(element, options)
})

For more detailed examples of both email and SMS forms and a reference of available options and methods for your form, see Opt-in Forms in our Web SDK plugins documentation.