Using data lookups
Data lookups allow you to retrieve contact, visitor, or custom object data. Implementing a data lookup on your website allows you to personalize web pages with contact or visitor information.
Using web data look ups, you can do the following:
- Display different web pages based on visitor profile data
- Display a specific web page to contacts belonging to an email group
- Allow entry to a portion of your site to known contacts
- Pre-populate a form
To implement a data lookup, you will need the following:
- In Oracle Eloqua, create a new data lookup. You will need the Data Lookup Key call the web data lookup.
- Ensure Oracle Eloqua tracking scripts are implemented on your web page.
Tip: To help implement a data lookup, use the sample code generated by Oracle Eloqua. To view the sample code, open the data lookup and click Data Lookup Options > Get Data Lookup Scripts. Learn more about creating a data lookup.
Writing contact data to a web page
The following describes writing contact data retrieved from a contact data lookup to a web page.
A div
is placed on the page and will be populated with the contact details returned by the data lookup.
<div id="contactinfo">
<!-- contact info will be added here -->
</div>
A JavaScript function dynamically creates paragraph elements with the retrieved data and places them in the div
above.
function CreateRow(label, value) {
var p = document.createElement('p');
var b = document.createElement('b');
p.appendChild(b);
b.appendChild(document.createTextNode(label));
p.appendChild(document.createTextNode(value));
document.getElementById('contactinfo').appendChild(p);
}
A callback function SetElqContent
is used to return the data from the lookup. The function name is important and must be called SetElqContent
. The data that is returned depends on how the data lookup was set up. In the following example, contact data is returned.
function SetElqContent() {
CreateRow('Contact Info: ', GetElqContentPersonalizationValue(''));
CreateRow('First Name: ', GetElqContentPersonalizationValue('C_FirstName'));
CreateRow('Last Name: ', GetElqContentPersonalizationValue('C_LastName'));
CreateRow('Email Address: ',GetElqContentPersonalizationValue('C_EmailAddress'));
CreateRow('Salesperson: ', GetElqContentPersonalizationValue('C_Salesperson'));
CreateRow('Company: ', GetElqContentPersonalizationValue('C_Company'));
CreateRow('Address 1: ', GetElqContentPersonalizationValue('C_Address1'));
CreateRow('City: ', GetElqContentPersonalizationValue('C_City'));
CreateRow('State or Province: ',GetElqContentPersonalizationValue('C_State_Prov'));
CreateRow('Zip or Postal Code: ',GetElqContentPersonalizationValue('C_Zip_Postal'));
CreateRow('Business Phone: ', GetElqContentPersonalizationValue('C_BusPhone'));
CreateRow('Country: ', GetElqContentPersonalizationValue('C_Country'));
CreateRow('Industry: ', GetElqContentPersonalizationValue('M_Industry1'));
CreateRow('Revenue: ', GetElqContentPersonalizationValue('M_Revenue1'));
CreateRow('Website: ', GetElqContentPersonalizationValue('M_WebSite1'));
CreateRow('Date Created: ',GetElqContentPersonalizationValue('M_DateCreated'));
}
The _elqQ.push()
is called that requests the data lookup from the Oracle Eloqua servers.
_elqQ.push(['elqDataLookup', escape('<Data_Lookup_Key>'), '<Data_Lookup_Criteria>']);
Data_Lookup_Key
is a global unique identifier (GUID) that is generated when you create the data lookup. You can retrieve it by opening up the web data lookup in Oracle Eloqua. The Data_Lookup_Criteria
(if required) is the criteria you set up to identify the contact or visitor. For example, email address <C_EmailAddress>user@example.com</C_EmailAddress>
. Learn more about creating a data lookup.
Trying it all together, we get the following:
<html>
<head>
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', '123']);
_elqQ.push(['elqTrackPageView']);
(function () {
function async_load() {
var s = document.createElement('script'); s.type = 'text/javascript'; s.async = true;
s.src = '//img.en25.com/i/elqCfg.min.js';
var x = document.getElementsByTagName('script')[0]; x.parentNode.insertBefore(s, x);
}
if (window.attachEvent) { window.attachEvent('onload', async_load); }
else { window.addEventListener('DOMContentLoaded', async_load, false); }
})();
</script>
<script type="text/javascript">
function CreateRow(label, value) {
var p = document.createElement('p');
var b = document.createElement('b');
var label = document.createTextNode(label);
var value = document.createTextNode(value);
p.appendChild(b);
b.appendChild(label);
p.appendChild(value);
document.getElementById('contactinfo').appendChild(p);
}
function SetElqContent() {
CreateRow('Contact Info: ', GetElqContentPersonalizationValue(''));
CreateRow('First Name: ', GetElqContentPersonalizationValue('C_FirstName'));
CreateRow('Last Name: ', GetElqContentPersonalizationValue('C_LastName'));
CreateRow('Email Address: ', GetElqContentPersonalizationValue('C_EmailAddress'));
CreateRow('Salesperson: ', GetElqContentPersonalizationValue('C_Salesperson'));
CreateRow('Company: ', GetElqContentPersonalizationValue('C_Company'));
CreateRow('Address 1: ', GetElqContentPersonalizationValue('C_Address1'));
CreateRow('City: ', GetElqContentPersonalizationValue('C_City'));
CreateRow('State or Province: ', GetElqContentPersonalizationValue('C_State_Prov'));
CreateRow('Zip or Postal Code: ', GetElqContentPersonalizationValue('C_Zip_Postal'));
CreateRow('Business Phone: ', GetElqContentPersonalizationValue('C_BusPhone'));
CreateRow('Country: ', GetElqContentPersonalizationValue('C_Country'));
CreateRow('Industry: ', GetElqContentPersonalizationValue('M_Industry1'));
CreateRow('Revenue: ', GetElqContentPersonalizationValue('M_Revenue1'));
CreateRow('Website: ', GetElqContentPersonalizationValue('M_WebSite1'));
CreateRow('Date Created: ', GetElqContentPersonalizationValue('M_DateCreated'));
}
_elqQ.push(['elqDataLookup', escape('434C5E6250C04FCBB0D4FC5413F9A40A'), '
<C_EmailAddress>user@example.com</C_EmailAddress>']);
</script>
</head>
<body>
<div id="contactinfo">
</div>
</body>
</html>