Skip to content

Instantly share code, notes, and snippets.

@lbernstein
Created October 25, 2011 23:16
Show Gist options
  • Select an option

  • Save lbernstein/1314766 to your computer and use it in GitHub Desktop.

Select an option

Save lbernstein/1314766 to your computer and use it in GitHub Desktop.
<html>
<head>
<script type="text/javascript">
// Define some global variables and initialize to blank strings
var company_name = "",
industry = "",
revenue_range = "";
//Define the callback for Demandbase IP API
var demandbase_parse = function(company) {
if (company && company.company_name) {
company_name = company.company_name;
industry = company.industry;
revenue_range = company.revenue_range;
// More company info available if desired...
}
};
// Insert a company customization/personalizaton
function insertCustomization() {
// Personalize the Welcome text with the company name.
// Company name will be a blank string if none was found.
var welcomeP = document.getElementById("welcome");
var welcomeText = document.createTextNode(" " + company_name);
welcomeP.appendChild(welcomeText);
// Customize the message for the industry
var txt;
(industry) ? txt = "See our solutions for " + industry + ".": txt = "We have got great products!";
var solutionP = document.createElement("p");
var solutionText = document.createTextNode(txt);
solutionP.appendChild(solutionText);
document.body.appendChild(solutionP, welcomeP);
}
</script>
</head>
<body onload="insertCustomization()" > <!--After the page is loaded insert the company customization-->
<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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment