
If you are experiencing issues with your session count, it is most likely due to bots visiting your site and consuming your session quota.
If-So offers two options to help identify and block bots — we recommend using both.
The “Block Bots” mode allows you to automatically prevent Search Engine Crawlers, CURL Requests, and other bots from accessing the geolocation service.
When the “Block Bots” mode is enabled, bots will be able to access your site as usual, but they will be blocked from accessing the geolocation service. Instead, they will be served with the default content version (or “fallback” in case you are using the Geolocation DKI shortcodes).
To enable the “Block Bots” mode, follow these steps:
The “Bots Block” mode identifies bots by searching for commonly used terms in the User-Agent header. The following terms, if present in the User-Agent, will trigger a block:
Please note that while the “Bot Blocking” mode is designed to capture the majority of bot traffic, it may not completely block all bots. Keep in mind that the User-Agent can be easily manipulated, which can potentially bypass the block.
Enabling the
If necessary, you can utilize the “Log geolocation requests” option to manually identify IP addresses that consume your session quota excessively. By logging these requests, you can keep track of suspicious activity and take measures to manually block those IPs as needed.
While the “Bot Blocking” mode captures most bot traffic, it may not block all bots completely. If you notice a high volume of bot activity, we recommend enabling the Log geolocation requests option in addition.
The Log geolocation requests feature creates a log of all geolocation requests, including the visitor’s IP address and a timestamp of each request.
Once sessions are logged, If-So can analyze the data and pinpoint the IPs of bots that are causing the issue and block them from the geolocation service (They will still be able to visit the site, but the geolocation service will not be available for them). You can then review these IPs and decide whether to block them from accessing the geolocation service.
*Please note that enabling the geolocation log file may slow down the loading speed of pages with a geolocation condition. It is recommended to disable the log file after collecting the necessary information.
add_filter('ifso_exclude_from_geo',function($exclude){ $exclude['ip'] = ['XX.XX.XXX.XXX','YY.YYY.YYY.YYY']; return $exclude; });


To exclude a specific IP from being blocked by the “Bots Block” mode, you can whitelist the IP address by adding the following shortcode at the end of your functions.php file:
add_filter('ifso_geo_whitelist',function($allow){
$allow['ip'] = ['X.XX.XX.XXX','Y.YY.YY.YYY'];
return $allow;
});
Please ensure to replace ‘X.X.X.X‘ and ‘Y.Y.Y.Y‘ with the respective IP addresses you wish to whitelist.
If you’re seeing a high volume of bot visits from sources like Facebook, Google, or other user agents, and these visits originate from various IPs, you can block them by their user agents instead of manually specifying each IP address.
To block these bots using their user agents, you can implement the following code:
add_filter('ifso_block_bots_extra_blocked_user_agents', function($uas) {
$uas[] = 'Google';
$uas[] = 'Facebook';
$uas[] = 'SOMETHING ELSE';
return $uas;
});
Keep in mind, this means that when the Google crawler visits your site, it will crawl the default content (not the geo-targeted version).
We're sorry couldn’t be more helpful ☹️