Creating your own sample Eloqua Data Lookup script (cookie based) for your Developer



 

Our customers are always looking at ways to customize their website and integrate it with Eloqua. One of the key functions to help you integrate is Data Lookups. A data lookup is a function which allows the dynamic pulling of data from the Eloqua system for use on a given web page. The range of data that can be returned is virtually unlimited allowing for Contact, Prospect, Data Card, Group membership or Visitor data to be returned. You can use data lookups to populate data in a form or validate if the contact is part of an email group. Advanced use cases include using data lookups within Flash. Whatever the use case may be, I always receive requests to generate a sample data lookup script for the developer (who is usually not familiar Eloqua). Some of you may know that we do have a way to ‘generate’ a sample data lookup script but it requires some additional work to get a working example (which is what the developer is always looking for). Hopefully the steps below will help you create a working web page that you can provide to your developer. In this example we will create a lookup based on cookie.

 

  1. Navigate to Automate -> Forms -> Web Data Lookup (tab). Then Data Lookup -> New data lookup.
    • a) Give your data lookup a name
    • b) Select Visitors as your Data lookup type
    • c) Select a Visitor Profile view for data you would like to be returned.
    • Click Save

 

pic1.jpg

 

2. Go to your note pad and create a new HTML file.

 

3. Add the following code at the beginning of your page.

<html>

<body>

 

4. Now from your Data Lookup screen in Eloqua.

  • Click on Data Lookup Options (top right)
  • Click ‘Get Data Lookup Scripts’
  • Grab the code from the ‘Form Auto-Population Script’ and add it below the code you added in step 3. (This code returns all the data in the selected view)

 

pic2.jpg

 

5. Add the two standard tracking scripts used on your web page. (Note URLs below are fake). You can copy this directly from your web page. Ensure that you URL are absolute links.

 

<script type='text/javascript' language='JavaScript' src='http://www.somecompany.com/includes/elqCfg.js'></script>

<script type='text/javascript' language='JavaScript' src='http://www.somecompany.com/includes/elqImg.js'></script>

 

6. Back to your Data Lookup screen in Eloqua.

  • Grab the code from the ‘Integration Script’ and add it below the code you added in step 5.

 

7. Now you need to call another JavaScript that is included in the tracking scripts package. This should be in the same folder as your standard scripts.

 

<script type='text/javascript' LANGUAGE='JavaScript' SRC='http://www.somecompany.com/includes/elqCPers.js'></script>

 

8. Almost done. Now you just need to add the following tags to complete the HTML page.

 

</body>

</html>

 

That’s it. If you run this HTML file in your browser (that has an Eloqua cookie from your companies web page), you should see data rendered within the page. This sample file can be provided to your developer as a working example on how Eloqua data lookups work. I have included a full version of the code below.

 

 

-----------------------------------------------------------

 

<html>
<body>

<SCRIPT TYPE='text/javascript' LANGUAGE='JavaScript'><!--//
function SetElqContent(){
if (this.GetElqContentPersonalizationValue){

document.write('<p><b>Personal Info:</b>');
document.write(GetElqContentPersonalizationValue(''));

document.write('<p><b>First Name:</b>');
document.write(GetElqContentPersonalizationValue('V_ElqFirstName'));

document.write('<p><b>Last Name:</b>');
document.write(GetElqContentPersonalizationValue('V_ElqLastName'));

document.write('<p><b>Email Address:</b>');
document.write(GetElqContentPersonalizationValue('V_ElqEmailAddress'));

document.write('<p><b>Company:</b>');
document.write(GetElqContentPersonalizationValue('V_ElqCompanyName'));

document.write('<p><b>Phone Number:</b>');
document.write(GetElqContentPersonalizationValue('V_ElqPhoneNumber'));

document.write('<p><b>Visit History:</b>');
document.write(GetElqContentPersonalizationValue(''));

document.write('<p><b>Total Visits:</b>');
document.write(GetElqContentPersonalizationValue('V_Total_Visits'));

document.write('<p><b>Total Pages:</b>');
document.write(GetElqContentPersonalizationValue('V_Total_Pages'));

document.write('<p><b>Last Visit:</b>');
document.write(GetElqContentPersonalizationValue('V_LastVisitDateAndTime'));

document.write('<p><b>Other Info:</b>');
document.write(GetElqContentPersonalizationValue(''));

document.write('<p><b>Salesperson:</b>');
document.write(GetElqContentPersonalizationValue('V_Salesperson1p'));

} else {
document.write('<p><b>Personalization functions not found</b><p>');
}
}
//--></SCRIPT>

<script type='text/javascript' language='JavaScript' src='http://www.somecompany.com/includes/elqCfg.js'></script>
<script type='text/javascript' language='JavaScript' src='http://www.somecompany.com/includes/elqImg.js'></script>

<SCRIPT TYPE='text/javascript' LANGUAGE='JavaScript'><!--//
var elqPPS = '50';
var elqDLKey = escape('9adf75e2f3cb4a1b9c5f344d68342356');

var elqDLLookup = '';
//--></SCRIPT>

<script type='text/javascript' LANGUAGE='JavaScript' SRC='http://www.somecompany.com/includes/elqCPers.js'></script>

</body>
</html>

 

 

-------------------------------------