Personalize site content using demand base
2014 26 Feb

Personalize your site content using Demandbase

By Gaurav Goyal

In any industry, it is critical to provide personalization experiences to customers, suppliers and partners. The Demandbase platform provides superior personalization using Demandbase Real Time Identification Services.

Demandbase Real Time Identification Services enhance published websites, providing a visitor's company profile to create a targeted visitor experience. Specifically, images, content, links or navigation can be customized based on relevant information from Demandbase based on the visitor's company.

With Demandbase you can do various things to your site like :

  1. Displaying relavant banner or background images based on the visitor's industry, company or etc.
  2. Treat your customer with account-specific information.
  3. If you are using webforms you can present specific webforms accordingly or lots of other things depending on your need.

To understand this lets assume a user comes to your site, lets say user is from the healthcare industry, now with Demandbase you can replace all your images with images related to healthcare industry or on contact-us forms you can fill the fields according to data fetched from Demandbase. With Demandbase you can get a sudden increase of hits on your site.

How to implement ?

This can be done on both client side and server side. This blog will be about client side integration of Demandbase to your site.

Requirement :-

1. Demandbase Key - To get your Demandbase key contact :

2. demandbase-1.0.0-min.js


API's for Client side implementation :

1.  IP Address API :- Returns the response according to IP

2. Domain API :- Returns the response according to domain name


1. IP Address API

EndPoints : 

1. - Returns the response in XML format

2. - Returns the response in JSON format


2. Domain API

EndPoints : 

1. - Returns the response in XML format

2. - Returns the response in JSON format


Parameters (for both API's endpoints): 

key - Required - Your Demandbase Key
query - optional - IP address or domain name (if this is left blank default IP of user will be taken)
callback - optional - callback function
page - recommended - recommended value document.location.href
page_title - recommended - recommended value document.title
referrer - recommended - recommended value document.referrer

Responses : 

Identification - if Demandbase found the data in its database
Classification - if Demandbase does not have data for this ip but it is in 
Error - If data related to this ip does not exists on both.

Examples : 

1. IP Address XML :

2. IP Address JSON :

Drupal Personalization :

Step 1 :

Add demandbase-1.0.0-min.js and your custom js (lets say demandbase_custom.js) on your site using (Drupal 7)

drupal_add_js('', array('type' => 'external'));

Step 2 : In demandbase_custom.js, add the following code snippet

Using ajax :

var myKey = "[Your_Demandbase_Key]";
   url: ''+myKey+'&page='+document.URL+'&referrer='+document.referrer,
   dataType: 'json',
   success: function(result) {
     // Response handler for IP API call,
     if(result) {
        industry = result.industry || '';
   error: function(xhr, textStatus, errorThrown) {
     // Optional error handler for 404 errors, etc.

using Demandbase Client :

// Instantiate the Demandbase client, passing API key.

var db_client = new DemandbaseClient("[Your_Demandbase_Key_Goes_Here]");
Call the IP address API

If your provide a ip_address then it will give the information for that ip else it will take user's default ip address

var ipAddress = "";

// Inline function calling, You can also give the name of the function.

db_client.ip(ip_address, function(company)) { 

// Do personalization to your site.

// Company will have all the information about IP address provided.


// Passing function name.

db_client.ip(ip_address, some_personalization)

var some_personalization = function(company) {

// Do personalization to your site.

// Company will have all the information about IP address provided.


and thats it...!!!!!

For server side integration of Demandbase there is a module Demandbase however it does not provide any client side integration.

NOTE : For domain name implementation replace IP with domain in code like db_client.ip will be db_client.domain.

For Demandbase api documentation please visit Demandbase API documentation.

Please let me know in the comments if you have any queries..enjoy personalization..!!!!

Featured blog


Personalized Content is a Proven Entity !!

Irrespective of how big a business icon or brand you are, increasing the relevance of your website will always be critical to your success.

Read More

Git Hooks

Git hooks for better codes

We are programmers and we are always on the lookout for ways to improve our code. A good and structured way of coding defines the completeness of a programmer.

Read More

Drupal ,varnish cache

Hard time with Drupal, Varnish Cache and Cookies

Using a reverse proxy server in front of a web server is usually needed for every big site and it is a very good thing to do so as reverse proxy server will handle all the anonymous traff

Read More

Say no to captcha

Say no to captcha - Various Spam Protection Methods

Maintaining high traffic websites have their own merits and demerits, the most annoying thing about them is SPAM.

Read More