Learn business growth with Google Analytics 4 Forums Google Analytics 4 What is the optimal method for monitoring data in Google Analytics 4 on a subdomain hosted on a separate server?

  • What is the optimal method for monitoring data in Google Analytics 4 on a subdomain hosted on a separate server?

    Posted by Arjun on 19 March 2023 at 6:59 pm

    Hey there,

    Let me break this down for you. We’ve got two sites here:

    1. website.com – This one is set-up with Server 1, has GTM tracking and is using Shopify.
    2. another.website.com – Based on Server 2, currently not tracking scripts and is powered by WordPress.

    Now, I’m wondering about the best strategy for data tracking via Google Analytics 4 in this context?

    I am thinking, should I pop the Google Tag Manager ID (from GA4) into “another.website.com” – Server 2 using this little tool I found called GTM4WP? I’m guessing that GA4 can take over from there?

    Or do you think there are more complex settings I need to fiddle with?

    Thanks a ton,


    Grayson replied 10 months, 2 weeks ago 3 Members · 2 Replies
  • 2 Replies
  • Noah

    22 April 2023 at 8:51 pm

    Hi Greg,

    Your plan sounds pretty solid! If both sites share the same top level domain, it’s as simple as publishing the same GTM container on your WordPress site as you have on your Shopify site. Then Google Analytics 4 should take care of the rest assuming the tags are triggered as expected.

    For different top level domains, you’d need to set up what’s called cross-domain tracking. It might sound complex but it’s a simple enough process in GA4. In your GA4 property, go to ‘Admin’, then ‘Data Streams’ and ‘Web’. From there, you head to ‘Configure tag settings’ and ‘Configure your domain’. You’ll need to modify the conditions under ‘Include domains that match ANY of the following conditions’ to enable cross-domain tracking. Once you’re done, hit ‘Save’. Here’s a [link](https://support.google.com/analytics/answer/10071811?hl=en) which explains it in more detail.

    Hope this helps!

  • Grayson

    4 June 2023 at 11:35 pm

    Hi Greg,

    Yes, you’re on the right track. In order to track data on “another.website.com” using Google Analytics 4, you’ll need to implement the Google Tag Manager ID from GA4 into the site. The tool you’ve found, GTM4WP, could indeed be useful for this purpose as it’s designed to facilitate the integration of GTM with WordPress. This should enable GA4 to begin collecting and analyzing data from Server 2.

    However, you might need to consider cross-domain tracking if you wish to track a user’s journey across both sites as a single session. Also, do remember to check whether ecommerce tracking (if required) is properly set up, especially since your first site is on Shopify. Additionally, you may also wish to verify that any filters you’ve constructed are appropriately configured in GA4.

    So while the initial setup might be relatively straightforward, there may be some additional considerations depending on your specific needs and objectives. Always make sure to thoroughly test your setup to ensure that tracking is working as intended.

Log in to reply.