You are on page 1of 22

Eloqua Asynchronous

Visitor Tracking Scripts


(with Support for First-Party Cookies
[Open Beta Summer 14])

Copyright 2012-2014 Oracle Corporation. Revision 2.4 All rights reserved.

Table of Contents
Overview ............................................................................................................................2
Basic Page View Tracking .................................................................................................4
Basic Page View Tracking with First-Party Cookies ......................................................4
Tracking to Multiple Eloqua Instances ...........................................................................4
Tracking custom URLs/Referrers ..................................................................................7
Outbound Link Tracking .....................................................................................................8
Externally Hosted Forms ....................................................................................................9
Data Lookups ................................................................................................................... 11
Flash Content Tracking .................................................................................................... 13
Strict Mode Tracking ........................................................................................................ 16
Require opt-in for visitors by Country .......................................................................... 17
Require opt-in for all Visitors ....................................................................................... 18
Customizing the Opt-in/out Banner ............................................................................. 19
Opting-In/Out ................................................................................................................... 21

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

1 / 22

Overview
The Eloqua asynchronous tracking scripts allow you to track visits to your website seamlessly and without
affecting the page load time for your visitors. They are supported and tested in all major browsers, including:

o
o
o
o
o

Microsoft Internet Explorer 6+


Mozilla Firefox 1.5+
Opera 9+
Apple Safari 3+
Google Chrome

In order to ensure the highest probability that Eloqua tracks the page before the visitor decides to leave the page
or move on to another, the scripts are executed after the entire Document Object Model (DOM) is loaded, but
before all content is loaded in all browsers (except IE8 and below). The DOM is the specification for how objects
in a Web page are represented (e.g. images, headers, links, etc.), and defines what attributes are associated with
each object, as well as how the objects and attributes can be manipulated. While the DOM is a standard,
different browsers support different levels of the DOM and Javascript standards. IE8 and below do not support
the event that indicates when the DOM has been completely loaded, and for those browsers, the entire page is
loaded before requests to the Eloqua servers are made.
Visitors are remembered based on a cookie value stored in their browser. There are two types of cookies: firstparty and third-party. How they are tracked in Eloqua varies from one to the other.
In the case of third-party cookies, upon the first request to a tracked website made by the visitor, a cookie with the
.eloqua.com domain is created and populated with a unique identifier, even if the website is not on the
eloqua.com domain. This unique identifier (GUID) does not contain any information about the visitor, and is only
used to correlate return visits by the same visitor. Unless the visitor clears cookies from the browser, this GUID
remains constant and will continue to track his or her online activity.
However, as is already the case with the Safari browser on Apples iOS platform, Mozilla, Microsoft and Google
may also consider blocking third-party cookies by default in Firefox, Internet Explorer and Chrome, respectively,
in the near future. When this occurs, this would prevent Eloqua from being able to track a visitors digital body
language. To get around this restriction, you can add tracking scripts to your web pages to enable first-party
cookies, with certain limitations:

It is not possible to use a first-party cookie to track a single visitors digital body language across multiple
domains owned by your organization. For example, suppose Oracle wishes to track a visitor on both
oracle.com and eloqua.com. While it was previously possible to use a single third-party cookie to
accomplish this, it is not possible using first-party cookies. In this instance, a separate first-party cookie
is required to track visitors activity on each domain as discussed in Basic Page View Tracking with FirstParty Cookies.

The chart below illustrates one scenario in which the new first- and third-party cookies affect tracking in Eloqua:
Visitor Action
Bob clears cookies in Firefox and browses to
marketing.oracle.com.

Bob navigates through several pages on the


marketing.oracle.com domain.

Effect on Cookies and Tracking


Tracking scripts determine this is a new (first-time)
visitor to the oracle.com domain and adds a first-party
cookie with a computer-specific GUID to oracle.com to
his computer.
All activity on oracle.com is tracked using the firstparty cookie added above.

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

2 / 22

Visitor Action
Bob browses to www.oracle.com.
Bob browses to www.eloqua.com.

Bob submits a Form on www.eloqua.com.

Effect on Cookies and Tracking


The first-party cookie tracks all activity on the
oracle.com domain.
A first-party cookie for www.eloqua.com is added to
Firefox. Since oracle.com is a different domain, the
oracle.com cookie added above is treated as a thirdparty cookie, as oracle.com does not have visibility
into Bobs activity on www.eloqua.com.
The first-party Eloqua.com cookie is associated with
Bobs contact record. (The oracle.com cookie is not
associated with his record.)

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

3 / 22

Basic Page View Tracking


To add the Eloqua tracking scripts to your site add the following block of code on your pages:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', 'site`Id']);
_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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
</script>
_elqQ is a queue of commands to push to the Eloqua servers. They are queued up and executed in order, once
the scripts have been loaded into the DOM. You will see how you can use this to perform different actions later
on in this document.
NOTE: Since the scripts are executed asynchronously, the above snippet can be placed anywhere on the page.
However, the only caveat is that if you plan to use other features like data lookups or opt-out pages, you must
ensure _elqQ is defined before it is used.

Basic Page View Tracking with First-Party Cookies


Please note that this is considered an OPEN BETA program in the Summer 14 release, and you must
request access by contacting Eloqua Product Support.
For domains configured to support first-party cookies, it is possible to drop a first-party cookie on the visitors
machine. If an existing third-party cookie already exists on that machine, its GUID is used for the first-party
cookie in order for Eloqua to continue to capture the visitors activity (digital body language). If no third-party
cookie exists, a first-party cookie with a unique GUID is dropped on the visitors machine.
The Summer 14 release introduces support for Strict Mode tracking using First-Party Cookies with the following
exception:

Strict Mode opt-in/opt-out preferences cannot be set using the Form Processing step.

The following options were implemented as of the Winter 14 release and continue to be supported in the
Summer 14 release:

Eloqua-hosted Landing Pages.


Branded and non-branded domains.
Secure websites (accessed via HTTPS:).

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

4 / 22

tracking.mysite.com should be same as the first-party cookie domain in your configuration. Also
mysite.com should have the same root domain on which your webpages are hosted.
If your tracking script references //img.en25.com for the location of the hosted Javascript file, the only
modification you must make to the script is the line highlighted in blue below substituting
tracking.mysite.com with the first-party cookie tracking domain in your configuration:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', 'siteId']);
_elqQ.push(['elqUseFirstPartyCookie', 'tracking.mysite.com']);
_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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
</script>
_elqQ is a queue of commands to push to our servers. They are queued up and executed in order, once the
scripts have been loaded into the DOM, discussed later on in this document.
NOTE: The above snippet can be placed anywhere on the page. Since the scripts are executed asynchronously,
it does not matter where they are placed on the page. However, if you plan to use other features like data
lookups or opt-out pages, you must ensure _elqQ is defined before it is used.
Retrieving the Visitor GUID using a First-Party Cookie
The code snippet on the following page returns the visitor GUID:

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

5 / 22

function elqGetGuidCookieValue() {
var name, value, index, cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
index = cookies[i].indexOf('=');
if (index > 0 && cookies[i].length > index + 1) {
name = cookies[i].substr(0, index).trim();
if (name == 'ELOQUA') {
value = cookies[i].substr(index + 1);
var subCookies = value.split("&");
for (var l = 0; l < subCookies.length; l++) {
var subCookie = subCookies[l].split("=");
if (subCookie.length == 2 && subCookie[0] == 'GUID') {
return subCookie[1];
}
}
}
}
}
return '';
}

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

6 / 22

Tracking to Multiple Eloqua Instances


Eloqua's asynchronous tracking scripts allow you to track to more than one instance of Eloqua if you have a
business need for doing so. Configuring that is as simple as calling elqTrackPageView twice after setting the
different siteIds. Here's an example:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', '123']);
_elqQ.push(['elqTrackPageView']);
_elqQ.push(['elqSetSiteId', '456']);
_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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
</script>
The highlighted lines show the two extra commands needed to make the extra call to the Eloqua servers in order
to track to a second instance.

Tracking Custom URLs/Referrers


By default, Eloqua's asynchronous tracking scripts use the current request URL and referrer that the browser
passes along to the Eloqua servers. This works well in the majority of cases, but there are times you may want
to customize the URL and/or referrer being passed to Eloqua's servers to get more value from the system. One
classic example is if you have a site that dynamically generates unique URLs that you wish to only track as one
resource for reporting purposes. To override the URL, simply call the elqTrackPageView function with a single
parameter, the URL you want Eloqua to track. For example:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', '123']);
_elqQ.push(['elqTrackPageView', 'http://www.mysite.com/downloads/']);
(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.addEventListener) window.addEventListener('DOMContentLoaded',

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

7 / 22

async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
</script>
If you would also like to override the referrer as well, adding a second parameter to elqTrackPageView()
allows you to do this:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', '123']);
_elqQ.push(['elqTrackPageView', 'http://www.mysite.com/downloads/',
'http://www.myreferrer.com']);
(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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
</script>

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

8 / 22

Outbound Link Tracking


Outbound link tracking allows you to track when users click specific links on your site. The links may be to other
sites or to a different location within your site. The links could be for web pages or they could point to documents
like PDFs or Word documents.
To accomplish outbound link tracking, you will have to modify your current anchor tags by adding an onclick
handler. For example, a link that currently looks like this:
<a href="http://example.com/documents/whitepaper.pdf"></a>
should be modified to look like this:
<a href="http://example.com/documents/whitepaper.pdf"
onclick="_elq.trackOutboundLink(this);return false;"></a>
If the above use case isn't valid for your situation, a more generic JavaScript function is exposed for this purpose:
_elq.trackEvent('http://example.com/documents/whitepaper.pdf');
NOTE: The trackEvent function above will track that the user has clicked on the particular document or URL,
but it won't actually redirect the user. You may need to use this functionality if you have a more complicated
workflow, but the first method, using trackOutboudLink, is the preferred method.

Reposting Externally Hosted Forms


Use these scripts when the form data is reposted to Eloqua servers from a server-side form processor. In this
case it is not possible to get the cookie from the client's machine, so the following scripts should be installed on
the form page to send the unique ID along with the form data.
In addition to the regular Eloqua form elements,
<input type="hidden" name="elqFormName" value="EloquaFormName" />
<input type="hidden" name="elqSiteId" value="SiteId" />
Add the following two hidden fields to your form:
<input type="hidden" name="elqCustomerGUID" value="">
<input type="hidden" name="elqCookieWrite" value="0">
Then, place the following code anywhere after the main tracking scripts appear on the page:
var timerId = null, timeout = 5;
function WaitUntilCustomerGUIDIsRetrieved() {
if (!!(timerId)) {
if (timeout == 0) {
return;
}
if (typeof this.GetElqCustomerGUID === 'function') {
Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

9 / 22

document.forms["EloquaFormName"].elements["elqCustomerGUID"].value =
GetElqCustomerGUID();
return;
}
timeout -= 1;
}
timerId = setTimeout("WaitUntilCustomerGUIDIsRetrieved()", 500);
return;
}
window.onload = WaitUntilCustomerGUIDIsRetrieved;
_elqQ.push(['elqGetCustomerGUID']);
This code will execute upon the page loading and will wait until the visitor's GUID has been retrieved from the
Eloqua servers and then insert it into the elqCustomerGUID form element. Be sure to replace
EloquaFormName with the actual name of your form as setup in the Eloqua application.

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

10 / 22

Data Lookups
Data lookups allow you to get information about a visitor, contact, data card, etc. to do things like auto-populate
forms, allow entry to a portion of your site to known contacts, and/or contacts who have already filled out a form,
etc.
To accomplish a data lookup, you will need the following:
1. Create a new data lookup key from within the Eloqua Application (see the Eloqua documentation for
how to do this).
2. Add the basic tracking scripts to your page.
Assuming you have completed steps 1 and 2 and have your Data Lookup key and optional Data Lookup value
ready, here's an example of how to retrieve that information:
For illustration purposes, we're going to create a simple div, and have it populated with some contact details by
the scripts. The first step is to add a div to our page in the main content section and give it an id of
contactinfo:
<div id="contactinfo">
</div>
Next, we need some JavaScript that will dynamically create some paragraph elements for us:
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);
}
Next, we add a function called SetElqContent. This is the callback function that is called when the Eloqua
servers have responded and sent back the contact info. The function name is important and must be called
SetElqContent.

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'));

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

11 / 22

CreateRow('Zip or Postal Code: ',


GetElqContentPersonalizationValue('C_Zip_Postal'));
CreateRow('Business Phone: ', GetElqContentPersonalizationValue('C_BusPhone'));
CreateRow('Country: ', GetElqContentPersonalizationValue('C_Country'));
CreateRow('Company Info: ', GetElqContentPersonalizationValue(''));
CreateRow('Checkbox: ', GetElqContentPersonalizationValue('M_CompanyName'));
CreateRow('Industry: ', GetElqContentPersonalizationValue('M_Industry1'));
CreateRow('Revenue: ', GetElqContentPersonalizationValue('M_Revenue1'));
CreateRow('WebSite: ', GetElqContentPersonalizationValue('M_WebSite1'));
CreateRow('Date Created: ',
GetElqContentPersonalizationValue('M_DateCreated'));
}
Finally, we add the actual command to our queue that requests the contact info from the Eloqua servers. This is
where you will need to the Data Lookup key and value:
_elqQ.push(['elqDataLookup', escape('DataLookupKey'), 'DataLookupValue']);
DataLookupKey will be a GUID that looks similar to this: 434C5E6250C04FCBB0D4FC5413F9A40A
and the DataLookupValue (if required) will look something like this:
<C_EmailAddress>user@domain.com</C_EmailAddress>
The Eloqua application will give you both of these values.
Tying 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);

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

12 / 22

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('Company Info: ', GetElqContentPersonalizationValue(''));
CreateRow('Checkbox: ', GetElqContentPersonalizationValue('M_CompanyName'));
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@domain.com</C_EmailAddress>']);
</script>
</head>
<body>
<div id="contactinfo">
</div>
</body>
</html>

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

13 / 22

Flash Content Tracking


Tracking clicks in Flash content is easily achievable with the Eloqua asynchronous tracking scripts. The package
you receive from Eloqua should have a Flash sample in it to help you out. The method used in that sample is
outlined below:
Supposing you had a button in your flash content that you would like to track, in your click handler, you would add
the following code (replacing the parameter values with your own):
ActionScript 2:
on (release) {
// your button click handling code
elqTrackFlashClick('http://domain.com/content/FlashButton1', 'http://http://domain.com/content/referrer');
}
ActionScript 3:
import flash.external.ExternalInterface;
button_1.addEventListener(MouseEvent.CLICK, fl_MouseClickHandler);
function fl_MouseClickHandler(event:MouseEvent):void
{
// your button click handling code
ExternalInterface.call("elqTrackFlashClick('http://domain.com/content/FlashButton1',
'http://http://domain.com/content/referrer')");
}
where 'button_1' is the name of your button.

On your page that hosts the flash object, add the elqTrackFlashClick javascript function in the head section
below the standard tracking scripts:
<script type='text/javascript'>
function elqTrackFlashClick(URL, referrer) {
_elqQ.push(['elqTrackPageView', URL, referrer]);
}
</script>
Putting it all together, your page hosting the flash content might look like this:
<html>
<head>
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', '<siteID>']);
_elqQ.push(['elqTrackPageView']);

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

14 / 22

(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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
function elqTrackFlashClick(URL, referrer) {
_elqQ.push(['elqTrackPageView', URL, referrer]);
}
</script>
</head>
<body>
<div id="flashContent">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="550"
height="400"
id="FlashExample" align="middle">
<param name="movie" value="FlashExample.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--[if !IE]>-->
<object type="application/x-shockwave-flash" data="FlashExample.swf"
width="550"
height="400">
<param name="movie" value="FlashExample.swf" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="play" value="true" />
<param name="loop" value="true" />
<param name="wmode" value="window" />
<param name="scale" value="showall" />
<param name="menu" value="true" />
<param name="devicefont" value="false" />
<param name="salign" value="" />
<param name="allowScriptAccess" value="sameDomain" />
<!--<![endif]-->
<a href="http://www.adobe.com/go/getflash">
<img

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

15 / 22

src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif"
alt="Get Adobe Flash player" />
</a>
<!--[if !IE]>-->
</object>
<!--<![endif]-->
</object>
</div>
</body>
</html>

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

16 / 22

Strict Mode Tracking


NOTE: The use of these scripts is only available if you have enabled Strict Mode Tracking by
contacting Eloqua Product Support. Please be certain that you have performed that step prior to
attempting to implement these scripts.

Eloqua's asynchronous tracking scripts allow you to implement Strict Mode Tracking. Eloqua's Strict Mode is a
set of tools that enables you to restrict visitor tracking according to laws enacted by European Union member
countries that have specified this requirement. Eloqua provides you with the following three levels for configuring
the tracking scripts:
1) Track all visitors;
2) Track all visitors except for those from countries on my Restricted Country List, unless those visitors have
opted into tracking (Require Opt-in for visitors by Country); or
3) Don't track any visitors unless those visitors have opted-into tracking (Require Opt-in for all Visitors).
It is your responsibility to determine which function you want to call from each of your web pages.
Note: If Strict Mode is enabled but you DO NOT select any countries for your Restricted Country List, Eloqua
WILL NOT TRACK any visitor to pages that call the Require Opt-in for visitors by Country function. In this
case we are assuming that you neglected to add countries to the list and have decided not to track anyone until
you add at least one country to the list. At that time, we will then only restrict tracking to those countries you've
added to the list. This also affects tracking redirect links in the same way (i.e. links from Emails and Landing
Pages).

Require opt-in for visitors by Country


The following allows you to track visitors from countries that are not on the Country by IP restriction list AND track
visitors from restricted countries that have opted into tracking:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', 'siteId']);
_elqQ.push(['elqTrackPageViewOptinByCountry']);
(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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
</script>
The following code does the same thing as the above snippet, except that it shows a simple default opt-in/out

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

17 / 22

banner at the top of the page to new visitors coming from restricted countries. For visitors who have opted-into
tracking, the banner will not be displayed and page view will be tracked:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', 'siteId']);
_elqQ.push(['elqTrackPageViewDisplayOptInBannerByCountry']);
(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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
function elqVisitorTrackingOptIn() {
_elqQ.push(['elqOptIn']);
}
function elqVisitorTrackingOptOut() {
_elqQ.push(['elqOptOut']);
}
</script>
The styling and text of the Opt-in banner can be customized.

Require opt-in for all Visitors


The following allows you to exclude all visitors from tracking unless they have explicitly opted into tracking:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', 'siteId']);
_elqQ.push(['elqTrackPageViewOptinAll']);
(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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

18 / 22

</script>
The following code does the same thing as the above snippet, except that it shows a simple default opt-in banner
at the top of the page to new visitors. For visitors who have opted-in to tracking, the banner will not be displayed
and page view will be tracked:
<script type="text/javascript">
var _elqQ = _elqQ || [];
_elqQ.push(['elqSetSiteId', 'siteId']);
_elqQ.push(['elqTrackPageViewDisplayOptInBannerForAll']);
(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.addEventListener) window.addEventListener('DOMContentLoaded',
async_load, false);
else if (window.attachEvent) window.attachEvent('onload', async_load);
})();
function elqVisitorTrackingOptIn() {
_elqQ.push(['elqOptIn']);
}
function elqVisitorTrackingOptOut() {
_elqQ.push(['elqOptOut']);
}
</script>
The styling and text of the Opt-in banner can be customized.

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

19 / 22

Customizing the Opt-in/out Banner


You can create your own banner rather than using the built-in default. For example:
<script type="text/javascript">
function elqCreateOptInBanner() {
if (navigator.appVersion.indexOf('MSIE') != -1) {
var css = '.elqOptInBanner {position: absolute; top: 0px; left: 0px; width:
100%; border:solid 1px #c0c0c0; background-color:#e1e1e1; font-size:11px; fontfamily:verdana; color:#000; padding:5px;} .elqOptInBannerText {float: left; textalign:left; width:96%;} .elqButton {font-size:11px; color:#000; padding:3px;} .elqClose
{float:right; font-size:14px; font-weight:bold; cursor:pointer; padding-right:15px;} ';
}
else {
var css = '.elqOptInBanner {position: fixed; top: 0px; left: 0px; width: 100%;
border:solid 1px #c0c0c0; background-color:#e1e1e1; font-size:11px; font-family:verdana;
color:#000; padding:5px;} .elqOptInBannerText {float: left; text-align:left; width:96%;}
.elqButton {font-size:11px; color:#000; padding:3px;} .elqClose {float:right; fontsize:14px; font-weight:bold; cursor:pointer; padding-right:15px;} ';
}
var style = document.createElement('STYLE');
style.type = 'text/css';
if (style.styleSheet) {
style.styleSheet.cssText = css;
} else {
style.appendChild(document.createTextNode(css));
}
var head = document.getElementsByTagName('head')[0];
head.appendChild(style);
var div = document.createElement('div');
div.setAttribute('id', 'elqOptInBannerDiv');
div.className = 'elqOptInBanner';
div.innerHTML = '<div class="elqOptInBannerText" >This website would like to use
cookies to store information on your computer which will help to customize your
interactions with us and provide you with a better browsing experience. You may delete and
block cookies from this site, but parts of the site may not function as a result. More
information about cookies and your choices can be found in our Privacy Policy. To accept
cookies from this site, please click the \'I Accept\' button below.&nbsp;&nbsp;&nbsp;<input
type="button" id="elqOptInButton" value="I Accept"
onClick="elqVisitorTrackingOptIn();document.getElementById(\'elqOptInBannerDiv\').style.dis
play = \'none\';" class="elqButton" />&nbsp;&nbsp;<input type="button" id="elqOptOutButton"
value="I Decline"
onClick="elqVisitorTrackingOptOut();document.getElementById(\'elqOptInBannerDiv\').style.di
splay = \'none\';" class="elqButton" /></div><div class="elqClose"
onclick="document.getElementById(\'elqOptInBannerDiv\').style.display =
\'none\';">x</div>';
document.body.appendChild(div);
}
</script>
NOTE: The function name cannot be changed. The tracking scripts code will call elqCreateOptInBanner.

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

20 / 22

Opting-In/Out
The Eloqua tracking scripts allow users to opt-out of tracking at the site level as well as globally for all domains.
See Samples\OptStatus.html for a sample which illustrates how to show the user their current tracking status, and
allow them to opt-out/in. Opting-out at the site level involves creating a new cookie called ELQOPTOUT and
setting a value to indicate that for this particular site, the visitor should not be tracked in the Eloqua system. The
user's GUID is not removed and so if they later choose to opt back in, they will resume tracking against the same
visitor record. Opting-out at the global level removes their GUID from the cookie and thus makes them invisible to
our servers. If they opt back in, they will get a new GUID and will be tracked as a new visitor.
Note: The opt-in / opt-outs for first- and third-party cookie tracking are independent of each other. For example, if
a site is using first-party cookie tracking and a site visitor has both a first-party cookie opt-in and a third-party
cookie opt-out, only the first-party cookie opt-in will be used and the visitor will be tracked. This is an edge case
that is relevant primarily when you are transitioning a domain from third-party to first-party cookie tracking as part
of the beta program and a single visitor has both a third- and a first-party cookie.
The following code snippet returns visitor opt-in status for first-party cookie tracking. It returns 1 if the visitor is
opted in and 0 if the visitor is opted out. If the visitor is neither opted in nor opted out, an empty string is
returned.
function elqGetOptInCookieValue() {
var name, index, cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
index = cookies[i].indexOf('=');
if (index > 0 && cookies[i].length > index + 1) {
name = cookies[i].substr(0, index).trim();
if (name == 'OPTIN') {
return cookies[i].substr(index + 1);
}
}
}
return '';
}

Copyright 2012-2014 Revision 2.4 Oracle Corporation. All Rights Reserved.

21 / 22

You might also like