Cloudflare + yandex metrika

I will write in Russian, since it is Russia specific question

После переклейки сайта на https через clouflare перестал считать посетителей счетчик яндекс-метрики. Судя по всему, он видит всех, кто пришел от Cloudflare как одного посетителя. т.к. ip, видимо, один.

Погуглил, но не нашел решения проблемы. Прошу подсказать, как решить проблему со счетчиком. Где-то видел советы, как передавать IP посетителей от Clouflare серверу, - это поможет решить проблему?

Если кто сталкивался с такой проблемой, поделитесь пошаговым руководством, пожалуйста

Depending on how good the translator is… I think you want this:

https://support.cloudflare.com/hc/en-us/sections/200805497-Restoring-Visitor-IPs

Not a Russian specific problem though.

I translated my request into English, but it was blocked by Akismet and still is not checked by moderators.
I am at virtual hosting with nginx. What should I request my hosting provider to do to fix the problem?

And yes, I see in logs IP-s similar to Cloudflare’s networks https://www.cloudflare.com/ips/ and they are “counted” by yandex metrika.

Please see the guide I posted a link to earlier.

1 Like

The issue is not solved yet!
I asked my provider, they have LiteSpeed Server. For this server here it is advised https://support.cloudflare.com/hc/en-us/articles/200170676-How-do-I-restore-original-visitor-IP-with-a-LiteSpeed-server-
to

  1. Go to your LiteSpeed Web Admin Console,
  2. Enable the option Use Client IP in Header in Configuration.

My provider says that
“Use Client IP in Header” option in LiteSpeed configuration is On.
We don’t know how Cloudflare treats the headers.
you need to address Cloudflare.

What else should be checked with my provider?

And one thing more. I guess that even server logs will indicate actual visitors’ IP, this will not solve the Yandex Metrika Counter issue. The counter gets information from the pages, not from the server logs.
I found this advise https://support.cloudflare.com/hc/en-us/articles/200170876-I-can-t-install-mod-Cloudflare-and-there-s-no-plugin-to-restore-original-visitor-IP-What-should-I-do-

and inserted in my template (between header abd body tags) the code

<?php if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) 
$_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
?>

Counter now shows more visitors, but still about 2-3 times less comparing to Cloudinary Analytics.
Metrika itsels shows the real visitor location, so it somehow gets the info about actual IP. But numbers it shows are incorrect. Cloudflare shows 3-4k visitors per day, Yandex counter - 400-500 (before switching to Cloudflare it showed about 700)

Yandex says that the difference could be because of robots. Can robot visits be 3 time more than real visitors numbers?

Where in Cloudflare I can see how much are robots in the total traffic statistics?

This topic was automatically closed after 31 days. New replies are no longer allowed.