How to Block Spam Referrers like darodar.com from Accessing Website?

前端 未结 14 2493
北海茫月
北海茫月 2020-11-22 16:22

I have several websites that get daily around 5% of visits from spam referrers. There is one strange things I noticed about this referrers: they show in Google Analytics, bu

14条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 17:17

    Blocking any bots at your web server level makes no sense - spammers are sending fake requests to Google Analytics web server. All they have to know is website domain name and Google Analytics ID linked to it. So you have to mask your Google Analytics ID at website code. For example, you can do like this at Google Analytics JS code:

    ga('create', 'UA-X' + 'XXXXX' + 'XX-X', 'auto');
    

    Spammer's bot should be able to execute JS code to parse your Google Analytics ID after this change (and not so many bots will be able to do it).

    https://nobodyonsecurity.com/security/fighting-google-analytics-referrer-spam

提交回复
热议问题