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.

For more information, see the user guide: Opt-in Forms.

Loading the Plugin

The URL will differ depending on whether you are using our North America or EU data center:

Data center locationURL
North Americahttps://aswpsdkus.com/notify/v2/ua-subscription-form.min.js
EUhttps://aswpsdkeu.com/notify/v2/ua-subscription-form.min.js
Creating an email modal opt-in form (US data center)
var options = {
  platform: "email",
  size: "large", // or "small" for a smaller form
  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>.'
    }
  },
  automatic: {
      // required: how long until the modal appears. values are in milliseconds,
      // so multiply any value in seconds you wish to use by 1000
      appearDelay: 20 * 1000, // 20 seconds
      // optional: the modal will disappear after this amount of time if it is
      // not interacted with
      disappearDelay: 15 * 1000, // 15 seconds
      // optional: if the modal has been displayed before, don't show it again
      // for a period of time
      askAgainDelay: 7 * 24 * 60 * 60 * 1000 // 7 days
  }
}

UA.then(function (sdk) {
  return sdk.plugins.load(
    // globally unique plugin identifier; we always use `subscription-form`
    "subscription-form",
    // URL to the opt-in form script; this example is for the US data center
    "https://aswpsdkus.com/notify/v2/ua-subscription-form.min.js"
  )
}).then(function (formFactory) {
  formFactory.setupModalForm(options)
})

See below for the full list of options you may use when loading the plugin.

Options

The following table covers the options that apply to all forms. See format- and platform-specific options below.

KeyTypDescriptionDefault value
platformstringRequired — Platform, one of email oder sms
sizestringSize, one of large oder smallsmall
defaultTranslationstringDefault language, must have a translation specifieden
i18n.{lang}.termsstringRequired — Terms and conditions that a user agrees to when registering. HTML is supported for inserting links to any terms or privacy policy pages.
i18n.{lang}.headingstringHeading text on the form, omitted if not provided
i18n.{lang}.footerstringFooter text at bottom of form, omitted if not provided
i18n.{lang}.bannerUrlstringURL to a banner image, omitted if not provided
i18n.{lang}.placeholderEmailstringPlaceholder email address displayed in the form
i18n.{lang}.placeholderMsisdnstringPlaceholder MSISDNThe mobile phone number of an individual in your Airship audience. Each MSISDN represents an individual mobile device. displayed in the form
i18n.{lang}.submitButtonstringLabel for Submit button
i18n.{lang}.invalidEmailstringError message displayed when email is invalid
i18n.{lang}.invalidMsisdnstringError message displayed when phone number is invalid
i18n.{lang}.genericErrorstringError message displayed when registration fails
onRegisterfunctionA function to be called when a registration is submitted