Unbounce Landing Page Integration

With our Unbounce landing page integration, you can effortlessly connect to Data8’s comprehensive data quality solutions, ensuring greater confidence in your data.

Why stand back and let another mistyped field become another missed opportunity? Integrate all your Unbounce forms with Data8’s advanced data quality solutions, and instantly gain a significant ROI.

By validating your customer’s data in real-time, you’ll save valuable time and money contacting invalid records, improve your campaign success rate and increase conversions.

Customer Success Stories

Discover how Data8 has helped organisations worldwide enhance data quality, streamline processes and save both time and money.

Services Available Within Unbounce Landing Page Integration

Email Address
Validation

We look beyond syntax; checking for typos, fuzzy logic and spelling mistakes in both the username and domain parts of the address.

Phone Number
Validation

Our service goes beyond checking the length of the number; it verifies whether it’s callable & identifies information such as its type and network.

Download Configuration Code

				
					<!-- Start of Data8 Unbounce Validation -->

<script type="text/javascript">

  // Global config for Data8 validation
  var d8Validation = {
      apiKey: " your-api-key-here",
      email: {
          enabled: true,
          level: "Address",
          msg: "Email address is invalid"
      },
      phone: {
          enabled: true,
          defaultCountryCode: "44",
          msg: "Phone number is invalid"
      },
      validationInProgress: false
  };

  // Runs on form submission
  function startData8Validation(field) {
      if(field.type === "email" && d8Validation.email.enabled && field.value)
        validateEmailAsync(field);
      else if(field.type === "tel" && d8Validation.phone.enabled && field.value)
        validatePhoneAsync(field);
  }

  function validateEmailAsync(field, valid) {
      var params = {
          email: field.value,
          level: d8Validation.email.level,
          options: {
              ApplicationName: 'Unbounce'
          }
      }

      var req = new XMLHttpRequest();
      req.open("POST", "https://webservices.data-8.co.uk/EmailValidation/IsValid.json?key=" + d8Validation.apiKey);
      req.setRequestHeader("Accept", "application/json");
      req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
      req.onreadystatechange = function () {
          if (this.readyState === 4) {
              req.onreadystatechange = null;

              if (this.status === 200) {
                  var result = JSON.parse(this.response);
                  if (!result.Status.Success)
                    reportValidationResult({ field: field, valid: true });
                  else if (result.Result !== "Invalid")
                    reportValidationResult({ field: field, valid: true });
                  else
                    reportValidationResult({ field: field, valid: false, msg: d8Validation.email.msg });
              } else {
                reportValidationResult({ field: field, valid: true });
              }
          }
      };

      req.send(window.JSON.stringify(params));
      d8Validation.validationInProgress = true;
      $('.lp-pom-form .lp-pom-button').prop('disabled', true);
  }

  function validatePhoneAsync(field, valid) {
      var params = {
          telephoneNumber: field.value,
          defaultCountry: d8Validation.phone.defaultCountryCode,
          options: {
              ApplicationName: 'Unbounce'
          }
      }

      var req = new XMLHttpRequest();
      req.open("POST", "https://webservices.data-8.co.uk/PhoneValidation/IsValid.json?key=" + d8Validation.apiKey);
      req.setRequestHeader("Accept", "application/json");
      req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
      req.onreadystatechange = function () {
          if (this.readyState === 4) {
              req.onreadystatechange = null;

              if (this.status === 200) {
                  var result = JSON.parse(this.response);
                  if (!result.Status.Success)
                  reportValidationResult({ field: field, valid: true });
                  else if (result.Result.ValidationResult !== "Invalid")
                  reportValidationResult({ field: field, valid: true });
                  else
                  reportValidationResult({ field: field, valid: false, msg: d8Validation.phone.msg });
              } else {
                reportValidationResult({ field: field, valid: true });
              }
          }
      };

      req.send(window.JSON.stringify(params));
      d8Validation.validationInProgress = true;
      $('.lp-pom-form .lp-pom-button').prop('disabled', true);
  }

  function reportValidationResult(result) {
      if (result.valid) {
          result.field.setCustomValidity("");
          result.field.classList.remove("data8Error");
      }
      else {
          result.field.setCustomValidity(result.msg);
          result.field.classList.add("data8Error");
      }

      result.field.reportValidity();
      d8Validation.validationInProgress = false;
      $('.lp-pom-form .lp-pom-button').prop('disabled', false);

      return result;
  }

  function checkForErrors(form){
    var inputs = jQuery('input', form);
    var validForm = true;

    if(d8Validation.validationInProgress)
      return false;
    for(var i=0; i<inputs.length; i++){
      if(inputs[i].classList.contains("data8Error")){
        validForm = false;
        if(inputs[i].type == "email")
          reportValidationResult({ field: inputs[i], valid: false, msg: d8Validation.email.msg });
        else if(inputs[i].type == "tel")
          reportValidationResult({ field: inputs[i], valid: false, msg: d8Validation.phone.msg });
      }
    }

    return validForm;
  }

  // Waits until window load to initialize
  jQuery(document).ready(function(){
      jQuery(function($) {
        // Attach to form fields onChange events.
        var form = jQuery(".lp-pom-form form");
        var formFields = form[0].getElementsByTagName('input');
        for(var i=0; i < formFields.length; i++){
          var field = formFields[i];
          field.addEventListener('change', function(e){
            startData8Validation(this);
          });
        }

        // On submit perform check to see if any errors exist.
          $('.lp-pom-form .lp-pom-button').unbind('click tap touchstart').bind('click.formSubmit tap.formSubmit touchstart.formSubmit', function(e) {
            var valid = checkForErrors(form);
            if(!valid){
              e.preventDefault();
              e.stopImmediatePropagation();
            }
          });
          $('form').unbind('keypress').bind('keypress.formSubmit', function(e) {
            if(e.which === 13 && e.target.nodeName.toLowerCase() !== 'textarea'){
              var valid = checkForErrors(form);
              if(!valid){
                e.preventDefault();
                e.stopImmediatePropagation();
              }
            }
          });
        });
  });

</script>

<!-- End of Data8 Unbounce Validation -->
				
			

You might also be interested in...

Ready to get started?

Getting started could not be simpler. Register for a free trial, download the Unbounce code and install to begin reaping the rewards of Data8’s services.

For additional information on how to download the Unbounce code, click here for our installation guide.

Data8
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.