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

B2B sales funnels: Why your website is a gold mine for sales

Salesby Clearbit Team on September 26, 2022

In everyday life as in sales, knowledge is power. If your reps aren’t leveraging every bit of intent data-driven knowledge at their disposal, they are leaving money on the table. Here's how intent data from your B2B website empowers sales.

How to use intent data to personalize B2B sales

Salesby Clearbit Team on September 22, 2022

If sales and marketing burn up too much money chasing low-quality leads, growth becomes impossible. How do you keep customer acquisition costs down? Instead of always chasing new, variable-quality leads for variable results, do more with what you already have by leveraging intent data.

Join our newsletter

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