How to
Apr 23, 2024

Integrating Eloqua with Celero using Google Tag Manager (GTM)

Do you want to add the Eloqua (Marketing automation) tracking script to your Microsite through Google Tag Manager?

Integrating Eloqua with Celero using Google Tag Manager (GTM)

If you want to add the Eloqua (Marketing automation) tracking script to your Microsite through Google Tag Manager?

The first step is to make sure you have your Google Tag manager deployed on your microsites. Please chat with us if you don't yet.

If you simply place the out-of-the-box Eloqua code in GTM, it will not work! You will have to make a slight tweak to your Eloqua tag, and GTM will dpeloy it correctly.

Here’s how to make your Eloqua script compatible with Google Tag Manager:

1. Get your Eloqua tracking script. It should look something like this (Your code should have a numerical value in place of ‘xxxxxxxxx’).


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

2. Edit the code as follows: Replace the last two lines (if and else if statements, bolded above) with a single call to the async_load() function.

In the original script, these two lines determine when the Eloqua tracker fires. However, it is listening for an event (DOMContentLoaded or onload) which has potentially occurred before GTM fires the tag. Instead, we can remove this listener and use a DOM Ready firing rule (see Step 4), allowing GTM to control when the Eloqua tracker fires.


<script type="text/javascript">    
     var _elqQ = _elqQ || [];
    _elqQ.push(['elqSetSiteId', 'XXXXXXXXX']);
    _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);
        }
    
        async_load(); //modification for GTM compatibility
     })();

</script>

3. Place the revised code in a new Custom HTML tag in your GTM container.

4. Set the tag to fire when the DOM is loaded by creating a new trigger.

Create a new trigger and select the Trigger Type as Page View – DOM Ready.

5. Save your changes, create a new container version, and publish!

John Carter
John Carter
CEO & Co-founder
Follow us on: