How To Fix GA4 Showing Wrong Domain Traffic
Online Marketing Strategies

How To Fix GA4 Showing Wrong Domain Traffic.

2025-09-05 | 11 Print Friendly Version of this pagePrint Get a PDF version of this webpagePDF


How to Use Host Name Filter in Google Analytics 4: To Fix Wrong Direct Traffic.

At first glance of my GA4 dashboard, I was flabbergasted by the outrageous spike in my direct traffic! A minute later into my observation, I realized a domain name had suddenly appeared in my domain traffic. This was alarming because I actually hosted that website on my shared server, without placing any Google Analytics code on the website, so you see why I was baffled.

seo web analyst blogger community

All I can think about are methods to solve and how I can fix the current issue of only having GA4 track and record traffic to my domain name as my own, and not record traffic from another domain that has no GA4 code but is hosted on my shared server as my direct traffic. In this article, I will try my best to articulate all the processes and findings I sought to resolve this issue successfully.

Using The Different "HOSTNAME" Traffic Filter Steps.

The First step I took was to use the explorer button located on the GA4 panel to create another exploration. Follow the itemized steps as seen in the image below to execute this successfully.

seo web analyst blogger community

Click on the dimension table and select hostname, while for metrics, you select the event count under variables. Under the settings, you select the hostname under rows, then scroll down to where you have values, and select event count. For the filter, please select Hostname must contain and type your domain name in the form.

seo web analyst blogger community

You will notice from the image above that we have successfully filtered out a domain name that does not contain our domain name, and what that means in effect is that the previous domain (unwanted) will no longer be recorded. After this, you can click on reports, and in my own case, I was shown an option to start a new report with my new setup or continue to use my existing report. I chose the existing report (I really don't have the leisure of setting up new rules and sorting.

seo web analyst blogger community

To be more secure, I still went further under engagement, clicked on the page and screen tab, and clicked on the pencil icon on the page to edit. You will see a customized box on your right, click on dimension and select hostname, in the match type select contains, while in the value form you input your domain name. When done, you can save this new condition for that particular page report.

Now this is where things got really interesting, because choosing that option did not solve my issue, it only removed the page visit report of that unwanted domain from my page and screen: Page Title and Screen Class report. If one is to visit the URL, GA4 still picks traffic reading on Real-time pages from the unwated domain.

seo web analyst blogger community

 

My next option was to use Google Tag Manager to try and fix this, as the solution described above seems to be for separating page traffic and not on the level of fixing GA4, showing the wrong website domain traffic as mine.

I checked my Google Tag Manager settings linked to my Google Analytics from the Admin section. Under the property section, click on data stream in that window click on your domain. It should display the status of your Google Tag Manager. For me, my status was on red alert! With so many issues wrong with the tag manager data reading.

seo web analyst blogger community

If your page shows the same message as mine, don't be scared, I will walk you through how I resolved each aspect of this issue and how I finally fixed what I really wanted. First, I checked the managed domains, where I spotted the unwanted domain and removed it. Next, I checked the pages of mine that were not tagged (as mentioned by Google). Meanwhile, I utilize Google Tag Manager to handle my GA4 tracking codes and other codes, eg, Facebook pixel, LinkedIn, Adwords, etc. So, it is a must for me to resolve it, as part of my solution-finding for GA4, showing web traffic from sites that are hosted on my shared server. 

seo web analyst blogger community

To resolve all the issues, Google Tag Manager on my website was quite direct and simple. All I need to do is visit each affected URL via Tag Assistant, which is used to debug the URL to confirm that the TAG code is fired and works properly.

Another thing I thought of was cross-domain tracking. In my own case, this couldn't be the case; cross-domain tracking is primarily used to monitor user behavior across your own websites, and a misconfiguration can lead to inaccurate data or unexpected traffic sources. Make sure your cross-domain measurement is properly set up for each of your domains to ensure clean and reliable analytics. To do that, click on configure tag settings.

seo web analyst blogger community

On the next window, scroll down to configure your domains under settings, and click on that to show you the cross-domain window. From this window, I can see that the domain I want to remove is highlighted for me, and I removed it and accepted my main domain, and also included a "contains" condition

seo web analyst blogger community

With all these edits and fixes, the hostname traffic visit was still showing in my real-time page view on GA4; I guess it was because I was still using the current report template (but I still have one more solution to try). My next solution to try was RegEx Table, and to do this, I needed to go to my Google Tag Manager. I have seen this for those not using Google Tag Manager; you can find it on GA4, and implementation is quite similar.

Login to your Google Tag Manager account and perform the following;

Create a new variable

1. Name “My Hostname RegEx Table”
2. Variable Type – RegEx Table
3. Input Variable – Page Hostname
4. Pattern – your domain (for instance, www.yourdomain.com)
5. Output – your GA4-measurement Id (for instance, G-9MNJKLOI9)

6. After saving, go to the workspace and update your GTM container 

seo web analyst blogger community

 

Conclusion

My final thought on this experience was that I was able to achieve the result I wanted after I shut down my laptop to restart my browser could be cache or cookie results still showing from me visiting the unwanted domain name. All I can suggest is for you to actually go through these steps to also set up some page filter, hostname filter from websites you probably don't want to measure, and to separate other third-party pages from your traffic counts.

At the end of the day, I was able to get GA4 to stop showing real-time page results from the unwanted domain visit sharing the same host as my main domain. There are other steps I could take, like using robots.txt to restrict Google from indexing that domain on my server, but this might affect the unwanted domain if there might be a need to measure its traffic via its own GA4 code.

seo web analyst blogger community

Just follow the explanation above and resolve issues arising from your tag implementation so that you can get correct traffic data, and also check the Hostname Report: In GA4, navigate to your reports and locate the Hostname report. This view reveals which domain names are generating traffic to your property, helping you identify any unexpected sources or cross-domain activity.

Please share your experience with any of the solutions I have provided above to solve the type of issue that might be unique to your website traffic performance report on GA4 in the comment section below.

 

 


comments powered by Disqus

Ads

Author

authors image profile

Olatunji Adetunji

I am a seo web analyst and have a love for anything online marketing. Have been able to perform researches using the built up internet marketing tool; seo web analyst as a case study and will be using the web marketing tool (platform).

Tags

Subscribe RSS

Subscribe with Subscribe with facebook Subscribe with google Subscribe with linkedin Subscribe with TwitterSubscribe with Yahoo   

OR




This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

More Posts From Online Marketing Strategies

Social Boxes



Random Blogs




Freight Forwarder
AuctionCars
LicensedclearingAgent
carauctions
Dushyant Sharma
clearingagent