Eloqua Asynchronous Visitor Tracking Scripts

27 

Full text

(1)

Eloqua Asynchronous Visitor

Tracking Scripts

User Guide

(2)

Contents

1 Eloqua asynchronous tracking scripts 3

2 Basic page view tracking with third-party cookies 5

2.1 Basic page view tracking with first-party cookies 5

2.1.1 Retrieving the visitor GUID using a first-party cookie 7

2.2 Tracking to multiple Eloqua instances using JavaScript 7

2.3 Tracking custom URLs and referrers using JavaScript 8

3 Secure site tracking with first-party cookies 10

4 Using tracking pixels to track page visits 11

5 Outbound link tracking 12

6 Reposting externally hosted forms 13

7 Using data lookups 14

8 Flash content tracking 18

9 Strict Mode Tracking 21

9.1 Require opt-in for visitors by country 21

9.2 Require opt-in for all visitors 23

10 Customizing the Opt-in/out banner 25

(3)

1 Eloqua asynchronous tracking scripts

The Eloqua asynchronous tracking scripts allow you to track visits to your website seamlessly without affecting the page load time for your visitors. They are supported and tested in all major browsers, including: Internet Explorer 6+ Firefox 1.5+ Opera 9+ Safari 3+ Chrome

In order to ensure the highest probability that Eloqua can track the page before the visitor leaves it, 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 specifies how the objects in a web page are represented, what attributes are associated with each object, and 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. For IE8 and below, the entire page must be loaded before requests to the Eloqua servers are made, they do not support the event that indicates that the DOM has been completely loaded.

Visitors are remembered based on a unique cookie value stored in their browser. When you visit a website with the Eloqua asynchronous tracking scripts deployed, cookies are placed in your browser. They help identify you as a website visitor according to your specific browser and computer

combination in the event that you return to this domain. Eloqua supports two types of cookie based tracking: third-party and first-party.

Third-party cookies

The difference between third-party cookies and first-party cookies lies in the owner of the cookie. For example, if you visited company.com, and you saw a cookie for eloqua.com on your browser, this is a third-party cookie because the cookie does not belong to the company.com domain.

Popularity of third-party cookies is declining because they are: Deleted regularly by users

Blocked by anti-spyware applications

(4)

First-party cookies

First-party cookies are less problematic to use as they are blocked less often. It is difficult to browse the internet without accepting first-party cookies as these cookies identify you as a returning user to the site and help personalize your browsing experience. This is useful for any website that requires you to login, remember a password and so on. As many anti-spyware applications and privacy settings do not target first-party cookies, implementing tracking based on first-party cookies on your website may allow you to track more visitors successfully.

Note: To enable first-party cookie support, please log in toMy Oracle Support (http://support.oracle.com) and create a service request.

(5)

2 Basic page view tracking with third-party cookies

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.

Note: The snippet above 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 look ups or opt-out pages, you must ensure

_elqQ

is defined before it is used.

2.1 Basic page view tracking with first-party cookies

Note: To enable first-party cookie support, please log in toMy Oracle Support (http://support.oracle.com) and create a service request.

For domains configured to support first-party cookies, it is possible to drop a first-party cookie on the visitor's browser. If an existing eloqua.com third-party cookie already exists, its GUID is used for the first-party cookie. This is helpful in scenarios where the third-party cookie has previously been used to

(6)

maintain the link between the visitor and the contact and keep all their digital body language in tact. If no third-party cookie exists, a first-party cookie with a unique GUID is dropped on the visitor's browser. Support for Strict Mode tracking using first-party cookies has been introduced with the following exception:

Script 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:

Eloqua-hosted Landing Pages. Branded and non-branded domains. Secure websites (accessed via HTTPS:).

tracking.mysite.com

should be the 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 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.

(7)

Note: The snippet above 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 look ups or opt-out pages, you must ensure

_elqQ

is defined before it is used.

2.1.1 Retrieving the visitor GUID using a first-party cookie

The following code snippet returns the visitor GUID:

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; 1 < subCookies.length; l++) { var subCookie = subCookies[l].split("="); if (subCookie.length == 2 && subCookie[0] == 'GUID') { return subCookie[1]; } } } } } return ''; }

2.2 Tracking to multiple Eloqua instances using JavaScript

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 || [];

(8)

_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 to track a second instance.

2.3 Tracking custom URLs and referrers using JavaScript

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 want 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 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;

(9)

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>

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>

(10)

3 Secure site tracking with first-party cookies

Note: To enable first-party cookie support, please log in toMy Oracle Support (http://support.oracle.com) and create a service request.

Additional configuration is required to deploy first-party cookies over secure sites. The tracking domain needs to be configured as asecure micrositein Eloqua that has an SSL certificate applied to it. If this tracking domain is used in the tracking scripts, when a first-party cookie is dropped, the browser will not display any warning messages regarding mixed content and successfully drop a first-party cookie.

Note: You may need to work with your organization's IT department in order to set up a tracking domain for first-party cookies to be enabled.  Please contact Oracle Eloqua Product Support for further information.

The following block of code will need to be added to your tracking scripts.

Substitute

tracking.mysite.com

with the first-party cookie tracking domain in

your configuration:

<script type="text/javascript"> var _elqQ = _elqQ || [];

_elqQ.push(['elqSetSiteId', '2610']); _elqQ.push(['elqTrackPageView']);

_elqQ.push(['elqUseFirstPartyCookie', 'tracking.mysite.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>

(11)

4 Using tracking pixels to track page visits

A tracking pixel is a 1x1-sized pixel image that can be embedded within your landing pages to track page visits. The tracking pixel image is an image tag that points to an endpoint on the Eloqua servers and accepts the ELQ parameter (unique recipient id). When the image is loaded, the endpoint records the page visit against the recipient ID (which can be resolved to a contact for reporting.) The HTML snippet looks similar to this:

<img style="display:none; border: 0" src="http://s

1

.t.eloqua.com/visitor/v200/svrGP?pps=3&siteid=

1&ref=http://google.com/" width="1" height="1" alt="">

(12)

5 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

(13)

6 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 browser, 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') { 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. Ensure to replace

EloquaFormName

with the actual name of your form as setup in Eloqua.

(14)

7 Using 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, and so on.

To accomplish a data lookup, you will need the following: 1. Create a new data lookup key from within Eloqua. 2. Add thebasic tracking scriptsto 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'));

(15)

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

}

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 insert the Data Lookup key and value:

_elqQ.push(['elqDataLookup', escape('DataLookupKey'),

'DataLookupValue']);

DataLookupKey will be a GUID that looks similar to this: 434C5E6250C04FCBB0D4FC5413F9A40A. 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. Trying it all together, we get the following:

<html> <head>

<script type="text/javascript"> var _elqQ = _elqQ || [];

(16)

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

(17)

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>

(18)

8 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 you want 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>

(19)

<script type="text/javascript"> var _elqQ = _elqQ || [];

_elqQ.push(['elqSetSiteId', '<siteID>']); _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);

})();

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" />

(20)

<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 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>

(21)

9 Strict Mode Tracking

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).

Note: Strict Mode Tracking must be enabled to use these scripts. Contact Eloqua Product Support for more information.

It is your responsibility to determine which function you want to call from each of your web pages.

Important: If Strict Mode is enabled but you do not select any countries for your Restricted Country List, Eloqua will not track any visitors 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).

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

(22)

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 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 views 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>

(23)

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

})(); </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 views 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);

(24)

load); })(); function elqVisitorTrackingOptIn() { _elqQ.push(['elqOptIn']); } function elqVisitorTrackingOptOut() { _elqQ.push(['elqOptOut']); } </script>

(25)

10 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; 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; 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; size: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.

(26)

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.display = \'none\';" class="elqButton" />

&nbsp;&nbsp;<input type="button" id="elqOptOutButton" value="I Decline"

onClick="elqVisitorTrackingOptOut();document.getElementById (\'elqOptInBannerDiv\').style.display

= \'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.

(27)

11 Opting-in and out

The Eloqua tracking scripts allow users to opt-out of tracking at the site level as well as globally for all domains. 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 ''; }

Figure

Updating...

Related subjects :