How to score sales leads programmatically

How to score sales leads programmatically

October 21, 2014

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
      // ...

The 4 rules for sending cold email that converts

Salesby Guillaume Cabane on January 01, 2021

Guest post by Guillaume Cabane, ex-VP of Growth at Drift [] and co-founder of HyperGrowth Partners [] The days of “spray and pray” email are over. Just consider these statistics: The average cold email response rate is 1%, which means for every 100 people you email, you’re getting through to one person (and probably bothering the other 99). Meanwhile, the average success rate of an email phishing attack is 0.1%, which really isn’t that much

Automate data-driven alerts for B2B sales and success

Salesby Bradley Gula on June 03, 2020

Instead of reviewing accounts one-by-one, what if reps could get a heads-up about key intent signals throughout the buying and customer journeys? And what if they knew who's most important to contact, when, and why?

Join our newsletter

Engaging stories and exclusive data, designed for our best customers. One useful issue each month.