Created
April 21, 2015 20:18
-
-
Save loopj/f827030644710d785bb2 to your computer and use it in GitHub Desktop.
Clearbit "lead information" overlays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Clearbit Lead Information Popover | |
# | |
# Dependencies: | |
# - jQuery | |
# - Bootstrap (for popovers) | |
# | |
# Screenshot: | |
# http://i.imgur.com/wWmUeGZ.png | |
# | |
CLEARBIT_KEY = "your-api-key-here" | |
# Attach lead scoring to every element with the "data-lead-info" attribute, | |
# For example: <span data-lead-info="[email protected]">James Smith</span> | |
$("[data-lead-info]").each -> | |
$el = $(this) | |
email = $el.data("lead-info") | |
request = $.ajax | |
url: "https://person-stream.clearbit.com/v1/combined/email/#{email}" | |
headers: | |
Authorization: "Basic #{btoa(CLEARBIT_KEY+":")}" | |
request.done (data) -> | |
return unless data.company && !data.company.emailProvider | |
$el.css("cursor", "help") | |
$el.popover | |
html: true | |
placement: "top" | |
container: "body" | |
trigger: "hover" | |
delay: 500 | |
content: | |
""" | |
<b>Company:</b> #{data.company.name}<br> | |
<b>Alexa Rank:</b> #{data.company.alexa?.globalRank?.format()}<br> | |
<b>Alexa US:</b> #{data.company.alexa?.usRank?.format()}<br> | |
<b>Raised:</b> $#{data.company.raised?.format()}<br> | |
<b>Employees:</b> #{data.company.employees?.format()} | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment