A referral website is an Internet address or hostname used to get a visitor to another site. A visitor has clicked a hyperlink on the referral website, which leads to the website where he is located now. The referral website is thus the source for the traffic on the current page. When a website is viewed, the visitor’s browser transmits the name of the requested website and also the origin of the referral link that directed the visitor to it. Referral websites are important data in web analysis in order to assign traffic to the different sources and to find out where the visitors of a website came from. The terms referrer, referrals or referral traffic are also common in addition to referral website.
Each time a Web site is accessed, the client and server communicate with each other and transmit various information that is recorded in the log files. This includes, for example, the IP address, search terms, and software used to access the site. However, these log files also list the referral site if the request was made from another website. If a user clicks a link that directs to website B from website A, the web server of B notes the Internet address of A in its log files. The provision of the referrer information is not permitted only in exceptional cases, for example, if the browser does not save such data because of security settings, or if the request has been made directly in the URL line of the browser or via a bookmark.
The analysis of web sites and traffic in general, pose various problems from a web analysis viewpoint. On the one hand, the referral website is not always transmitted and, on the other hand, the traffic can come from sources which are not human users (spam, bots, and payment services). In addition, there are often several referrals and it is not always clear which of them triggered a purchase or a conversion. The first referrer is generally considered a trigger, since it made the user aware of another website. This is why the goal of analysis software is to capture the right referral website to allow an evaluation by webmasters and site operators. However, it may be necessary to make adjustments to the reporting software in order to distinguish between traffic sources.
Typically, web analytics tools associate a conversion to the website that was viewed last. If the user concludes a purchase in an online shop, the webserver of the shop specifies the website which last referred the user to the online shop as the referrer. However, user surfing and buying behavior is not always linear and they may view shops several times before making a purchase and the shop’s server may receive incorrect or no data under these circumstances. This problem is solved by web analytics tools, for example, by including multiple site visits as part of the statistics and marking or excluding certain referral sites as such. Tools such as Google Analytics can quite reliably distinguish natural traffic from spam, bots, and payment services when appropriate settings are made (Manage> Report Settings> Filter Bots). However, if the reports are affected too strongly by referral traffic, different approaches are possible to correct them.
paypal\.com|spamsite\.com|.*spamsubdomain\.com. The pipe (|) is used to distinguish the domains and the slash prevents points from being regarded as regular expressions. No pipe should be used at the end of a regular expression, otherwise all referrals will be excluded. 
order allow,deny allow from all deny from 22.214.171.124. Any further IP address or hostname is then attached with the command deny from below. The server will subsequently block the corresponding IPs and hostnames, and the analysis software can no longer capture these referrals.
There are other options, which are only mentioned here briefly: exclusion via PHP, NGINX as well as visitor control in Google Tag Manager and, last but not least, the channel groupings in Google Analytics. Each approach has advantages and disadvantages and should be adapted to the requirements of the website (e.g. online shops, e-commerce or other website types) and their web analysis tool or server settings.
The cleanup of reports in Google Analytics is recommended by many experts, but is only appropriate in certain cases. It is of great importance especially in e-commerce to be able to record initial referral websites and to exclude unwanted referrals such as spam or bots. The reason is that these referrals can affect the sales data in the reports. Referral traffic may be viewed as responsible for certain sales, if it is not excluded. Correspondingly, the representations and the assignment to the sources from which this traffic originated are shifted. Websites that are supposed to generate monetary values are therefore dependent on the fact that these values can be assigned correctly. Otherwise, the reports are not accurate and incorrect decisions may result.
Another reason for excluding referrals may also be that spam-like methods are used to guide webmasters to websites that use the links for marketing tactics. This black-hat method cannot be prevented, but the impact on your own website and report creation can be prevented.