title: Google Analytics - Custom Value for "dl" Parameter
body: <p>I'm using Google Analytics (gtag version) on my site, and am trying to prevent actual urls from being sent to Google Analytics. Specifically, I see the <strong><code>dl</code></strong> parameter contains the url:</p>
  
  <p><a href="https://i.stack.imgur.com/n6jPR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/n6jPR.png" alt="enter image description here"></a></p>
  
  <p><strong>QUESTION:</strong> How can I customize the value of the <strong><code>dl</code></strong> parameter?</p>
  
  <p>My current setup is as follows (I'm testing locally, by the way). In the head, I've included the standard Google Analytics gtag code, with a few custom fields:</p>
  
  <pre><code>&lt;script async src="https://www.googletagmanager.com/gtag/js?id=&lt;TRACKING_ID&gt;"&gt;&lt;/script&gt;
  &lt;script&gt;
      window.dataLayer = window.dataLayer || [];
      function gtag() { dataLayer.push(arguments); }
      gtag('js', new Date());
      gtag('config', '&lt;TRACKING_ID&gt;', {
          'custom_map': {
              'metric1': 'time_to_interactive',
              'metric2': 'dom_content_loaded_in',
              'metric3': 'dom_completely_loaded',
              'dimension1': 'time_to_interactive',
              'dimension2': 'dom_content_loaded_in',
              'dimension3': 'dom_completely_loaded'
          }
      });
  &lt;/script&gt;
  </code></pre>
  
  <p>And then in a body load function, I have the following code:</p>
  
  <pre><code>window.gtag('event', 'load', {
      'event_category': 'CriticalRenderingPath',
      'event_label': document.title, //url,
      'time_to_interactive': millisToHumanFormat(interactive),
      'dom_content_loaded_in': millisToHumanFormat(dcl),
      'dom_completely_loaded': millisToHumanFormat(complete)
  });
  </code></pre>
  
  <p>Google Analytics developer documentation is pretty inconsistent and terrible, and I was not able to find a clear answer there. On the old system (ga.js), <a href="https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference#location" rel="nofollow noreferrer">according to this</a>, you can say:</p>
  
  <pre><code>ga('set', 'location', 'CUSTOM_VALUE_HERE');
  </code></pre>
  
  <p>But I have no idea how to do it using the new gtag version of Google Analytics. I've tried a similar thing - in fact I tried all of these:</p>
  
  <pre><code>gtag('set', {
    'pageview': 'TEST_PAGE',
    'dl': 'TEST_DL_PAGE',
    'location': 'TEST_LOCATION',
    'page': 'TEST_PAGE',
    'documentlocation': 'TEST_LOCATION',
    'documentLocation': 'TEST_LOCATION',
    'document-location': 'TEST_LOCATION',
    'document_location': 'TEST_LOCATION'
  });
  gtag('set', 'location', 'TEST_LOCATION');
  gtag('set', 'pageview', 'TEST_LOCATION');
  gtag('set', 'dl', 'TEST_LOCATION');
  gtag('set', 'page', 'TEST_LOCATION');
  gtag('set', 'documentlocation', 'TEST_LOCATION');
  gtag('set', 'documentLocation', 'TEST_LOCATION');
  gtag('set', 'document-location', 'TEST_LOCATION');
  gtag('set', 'document_location', 'TEST_LOCATION');
  </code></pre>
  
  <p>Nothing works.</p>