title: Multiple Google Analytics gtag tracking IDs on same page
body: <p>I have two property tracking IDs in my Google Analytics account for the same website. I basically want to have the same set of data inserted into both properties/views. Currently, this is how I have it set up on the site:</p>
  <pre><code>&lt;!-- Global site tag (gtag.js) - Google Analytics --&gt;
  &lt;script async src=&quot;https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'UA-XXXXXXXX-1');
    gtag('config', 'UA-XXXXXXXX-3');
  &lt;/script&gt;
  </code></pre>
  <p>However, I have come to realize this is not actually working correctly. I believe the proper solution to this is this (two sets of script tags, one for each property), but I am not 100% sure:</p>
  <pre><code>&lt;!-- Global site tag (gtag.js) 1 - Google Analytics --&gt;
  &lt;script async src=&quot;https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-1&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'UA-XXXXXXXX-1');
  &lt;/script&gt;
  
  &lt;!-- Global site tag (gtag.js) 2 - Google Analytics --&gt;
  &lt;script async src=&quot;https://www.googletagmanager.com/gtag/js?id=UA-XXXXXXXX-3&quot;&gt;&lt;/script&gt;
  &lt;script&gt;
    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('js', new Date());
  
    gtag('config', 'UA-XXXXXXXX-3');
  &lt;/script&gt;
  </code></pre>