Google Analytics is one of the most powerful tools available to website owners. However, referral and direct traffic spam can completely throw off your numbers. Referral spam is usually easy to filter out; simply create a segment that filters out each referral source that looks like spam. However, by creating a Hostname filter, we can easily filter out direct spam as well.
- Navigate to Audience > Technology > Network.
- Once in Network, click on the Hostname tab to select Hostname as your primary dimension.
- Identify your legitimate Hostnames. These will typically be your domain name, your subdomains, and any translation services.
- Create a new custom segment, and name it “Hostname Filter”.
- Create a new condition. Filter sessions to include your legitimate Hostname. Create a condition for every legitimate Hostname. Save the segment.
- Check your direct traffic. It should be much lower, with the 0:00 second duration sessions removed. Check your referral traffic. Most of the spam should be removed here as well.
Using a Hostname filter, we can quickly remove most direct traffic spam from our Google Analytics account.