Simplifying GA4 Setup in GTM for Main Domain and Subdomains

Setting up Google Analytics 4 (GA4) can seem like a daunting task, especially when you have multiple domains and subdomains to track. Fortunately, you can use Google Tag Manager (GTM) to make this process easier and more efficient. In this article, we’ll outline a simple method to setup GA4 via GTM for your main domain and subdomains using just one GTM tag and one GTM variable.


  1. Open Properties for Main Domain and Subdomains:

    The first step is to open two or more properties in GA4 for your main domain and subdomains. This will give you measurement IDs for each of them (go to Data Stream and you will find it).

    create property for ga4

  2. Create a Lookup Table Variable:

    In GTM, create a lookup table variable and add a row for each subdomain. In the input field, fill in the hostname (e.g.,,, etc.). In the output field, fill in the corresponding measurement IDs.

    gtm lookup table variable

  3. Configure GA4 Tag in GTM:

    In the tags section of GTM, create a new GA4 Configuration tag. Choose the variable you created in step 2 as the measurement ID and select “All Pages” as the trigger.

    gtm ga4 configuration tag


Setting up GA4 for multiple domains and subdomains doesn’t have to be complicated. By using a lookup table variable in GTM, you can simplify the process and track all your domains and subdomains with just one tag. Follow these simple steps, and you’ll be well on your way to tracking your website’s analytics with ease.

Armen Adamyan
Rate author
PPC mania
Add a comment