You can currently enter one GTM container ID per site.
If you are using WPML, I assume that both domains have the same site structure and logic, therefore you might want to setup your tracking the same way on both sites, only account/property IDs might differ.
I would go with one container for both domains and use a Lookup Table variable in GTM to let GTM choose the proper GA4 measurement ID based on the Page Hostname variable.
Hi Thomas,
Thank you very much for your reply. It used to work with the code below for the German version of the site. But somehow, after I updated the plugin this doesn’t work anymore (looks like GTM script is loaded twice).
<?php if( ICL_LANGUAGE_CODE=='de' ) : ?>
<!-- Google Tag Manager Germany -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXXXX');</script>
<!-- End Google Tag Manager Germany -->
If will only work if you turn off “Container code ON/OFF” option, in that case you are in charge to output the container code on each page.