Skip to content

Instantly share code, notes, and snippets.

View lbernstein's full-sized avatar

Larry Bernstein lbernstein

View GitHub Profile
person: Object
annual_sales: 2147483647
city: "Cupertino"
company_name: "Apple"
country: "US"
pick: Object
annual_sales: 2147483647
city: "San Jose"
company_name: "Cisco Systems"
country: "US"
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>My Webpage</title>
<script type="text/javascript" src="http://api.demandbase.com/autocomplete/widget.js"></script>
<body>
<!-- Create input fields for email and company -->
<p>Email </p>
<input type="text" id="email" name="email" />
<p>Company </p>
<input type="text" id="company" name="company" />
<!-- Call Autocomplete, attach input fields and pass callback -->
<script>
var myCallback = function(data){
// A selection was made from the drop down
if(pick = data.pick) {
// Intentionally uses the assignment operator (=) instead of the equality operator (==) to
// check if data.pick is not null or undefined and assign it to a convenient local variable, company.
// Check if full firmographic data was returned by checking company_name.
// In this example we ignore if just registry info.
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>My Webpage</title>
<script type="text/javascript" src="http://api.demandbase.com/autocomplete/widget.js"></script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_setCustomVar',
1, // This custom var is set to slot #1. Required parameter.
'Industry', // The name acts as a kind of category for the user activity. Required parameter.
industry_var, // This value of the custom variable. Required parameter.
<script src="http://api.demandbase.com/api/v2/ip.js?key=<Your_Demandbase_Key>"></script>
<script>
var company_name = organization.company_name;
var industry = organization.industry;
alert("The company " + company_name " industry is " + industry);
</script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script>
<script>
jQuery.ajax({
url: 'http://api.demandbase.com/api/v2/ip.json?key=<Your_Demandbase_Key>',
dataType: 'json', // not 'jsonp'; this triggers CORS
//data: data, // optional params
success: function(result) {
// response handler for IP API call
industry = result.industry;
<body>
<p id="welcome">Welcome</p>
<!-- Call Demandbase IP API -->
<script type="text/javascript" src="http://api.demandbase.com/api/v2/ip.json?key=<Your_Demandbase_Key>&callback=demandbase_parse"></script>
</body>
</html>