title: Within Google Tag Manager, is there a JavaScript function for getting a user's Client ID?
body: <p>I am attempting to write a function that will be used in a custom Javascript Variable in Google Tag Manager (GTM). What I have currently is the below:  </p>
  
  <pre><code>function getClientID()
  {        // Modify customDimensionIndex to match the index number you want to send the data to\n  
          var customDimensionIndex = 7;
          return function(model) 
      {
           model.set('dimension' + customDimensionIndex, model.get('clientId'));}
      } 
  </code></pre>
  
  <p>It should get the client ID, and set the index of a Google Analytics custom dimension (as 7 in this case) to it. 
  This is not returning a client ID on the page however. In GTM preview mode, there is a SessionID and SitecoreUserID, as follows:</p>
  
  <pre><code>user:
  { sitecoreID: '00000000-0000-0000-0000-000000000000',
    ...
  },
  session:
  { id: 'aa2aaaaqaaaaaaaaaaa25eee'}    
  </code></pre>
  
  <p>I suppose I could user the sitecoreID as the client ID and send that to Google Analytics. But I was wondering if there would usually be another Client ID on a page, and if so, how to get it?</p>
  
  <p>Thanks in advance. </p>