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 relevant 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 let's assume a user comes to your site, let's say the user is from the healthcare industry, now with Demandbase, you can replace all your images with images related to the 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 the 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 : support@demandbase.com

2. demandbase-1.0.0-min.js

 

APIs for Client side implementation :

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

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

 

1. IP Address API

EndPoints : 

1. http://api.demandbase.com/api/v2/ip.xml - Returns the response in XML format

2. http://api.demandbase.com/api/v2/ip.json - Returns the response in JSON format

 

2. Domain API

EndPoints :

1. http://api.demandbase.com/api/v2/domain.xml - Returns the response in XML format

2. http://api.demandbase.com/api/v2/domain.json - 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 the 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 www.aris.net
Error - If data related to this IP does not exist on both.

Examples : 

1. IP Address XML : 

http://api.demandbase.com/api/v2/ip.xml?key=Your_Demandbase_Key&query=20...

2. IP Address JSON :

http://api.demandbase.com/api/v2/ip.json?key=Your_Demandbase_Key&query=2...

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('https://dkj2m377b0yzw.cloudfront.net/clients/javascript/demandbase-1.0.0-min.js', array('type' => 'external'));

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

Using ajax :

var myKey = "[Your_Demandbase_Key]";
  jQuery.ajax({
   url: 'http://api.demandbase.com/api/v2/ip.json?key='+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 = "208.92.40.133";

// 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..!!!!

Latest Blogs

Security

Tips to Secure your Drupal Website with Ease: Basic Security checklist

If someone were to break in your room, they would probably learn less about you than if they hacked you on the internet.

Read More

intor_react

Introduction to React JS and Components

React is a flexible JavaScript library for building user interfaces and it lets you compose complex UIs from small and isolated pieces of codes which is known as Components.

Read More

Flexbox

How to simplify the layout of your website using Flexbox?

Have you ever scratched your head while working with CSS to make some simple layouts for your website? Are you fed up of running to the UI developers for small layout designs every time?

Read More

cache_context

Drupal 8 Cache Context: An efficient way for context based caching.

We are well aware of the fact that Drupal Cache API is a remarkable feature introduced in Drupal 8.

Read More