Jump to content

Edit History

Filip Albert

Filip Albert


Remove colon because it was printed as an emoticon

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';

 

Filip Albert

Filip Albert

1 hour 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';

 

×
×
  • Create New...