0

I am using ipstack to receive some geo details from my visitors. The free version allows 10.000 requests per month and according to them I have reached 75% of those already. I have never ever had 7.500 hits this month. I have about 500 hits on this site each and every month.

I do have the following code in my functions.php working correctly.

if ( !is_admin() ) {
    $ip = $_SERVER['REMOTE_ADDR'];
    $ch = curl_init('http://api.ipstack.com/'.$ip.'?access_key='.ipstack);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    $json = curl_exec($ch);
    curl_close($ch);
    $api_result = json_decode($json, true);
    define ( 'lng', strtolower($api_result['country_code']) );        
}

I have disabled wp-cron.php in the wp-config.php using define('DISABLE_WP_CRON', true); and run the cronjob every 15 minutes.

So, where do all those requests come from? Any ideas?

1 Answer 1

0

Your access logs will show all requests (traffic) to your site, including those that resulted in 404s.

I suspect that your 404 page is not calling your function, so the request is not tracked.

You should be able to get your access log from your hosting place, via the cPanel (assuming you are not self-hosted). But most of those requests, I'd suspect, are not valid visitors.

You could also change your function to provide more info from the CURL request. See this page on the curl_getinfo function: https://www.php.net/manual/en/function.curl-getinfo.php .

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.