How to score sales leads programmatically

If your business has an inbound sales process then you're probably measuring the quality of leads. Knowing how important a lead is helps with prioritizing followups effectively. Proactively reaching out to valuable leads and giving them the white-gloves treatment can also help conversion.

At Clearbit we have a system that scores incoming leads based on our data, and sends us an email alert when a high value lead, such as a company that's raised money, signs up.

Today I want to release the library behind our lead scoring and take you through integrating it into your application.


First install the clearbit-leadscore gem. You'll also need to signup for a Clearbit account if you haven't already. The first 50 requests are free and a credit card isn't required. Make sure to note down your Clearbit API key.

$ gem install clearbit-leadscore

Next let's create the ruby script that'll do our lead scoring:

require 'clearbit/leadscore'

Clearbit::LeadScore.key = ENV['CLEARBIT_KEY']

result = Clearbit::LeadScore.lookup(email_or_domain)

if result
  puts "Name: #{}"
  puts "Company name: #{}"

  if result.score > 0.5
    puts "Baller"
  puts "Person or company not found"

Clearbit::LeadScore.lookup takes either an email or a domain, and will return a response containing the person related to the email (if Clearbit can find one), and the company related to the email's domain.

Also returned is a score attribute which is out of 1.0. Generally speaking any score over 0.5 is a good sign.

The actual algorithm for calculating a lead's score is fairly straightforward, and is based on how influential a person is (Twitter followers etc) and how valuable a company is (amount raised, number of employees etc). Feel free to change the weights dependent on what's appropriate for your target audience.

Alternatively, for one-off lookups you can use the included executable:

$ clearbit-leadscore -k API_KEY

      "person" => {
        "name" => {
          "fullName" => "Lachy Groom",
        "bio" => "I work on International @stripe",
      "company" => {
        "name" => "Stripe",
        "raised" => 120000000.0,
        "employees" => 153,
        // ...
      "score" => 1.0
      // ...