title: How to display internal User ID instead of Client ID (ga cookie), in Google Analytics via GTM?
body: <p>I have surfaced my system's user id to display as a JS variable. I created a Custom Dimension to pull that user id, and connect it to the client id provided by Google.</p>
  
  <p>Here's the dimension's code... </p>
  
  <pre><code>function() {
    try {
      var tracker = ga.getAll()[0];
      return tracker.get('clientId');
    } catch(e) {
      console.log("Error fetching ID");
      return "Customer ID N/A";
    }
  } 
  </code></pre>
  
  <p>The variable that displays our User ID is <strong>ECID</strong>. I've tried every which way I can think of, but the only thing that works is what's above. I don't want the cookie id. I want to be able to display our internal User ID. </p>
  
  <p>Here's how the event fires... </p>
  
  <p><a href="https://i.stack.imgur.com/6NJHU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/6NJHU.png" alt="enter image description here"></a></p>
  
  <p>I have no idea what I'm doing wrong, but the goal is to have something like this (pulled from a YT video)...</p>
  
  <p><a href="https://i.stack.imgur.com/N9uvx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/N9uvx.png" alt="enter image description here"></a></p>