ibericode / koko-analytics

Privacy-friendly, open-source and lightweight analytics for your WordPress site.
https://www.kokoanalytics.com/
GNU General Public License v3.0
371 stars 30 forks source link

Bingpreview Bot to exclude #133

Closed rrdd closed 2 years ago

rrdd commented 2 years ago

Please exclude Bots like Bingpreview, that reneders js also and creates fake request. Maybe its best to exclude "preview" similar to crawler or spider.

Is there a way to add excluded agents manually with add_filter in functions.php similar to referers?

dannyvankooten commented 2 years ago

Hey @rrdd,

Is there a way to add excluded agents manually with add_filter in functions.php similar to referers?

Not yet, as the current filtering is happening client-side.

Do you have a sample User Agent of the Bingpreview bot? It should already be catched by this line in assets/src/script.js.

    if ((/bot|crawler|spider|crawling|seo|chrome-lighthouse/i).test(navigator.userAgent)) {
rrdd commented 2 years ago

@dannyvankooten BOT: "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/534+ (KHTML, like Gecko) BingPreview/1.0b"

not filtered. There are many other useless preview bots. Thats why adding preview in the regex is best.