Scraping bots stuck in cookie_usage page

Open to all! Ask other shopowners for help.
Post Reply
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Scraping bots stuck in cookie_usage page

Post by Pierre_P »

Lately we are under a huge scraping bot attack all over the world.
The cookie_usage.php is doing fine but i do not want our server to allocate unnecessary resources to this bots.
I did modify my whos online page to show the bots name as well and legitimate bots are behaving correctly.

For the bad bots - can we create a basic text only page (no other resource loading)?
What could be the impact to doing this?


Join The Code Co-op to get access to your library in the Code Co-op Forum
BrockleyJohn
Certified Developer
Posts: 173
Joined: Mon Mar 01, 2021 5:37 pm
Phoenix Version:
Has thanked: 2 times
Been thanked: 30 times

Re: Scraping bots stuck in cookie_usage page

Post by BrockleyJohn »

Have you got buy buttons enabled in your product lists?

If you have bots that you've included in spiders.txt they won't have a session, so if they follow a link with action=buy_now they get redirected to cookie_usage.php

It would save site resources only to display buy buttons if there's a session established (as it's pointless otherwise). There'll be less crawl from all bots including legitimate ones.
You can do this by overriding product_card in your active template.

Afterthought: it will also focus your google crawl budget on more useful urls
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Scraping bots stuck in cookie_usage page

Post by Pierre_P »

@BrockleyJohn

I do not mind the rogue bots stuck in cookie_usage page, google, bing and so on listed in robots file is doing its job.

So then for product_card we can change to likely:

Code: Select all

<?php
    if (Session::is_started() && count($buttons) > 0) {
        ?>
        <div class="card-footer">
            <div class="d-flex justify-content-between"><?= implode(PHP_EOL, $buttons) ?></div>
        </div>
        <?php
    }
?>
Every scraper and bot adds queries the database, pull up images and what else adding server load.
Last week our our hosting company blocked all international traffic i guess server wide - i see it is still ongoing - this severely affected our google services for example.
I'm being frustrated with them(well known hosting company) started realizing there is a serious issue actually.
I found Force Cookie Use was set to false, changes this to true and now them bots is sent to cookie page.

This prompt me to start acting and be more stringent on how bots crawl our site.
The robots.txt is the updated version but we are getting pounded hard.

I also started blocking with htaccess several ip's in the millions range countries that will never buy from our store - china, Vietnam, Russia and few more.

So making changes to the product_card will help a bit but not relieve the complicated issue.

Next i guess will be a WAF approach or go cloudflare
User avatar
burt
Core Team
Posts: 4550
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Scraping bots stuck in cookie_usage page

Post by burt »

I am not here to build for you.
I am here to build with you. Let's help each other.
ArtcoInc
Contributor
Posts: 119
Joined: Fri Oct 25, 2019 4:19 pm
Phoenix Version: v1.0.3.0
Has thanked: 86 times
Been thanked: 17 times

Re: Scraping bots stuck in cookie_usage page

Post by ArtcoInc »

Pierre_P wrote: Wed Apr 29, 2026 8:22 am I did modify my whos online page to show the bots name as well and legitimate bots are behaving correctly.
Can you please share this mod?

Thanks!

M
User avatar
Pierre_P
Contributor
Posts: 144
Joined: Fri Mar 12, 2021 5:06 am
Phoenix Version: v1.1.0.6
Has thanked: 21 times
Been thanked: 11 times

Re: Scraping bots stuck in cookie_usage page

Post by Pierre_P »

@ArtcoInc
Pm sent


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply