Skip to main content

Installation guide

This page shows how to add Addressfinder's phone verification service to a custom form.

JavaScript snippet

This is the simplest way to add phone verification to your website. It only takes a few minutes.

Copy the code snippet below and update the phoneSelector and licenceKey with your values, then add it within the <body> tags in your webpage - ideally just before the closing </body> tag.


<script>
(function (d) {

// ADDRESSFINDER PHONE VERIFICATION
// https://addressfinder.com/phone-verification

var conf = {
phoneSelector: "#phone_number",

licenceKey: "ADDRESSFINDER_DEMO_KEY",

defaultCountryCode: "AU",
// allowedCountryCodes: "AU, NZ",

rules: {
},
};

d.addEventListener("DOMContentLoaded", function () {if (d.querySelector(conf.phoneSelector)) {var e=d.createElement("script");e.src="https://api.addressfinder.io/assets/phone/v2/widget.js",e.async =!0,e.onload=function(){new AddressfinderPhone.Phone.Widget(conf.phoneSelector,conf.licenceKey,conf)},d.body.appendChild(e)}});
})(document);
</script>

Once the snippet is added, phone verification will automatically start working with your form fields. You can further customise the verification service by adding rules.

Step-by-step guide

You should have a working web form containing a phone number field.

  1. Copy and paste the code snippet at the bottom of your webpage before the closing </body> tag.
  2. Replace the value of phoneSelector with the ID attribute of your email field (e.g. #phone_number). You can also use a CSS selector such as input[type=number] or input[name=phone_number].
  3. Replace the value of licenceKey with your credentials, you can find it in the Addressfinder Portal.
  4. Set the default country code using the ISO alpha-2 standard.
  5. Customise the verification service settings by including advanced rules (optional).

To get a license key, sign up for a 30-day free trial.
Already have a subscription? Find your key in the Credentials section in the Portal.