google analytics – How to send data to multiple tracking ID’s using gtag.js?

I have a website that is present in multiple countries.

It’s a single page app, and the country-specific information and translation is handled by the domain. My code detects if it’s on a es domain and user sees the Spanish website, the domain sees the British website, and so on.

I’m mentioning this because I have a single index.html file.

I want to log analytics data for different countries into different analytics measurement IDs.

I’ve found this piece of doc on how to do it:

Analytics doc

enter image description here

So my plan is:

I’ll set two different properties under the same analytics account.

Property 1 will be responsible for the es Spanish website and property 2 will be responsible for the uk website.

  • Property1 ID: UA-11111111
  • Property2 ID: UA-22222222

From the image above, it seems that I’ll have to do the following:

<script async src="">
  window.dataLayer = window.dataLayer || ();
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());

  gtag('config', 'UA-11111111');  // MY CODE WILL ONLY CALL THIS ON THE .ES DOMAIN
  gtag('config', 'UA-22222222');  // MY CODE WILL ONLY CALL THIS ON THE .UK DOMAIN

But which one should I put on the <script async/> tag? Does it matter which one?

<script async src="">


<script async src="">