You need to show ads if necessary, and not hide ads if they do not fit, otherwise you are likely to violate the AdSense terms, for example. hiding ads after they appear. At the very least, wait until the ads show until you check the referrer (conditions may also be violated, but much less likely). Also review the terms of your advertising service to ensure that the use of technology on the client side, such as javascript, to dynamically display ads does not contradict the conditions.
To answer your question, simply identify the HTTP Referrer (the field is actually called the HTTP "Referer", which is an error) and insert advertisements if it is not from websites that you "like." For API / examples, you can google for http referrer your_language . For example, in PHP it is $_SERVER['HTTP_REFERER'] . In python, this depends on the web structure you are using. As someone mentions in javascript, this is document.referrer , etc. Javascript is the easiest solution, but read the terms again.
ninjagecko
source share