Clearbit Reveal/Drift integration
This file contains 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
drift.on('ready',function(api, payload) { | |
api.showWelcomeOrAwayMessage(<%== @options.to_json %>); | |
}); |
This file contains 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
get '/drift.js' do | |
reveal = Clearbit::Reveal.find(ip: request.ip) | |
content_type 'application/javascript' | |
qualified = | |
reveal && | |
reveal.company.metrics.employees.to_i >= 30 && | |
%{private public}.include?(reveal.company.type) | |
if qualified | |
unless reveal.fuzzy | |
name = reveal.company.name.gsub(/\W/, '') | |
message = %{We ♥ #{name}. Have any questions?} | |
end | |
@options = { | |
showAvatar: true, | |
slide: true, | |
message: message, | |
} | |
erb :'site/drift/show' | |
else | |
200 | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment