Created
December 26, 2016 23:37
-
-
Save maccman/5f3871c0c66d6f1385c5e1721f0cc9e0 to your computer and use it in GitHub Desktop.
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