Jump to content

Visitors online not working Prestashop 1.7.4.4


Recommended Posts

Hello,

My visitors online is not working (Showing 0 all the time)

I do the following:

1. Install Analyics plugin (I see visitors in Analytics)

2. The Data Mining stats module is installed and 'Save page views for each customer' is enabled.

3. Try to reset the stats modules.

I don't no what the problem is here.

Anyone help?

Thanks!

Link to comment
Share on other sites

On 11/19/2018 at 2:43 PM, yaloe2017 said:

Very strange problem

I have no .js errors in my Google console

A fresh install is not working :(

I did manage to get visitor online working by clicking 'upgrade' on stats modules.  However the pages not found which I think is super important does not work and is a known issue on github.  

Link to comment
Share on other sites

Hi, I made rookie mistake by not checking 'positions' of the stats modules.  I noticed for example pages not found was not hooked properly.  I reset it and  it works now.  Earlier I mentioned that I selected 'upgrade' on visitors online module then it also started working.

Please reset visitors online module and it should start working for you.

 

Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...

I have the same issue with 1.7.1.1

The module was working properly. After installing a couple of other modules (NT Backup and Restore and Cash on Delivery with fees), is has stopped working.

Now even if I disable those module, the online visitor count is always 0.

Any idea?

Thank you

 

Link to comment
Share on other sites

Uhmmmm, I'm already using the Google Analytics code the way you suggested. I think this is not the cause.
 

My problem is: the counter was properly working till some days ago and now it's not working anymore.

Link to comment
Share on other sites

The module is enabled.

I've found a solution on another post, which basically consists in moving the Visitors Online module to the "Footer" hook.

I didn't had time to test it, but I think this is the right solution, as there's probably some conflict between the Analytics Code and the Visitors Online module.

Bye

 

 

Link to comment
Share on other sites

  • 1 month later...
On 5/22/2019 at 11:04 AM, gosrl said:

The module is enabled.

I've found a solution on another post, which basically consists in moving the Visitors Online module to the "Footer" hook.

I didn't had time to test it, but I think this is the right solution, as there's probably some conflict between the Analytics Code and the Visitors Online module.

Bye

 

 

How do you move it?

In Positions > Transplant there is no option to move to Footer hook.

Any ideas?

P.S 1.7.4.4 here

Link to comment
Share on other sites

  • 3 months later...
On 11/25/2018 at 4:37 PM, El Patron said:

Please reset visitors online module and it should start working for you.

 

Hello,

Where can I find visitors online module?

In my BO dashboard when I click on Online Visitors it redirects me to the Stats page but there is an error Module not found.

I want to install the module, but I cannot find it. I have the installation PS1.7.5.0 zip file but there is not statsvisitorsonline or dashvisitorsonline or anything like that. What is the exact name of the module?

Link to comment
Share on other sites

  • 5 months later...

I don't know if will help someone, but if you reached this thread because your "Visitors online" shows a number but when you open the admin stats it doesn't show anyone there, like this:

statslive_error.png.5bcb3589bbcf63750293af33ba50723c.png

Then you're problably with a wrong server time locale definition. I run PS on an EC2 instance and it started just right after an module update (which afterall has nothing to do with the problem), so I got a little time to solve it.

In my case, I set my locale again to Sao_Paulo with:

 sudo ln -sf /usr/share/zoneinfo/America/Sao_Paulo /etc/localtime

After that I rebooted the EC2 instance and voila.

Seems like a "EC2" update changed it back to default for some reason.

Hope it helps!
Best regards.

image.png

Link to comment
Share on other sites

  • 6 months later...

I had the same issue In PrestaShop 1.7.6.4. The reason was that the module lost it's original position on the HOOK.

The solution is to reset the module "Source Data for Statistics" to it's original settings or manually add the position of this module to the HOOK displayBeforeBodyClosingTag. See below for details. 

How to add module "Source Data for Statistics" to correct hook: 

1. reset the module: "Source Data for Statistics" on Menu >> Modules >> Module "Source Data for Statistics" settings >> Reset

image.thumb.png.9d8c717cf5f8da764f0d0126ed7874b4.png

 

2. Check that the Hook is associated correctly in Menu >> Design >> Module Positions  to the hook displayBeforeBodyClosingTag

image.thumb.png.b44c3b9129f4435268cee482a0e7dc3e.png

 

3. statistics should start working for non-maintenance IP addresses  

image.thumb.png.cf69c1e0eafd52cc186ee0465ad77f86.png

 

 

 

Hope this helps. 

Best Regards, Martin Mi

Dataquo, s.r.o. 

www.dataquo.eu

 

 

Link to comment
Share on other sites

  • 2 months later...

Hi,

This can come from a problem with IPv6 on the server.

Check you do not have an IPv6 in your maintenance ip exclusion list (Configure > Shop parameters > General > Maintenance > Maintenance IP)
An IPv4 is 4 numbers separated by a dot like : 78.193.135.55
An IPv6 is a hexadecimal string with numbers and letters separated by a colon like : 2001:41d0:2:2c88::
IPv6 is the "new" internet protocol but there are still some old servers not fully compatibles with it.

If you have the Nt Backup And Restore module installed :
The Nt Backup And Restore module has an option to automatically start a backup daily just by enabling it (still a standard cron is available).
Like a webcron, this is the 2N server which remotely start the backup.
To make it run even in maintenance mode, the module add the 2N server IP (v4 and v6) in the maintenance exclusion list.
You can manage it in the Automation menu of the module > Advanced > Automation by 2n-tech.com IP authorization
Choose "Authorize only IPv4" (or "Authorize neither IPv4 nor IPv6" to disable it completely).

Best regards,

Damien

2N Technologies

 

Edited by Lalaru (see edit history)
Link to comment
Share on other sites

  • 6 months later...
On 11/7/2020 at 9:01 PM, Martin Mi said:

I had the same issue In PrestaShop 1.7.6.4. The reason was that the module lost it's original position on the HOOK.

The solution is to reset the module "Source Data for Statistics" to it's original settings or manually add the position of this module to the HOOK displayBeforeBodyClosingTag. See below for details. 

How to add module "Source Data for Statistics" to correct hook: 

1. reset the module: "Source Data for Statistics" on Menu >> Modules >> Module "Source Data for Statistics" settings >> Reset

image.thumb.png.9d8c717cf5f8da764f0d0126ed7874b4.png

 

2. Check that the Hook is associated correctly in Menu >> Design >> Module Positions  to the hook displayBeforeBodyClosingTag

image.thumb.png.b44c3b9129f4435268cee482a0e7dc3e.png

 

3. statistics should start working for non-maintenance IP addresses  

image.thumb.png.cf69c1e0eafd52cc186ee0465ad77f86.png

 

 

 

Hope this helps. 

Best Regards, Martin Mi

Dataquo, s.r.o. 

www.dataquo.eu

 

 

Simply rehooking the "Data mining for statistics" module to "displayBeforeBodyClosingTag" worked like a charm for me. Thanks!

Link to comment
Share on other sites

  • 1 year later...

Hello,

I dissuade the subject a bit but I have the same problem of online visitors.

If I reset the statistics module. It will reset everything and my dashboard will show all statistics to zero or it will reconfigure only the module and I will recover my order data etc?

Link to comment
Share on other sites

  • 4 months later...
On 1/21/2021 at 9:53 AM, Lalaru said:

Hi,

This can come from a problem with IPv6 on the server.

Check you do not have an IPv6 in your maintenance ip exclusion list (Configure > Shop parameters > General > Maintenance > Maintenance IP)
An IPv4 is 4 numbers separated by a dot like : 78.193.135.55
An IPv6 is a hexadecimal string with numbers and letters separated by a colon like : 2001:41d0:2:2c88::
IPv6 is the "new" internet protocol but there are still some old servers not fully compatibles with it.

If you have the Nt Backup And Restore module installed :
The Nt Backup And Restore module has an option to automatically start a backup daily just by enabling it (still a standard cron is available).
Like a webcron, this is the 2N server which remotely start the backup.
To make it run even in maintenance mode, the module add the 2N server IP (v4 and v6) in the maintenance exclusion list.
You can manage it in the Automation menu of the module > Advanced > Automation by 2n-tech.com IP authorization
Choose "Authorize only IPv4" (or "Authorize neither IPv4 nor IPv6" to disable it completely).

Best regards,

Damien

2N Technologies

 

Its'work for me,

i remove all the IP in maintenance, i let maintenance OFF

the dashboard activity come back !

thank you

Link to comment
Share on other sites

The issue in our case was indeed the IPv6 problem mentioned above. However, the actual bug was in the dashactivity module, specifically in the dashactivity.php file on line 152. The bug was fixed 5 months ago, but the module has not had a new stable version released since. See the link below.

https://github.com/PrestaShop/dashactivity/blob/f752eb9051e2046ffcf853f0f2baff2fad8fa0e5/dashactivity.php#L152C32-L152C143

$maintenance_ips = implode(',', array_filter(array_map('ip2long', array_map('trim', explode(',', $maintenance_ips))), '\strlen'));

 

Link to comment
Share on other sites

We've just installed a live chat module and it flags whenever there is a visitor on the site.

Chat module: 5 visitors on site.

Google Analytics: 10 visitors on site.

Prestashop: 126 visitors on site.

Even if we average it out over the "in the last 30 minutes" it doesn't match any other source of information.

There's nothing you can really do with this statistic anyway, apart from assess usage, but if it's wrong (and it clearly is) that makes it completely worthless as a data point.

Link to comment
Share on other sites

2 hours ago, RobbieBlokeToys said:

We've just installed a live chat module and it flags whenever there is a visitor on the site.

Chat module: 5 visitors on site.

Google Analytics: 10 visitors on site.

Prestashop: 126 visitors on site.

Even if we average it out over the "in the last 30 minutes" it doesn't match any other source of information.

There's nothing you can really do with this statistic anyway, apart from assess usage, but if it's wrong (and it clearly is) that makes it completely worthless as a data point.

I encountered the same issue with the PrestaShop online visitors. The problem is that PrestaShop displays the number of connections. However, it appears that every page view is counted as a connection. So, I modified the code slightly to count only unique IP address connections, and then I was able to see a number for PrestaShop online visitors that was similar to the one from Google Analytics for the past 30 minutes.

On line 169 (see the link bellow), I altered the MySQL query as follows (add GROUP BY c.ip_address)

https://github.com/PrestaShop/dashactivity/blob/f752eb9051e2046ffcf853f0f2baff2fad8fa0e5/dashactivity.php#L176C15-L176C15

$sql = 'SELECT c.id_guest, c.ip_address, c.date_add, c.http_referer, "-" as page
	FROM `' . _DB_PREFIX_ . 'connections` c
	INNER JOIN `' . _DB_PREFIX_ . 'guest` g ON c.id_guest = g.id_guest
    WHERE (g.id_customer IS NULL OR g.id_customer = 0)
        ' . Shop::addSqlRestriction(false, 'c') . '
        AND (\'' . pSQL(date('Y-m-d H:i:00', time() - 60 * (int) Configuration::get('DASHACTIVITY_VISITOR_ONLINE'))) . '\' < c.`date_add`)
    ' . ($maintenance_ips ? 'AND c.ip_address NOT IN (' . preg_replace('/[^,0-9]/', '', $maintenance_ips) . ')' : '') . '
    GROUP BY c.ip_address
    ORDER BY c.date_add DESC';

 

Edited by Filip Albert
Remove colon because it was printed as an emoticon (see edit history)
Link to comment
Share on other sites

On 11/3/2023 at 1:18 PM, Filip Albert said:

The problem is that PrestaShop displays the number of connections. However, it appears that every page view is counted as a connection. So, I modified the code slightly to count only unique IP address connections, and then I was able to see a number for PrestaShop online visitors that was similar to the one from Google Analytics for the past 30 minutes.

I figured it was being very generous in assessing online visitors, but it's disappointing they haven't rectified this over the many iterations of PS.

We're currently enjoying a free trial of a live chat bot and I think we're going to go with the paid version. This shows us who is online and allows us to communicate with them in real time. I was skeptical, but we have actually seen a good increase in sales because of it. It's already paid for itself.

I would recommend those who can try a live chat solution. That allows you to actually make use of online data.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...