Eloqua Blog

How to add Eloqua Tracking to Google Tag Manager in 60 seconds

If your web team lives inside Google Tag Manager, you can still get clean Eloqua web tracking. You just need one small script change and a bit of discipline so your data, scoring and attribution stay reliable.

This guide shows you exactly what breaks when you paste Eloqua tracking into GTM unmodified, the one-line fix that makes it work every time and the test steps to confirm your data is clean.

⏱ Rough time: 5 minutes 👨‍💻 Audience: Eloqua admins and web teams
Computer screen showing browser developer tools and tracking scripts.

Where Eloqua web tracking meets Google Tag Manager

One of the very first things clients ask for when they start working with Eloqua is web tracking. They want to see which pages their contacts visit, which content gets the most attention and how this links back to campaigns, scoring and revenue.

Eloqua solves this with Asynchronous Web Tracking. It is a lightweight script that sits on your site and sends page view data back to Eloqua. When that data is correct you get better lead scoring, stronger intent signals and far more intelligent nurture. When it is wrong you get gaps, ghost traffic and reporting that never quite lines up with reality.

For those of you who want the official detail, here is the Oracle documentation on asynchronous tracking: Eloqua Asynchronous Visitor Tracking Scripts .

Eloqua gives you a standard script and tells you to paste it into the head of every page you want to track. That is fine until your web team says:

“We manage everything through Google Tag Manager. Can you just give us a tag for Eloqua tracking?”

The usual answer from an Eloqua admin is: “Sure, here is the script.” The web team drops it into GTM as a Custom HTML tag, publishes and assumes all is well.

This is where things quietly break.

If you paste the Eloqua script into Google Tag Manager without a small change, it often does not fire correctly. GTM wraps your code in its own sandbox and some of the event handling inside the stock Eloqua script no longer behaves as expected. Rather than go into every technical detail, I will give you the practical fix and then show you how to test it.

Step 1. Download your Eloqua tracking script

First, get the official Eloqua tracking script from your instance:

  1. In Eloqua, go to Assets > Website Setup > Tracking.
  2. Click on Generate Visitors Tracking Scripts.
  3. On the next screen, click Generate in the bottom right corner.

Eloqua will email you a zip file containing the tracking script. When you receive it, make sure you unzip the file properly. Do not just open the archive viewer and drag the text file onto your desktop. Occasionally this creates odd encoding issues that can lead to unexpected errors later.

Step 2. Modify the Eloqua script for Google Tag Manager

Open the tracking script file in a plain text editor (Notepad, VS Code, Sublime, any HTML editor you like). You will see something that looks like this:

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

The last two lines are the problem inside GTM. They try to attach Eloqua to the page load events directly. Inside Google Tag Manager this is redundant and sometimes blocked.

Replace the last two lines with a single direct call to async_load():

<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(); // modified for Google Tag Manager
    })();
</script>

All we are doing is telling the script to load itself immediately when the tag fires, instead of waiting for DOM events. Google Tag Manager is already controlling the timing for us, so this makes the behaviour predictable and stable.

Save this modified script. This is now your GTM friendly Eloqua tracking script.

Step 3. Add the script to Google Tag Manager

Now pass this modified script to your web team or add it yourself to Google Tag Manager:

  1. Create a new tag in your GTM container: Tag type: Custom HTML.
  2. Paste in the full modified script, including the <script> tags.
  3. Set the trigger to something like DOM Ready - All Pages or your equivalent page view trigger.
  4. Save the tag and enable GTM Preview mode to test.

You now have Eloqua Asynchronous Tracking running under GTM control. There is one final piece that most teams skip: verifying that it is actually sending the right data.

Step 4. Test that Eloqua tracking is working

Before you declare victory, confirm the script is firing and that Eloqua is receiving page views.

In the browser

  • Enable Preview mode in Google Tag Manager and load a page that should be tracked.
  • Check that your Eloqua tracking tag fires on the expected trigger.
  • Open your browser developer tools and look at the Network tab. You should see calls to Eloqua assets such as elqCfg.min.js and a request to the Eloqua tracking endpoint.

In Eloqua

  • Use Profiler or a test contact that you have cookied with Eloqua.
  • Browse the site and then refresh the profile to check that new page views appear.
  • For anonymous traffic, check Webpage Activity or relevant dashboards after a short delay.

If you can see the script firing in GTM, network requests going out and page views landing in Eloqua, you are done.

Why this small detail really matters

It is very easy to treat tracking as “just a script” and move on. In Eloqua, tracking underpins a lot of the things you care about:

  • Lead scoring that responds to high intent behaviour on key pages.
  • Nurture programs that adapt based on visited content.
  • Attribution reporting that connects journeys to revenue.
  • Sales intelligence where sales see which content a named contact is reading.

If tracking is only partially firing because the script is not GTM friendly, you end up with contacts that look less engaged than they really are, and campaigns that appear to underperform. The work to fix this is measured in minutes. The improvement in confidence and decision making is much bigger.

A few governance rules I recommend

  • One Eloqua tracking script per page. If you run multiple GTM containers or legacy hard coded scripts, make sure there is no duplication.
  • Correct Site ID per brand or region. Do not re use the same Eloqua Site ID across unrelated properties unless that is a deliberate design choice.
  • Managed via GTM only. Once GTM controls Eloqua tracking, remove older hard coded snippets to avoid confusion.
  • Document it. Capture the final script, GTM tag name, triggers and test steps in your Eloqua run book so the next admin does not have to rediscover it.

Frequently asked questions

Why does the standard Eloqua script not just work in GTM? +
The stock script expects to run directly in the page and wires itself to page load events. Google Tag Manager wraps your code and handles events on your behalf. That extra layer can mean the original event binding never executes. Calling async_load() directly removes that dependency.
Can I use this approach on multiple websites? +
Yes, as long as they are supposed to report into the same Eloqua instance with the same Site ID. If you manage very different brands or regions with separate Eloqua instances, keep separate tags with the correct Site IDs, and control which domains each tag fires on inside GTM.
Do I still need to change anything in my Eloqua campaigns? +
No changes are required to existing campaigns. This is a tracking foundation layer. Once it is working, your lead scoring, nurture programs and reporting simply become more reliable because they are fed by better web behaviour data.

Need help stabilising your Eloqua tracking and reporting?

I work with teams who rely on Eloqua for serious pipeline and cannot afford broken data. If you want someone who can talk to both your web team and your marketing ops crew, let us talk.