Visitor fields are the fields in Qualified where you will store everything you wish to track and know about your website visitors. Visitor fields contain information you might gather through chatting/talking to a lead directly, information they might have given you explicitly through a lead form or bot, or other info that might be pulled from an external system, like Salesforce, Pardot, or Clearbit.
In this article, we’ll go over how to place validation rules on your visitor fields to ensure that the data you collect from visitors is accurate and formatted correctly.
Getting Started
To get started, you’ll want to first log in to Qualified and navigate to the visitor fields settings. Then, you’ll need to determine if an existing visitor field needs to be formatted in a certain way, or if you’d like to add a new visitor field and validation rule. You can edit existing visitor fields at any time.
Click on the “Add Validation” area next to your visitor field to add a validation. Notice that you can only add validation to text fields.
There are some fields that we already validate for you based on common formatting such as:
- Phone (555-555-5555)
- Email (name@company.com)
We cannot add validation to:
- Number Fields
- Picklist
Some common uses for field validation are email and phone (we do this automatically as mentioned above). However, you might want to validate other fields as well such as username, URL, product serial number, or character limits.
Qualified has identified some common validation criteria and we offer these out-of-the-box while others you can create custom on your own.
Out-of-the-Box Validations
Qualified has some out-of-the-box validations already set up for you, including postal code and URL. When you select one of these validation rules, you’ll see the syntax we use behind the scenes to make sure the validation works correctly. This is called a regular expression and it’s used as an industry standard.
Select your out-of-the-box validation rule by selecting it from the drop-down box in the pop-up modal.
Once you’ve finished your selection, press ‘save’ on your visitor fields to ensure the validation starts taking place immediately for your visitors.
Custom Validation Rules
Qualified gives you the opportunity to create your own validation rules for your visitor fields if we don’t have your rule out-of-the-box. This could include specific username validations, product id’s, and serial numbers.
Behind the scenes, Qualified uses regular expressions to create validation rules, which is an industry-standard programming language. If you're ready to test your own custom validation rules, check out regular expression 101.
Before we jump in, you may need a little help from our support team to if you don't already have a background in computer science. That's okay! We’re here to help and want to make this as easy as possible for you.
Regular expressions have a reputation for being gnarly, but that all depends on how you approach them. There is a natural progression from something as simple as this:
\d
To something as complicated as the expression below.
^(\(\d{3}\)|^\d{3}[.-]?)?\d{3}[.-]?\d{4}$
You can see then how you might need some help from our team, so feel free to reach out and let us know what you’re trying to validate so that we can help write out the regular expression for you.
To give you some ideas on how to use regular expressions we’ve given you an example below of a custom validation rule and the regular expressions used to create them.
Example: Serial Number
In this example, we’ll use serial number as our visitor field validation rule. As visitors come to the site, they can speak with our team and get more information about add-ons for the product they’ve recently purchased. In order for our team to know the exact product, we’ll ask the visitor to give us the product serial number and validate that against a regular expression.
All serial numbers should have the same structure in our made-up company: ABCD-1234-XYZ. To get started we’ve created a visitor field titled “Serial Number” and we’ve selected to create a custom rule to validate the data that visitors enter into this field.
You’ll notice that our regular expression looks like:
^[A-Z]{4}-\d{3}-[A-Z]{3}$
In plain English this means:
^ The start of the expression
[A-Z]{4} The first group of characters should be any uppercase letters A-Z and only allow 4 of them followed by a dash.
\d{3} The next group of characters should be only digits 0-9 and allow only 3 of them followed by a dash
[A-Z]{3} The last group of characters should be any uppercase letters A-Z and only allow 3 of them.
$ Do not validate any other characters that are added beyond this.
Common Expressions
Here are some common expressions used:
Limit field to 255 Characters:
^.{0,255}$
Time format HH:MM 12 hour:
/^(0?[1-9]|1[0-2]):[0-5][0-9]$/
Zipcode: There is no single regex that can handle all zip codes given that zip codes around the world do not follow a common pattern.
Summary
Visitor fields allow you to store data about your visitors and display data to your sales team about your visitors arriving from outside sources, such as Salesforce. Using visitor field validation, you can ensure that the data visitors are giving to you via Qualified is in a strict format and valid. While Qualified will validate some data out-of-the-box for you, you can also choose to create custom validation rules using regular expressions or regex.