Basic page view tracking with first-party cookies

Important: As a result of the Chrome 85 Release, Oracle Eloqua tracking will only capture the domain name and not the full path of the URL that was visited (unless your web team already has an explicit referrer policy in place on your website that allows the full URL to be shared) for any visitors who access your website via Chrome 85. See this product notice to learn more about recommended actions and FAQ.

Note: To enable first-party cookie support, please log in to My Oracle Support and create a service request. Review this knowledge base article for more information on what to include in your request.

When you visit a website where Oracle Eloqua asynchronous tracking scripts deployed, cookies are placed in your browser. Cookies help websites remember information about your visit and help personalize your next visit.

In a first-party cookie implementation, the domain of the cookie placed in the browser is the same as the domain being visited. For example, if you visit example.com and the domain of the cookie placed on your computer is example.com, then this is a first-party cookie. If the domain of the cookie is different than example.com, this is a third-party cookie.

Implementing tracking using first-party cookies may allow you to track visitors more successfully than using third-party cookies.

  • They are blocked less often.
  • Many anti-spyware applications and privacy settings do not target first-party cookies.

Good to know

  • First-party cookies cannot be shared across domains. So it is not possible to use a first-party cookie to track a single visitor’s digital body language across multiple domains owned by your organization.
  • Work with your IT team to ensure your tracking domain has a CNAME record pointing towards Oracle Eloqua in the following syntax: s[SiteID].hs.eloqua.com.
  • Strict mode tracking using first-party cookies is supported, but strict mode opt-in preferences cannot be set using the form processing step Web Tracking - Opt-in/Opt-out.

Code sample: Implementing first-party cookies

The following code sample illustrates how to implement first-party cookies.

<script type="text/javascript">
    var _elqQ = _elqQ || [];
    _elqQ.push(['elqSetSiteId', 'siteId']);
    _elqQ.push(['elqUseFirstPartyCookie', '<tracking.example.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>

When implementing the code sample, note the following:

  • Replace <tracking.example.com> with your first-party cookie domain in your configuration.
  • Replace siteID with the numeric code assigned to your Oracle Eloqua instance. Learn more about obtaining your company's site ID.
  • example.com should have the same root domain on which your webpages are hosted.
  • _elqQ is a queue of commands to push to Oracle Eloqua servers. After the scripts have been loaded into the DOM, the commands are queued up and executed in order.
  • The script 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 strict mode, _elqQ must be defined before it is used.

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

Learn more

Basic page view tracking with third-party cookies

Oracle Eloqua asynchronous tracking scripts

Strict mode tracking