PrestaShop / ganalytics

Gain clear insights into important metrics about your customers, using Google Analytics in PrestaShop 1.6.
11 stars 43 forks source link

About the bug in google analytics version 2.3.4: #104

Open joeszeto opened 8 years ago

joeszeto commented 8 years ago

Please follow it for the future version too

About the bug in google analytics version 2.3.4:

Problem 1 (fixed): Payment error wrongly send to the google analytics as a successful case.

Modules: modules/ganalytics/ganalytics.php

Situation:

Payment error should not send to the google analytics, since it has a checking code when buyers click the “pay” in payment side. After the checking, the data which insert to the database table “ps_ganalytics” will send to google analytics. And the first time checking, payment error can be correctly rejected to insert to the database table “ps_ganalytics”

Problem:

In some special case, payment error also insert to the database table “ps_ganalytics”. It leads google analytics show the wrong information.

For example, I have a payment error record in 10:00am and this record is correctly showed in the admin url > orders > orders. This record does not insert to the database table “ps_ganalytics”, everything is still fine.

However, once our employees who view the record in the admin url > orders > orders, and click the “View” for more details in this payment error at 5:00pm.

The module of ganalytics will be double checked the record to send to google analytics or not, if not, module will send again.

Line716: if ($this->context->controller->controller_name == 'AdminOrders') { if (Tools::getValue('id_order')) { $order = new Order((int)Tools::getValue('id_order')); if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time()) { $ga_order_sent = Db::getInstance()->getValue('SELECT id_order FROM '._DB_PREFIX_.'ganalytics WHERE id_order = '.(int)Tools::getValue('id_order'));

As you see, the red font is line716. Here will not check the record which is payment error or not. Then this error record will insert to the database table “ps_ganalytics” and the time is 5:00pm.

Finally, it means that if our employees check the reason of payment in admin url, this record will also be sent to google analytics as a successful case.

Solution:

Edit the line 716 to check payment error:

if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time() && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR')) {

Problem 2 (not fixed): Some of payment record missing by double orders references.

Situation: Since some product are special cases, they are limited in some regions. For the shipping of these products, they have specialized shipping method.

However, some buyers may buy more than one products which include special products and normal products. It will become a two shipping for this payment.

For this case, prestashop will combine two shipping cost as one order. For the admin url > orders > orders, this payment record will become two different orders but same order reference.

For the modules of ganalytics.php, it will only insert one order reference record and ignore another one to the database table “ps_ganalytics”.

In the end, google analytics will miss some payment record.

sweetyandlatina commented 8 years ago

????? ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Sent: Thursday, November 03, 2016 4:23 AM Subject: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

Please follow it for the future version too

About the bug in google analytics version 2.3.4:

Problem 1 (fixed): Payment error wrongly send to the google analytics as a successful case.

Modules: modules/ganalytics/ganalytics.php

Situation:

Payment error should not send to the google analytics, since it has a checking code when buyers click the “pay” in payment side. After the checking, the data which insert to the database table “ps_ganalytics” will send to google analytics. And the first time checking, payment error can be correctly rejected to insert to the database table “ps_ganalytics”

Problem:

In some special case, payment error also insert to the database table “ps_ganalytics”. It leads google analytics show the wrong information.

For example, I have a payment error record in 10:00am and this record is correctly showed in the admin url > orders > orders. This record does not insert to the database table “ps_ganalytics”, everything is still fine.

However, once our employees who view the record in the admin url > orders > orders, and click the “View” for more details in this payment error at 5:00pm.

The module of ganalytics will be double checked the record to send to google analytics or not, if not, module will send again.

Line716: if ($this->context->controller->controller_name == 'AdminOrders') { if (Tools::getValue('id_order')) { $order = new Order((int)Tools::getValue('id_order')); if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time()) { $ga_order_sent = Db::getInstance()->getValue('SELECT id_order FROM '._DBPREFIX.'ganalytics WHERE id_order = '.(int)Tools::getValue('id_order'));

As you see, the red font is line716. Here will not check the record which is payment error or not. Then this error record will insert to the database table “ps_ganalytics” and the time is 5:00pm.

Finally, it means that if our employees check the reason of payment in admin url, this record will also be sent to google analytics as a successful case.

Solution:

Edit the line 716 to check payment error:

if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time() && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR')) {

Problem 2 (not fixed): Some of payment record missing by double orders references.

Situation: Since some product are special cases, they are limited in some regions. For the shipping of these products, they have specialized shipping method.

However, some buyers may buy more than one products which include special products and normal products. It will become a two shipping for this payment.

For this case, prestashop will combine two shipping cost as one order. For the admin url > orders > orders, this payment record will become two different orders but same order reference.

For the modules of ganalytics.php, it will only insert one order reference record and ignore another one to the database table “ps_ganalytics”.

In the end, google analytics will miss some payment record.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

joeszeto commented 8 years ago

The bug found in ganalytics. I need you to update it for future version....or this bug will appear again.

sweetyandlatina commented 8 years ago

I would like to explain to me how to do it since I'm not an expert. Thank you ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Thursday, November 03, 2016 8:38 AM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

The bug found in ganalytics. I need you to update it for future version....or this bug will appear again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

joeszeto commented 8 years ago

Modules: modules/ganalytics/ganalytics.php

Edit the line 716 to check payment error:

if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time() && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR')) {

sweetyandlatina commented 8 years ago

I mean, I am not developed or programmer, so I is not easy to fix this. To accomplish this, I have to use the filezilla and look for a folder in specific? or where I come in to make the change, if it came to cheer. Thank you ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Thursday, November 03, 2016 10:13 AM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

Modules: modules/ganalytics/ganalytics.php

Edit the line 716 to check payment error:

if (Validate::isLoadedObject($order) && strtotime('+1 day', strtotime($order->date_add)) > time() && $order->getCurrentState() != (int)Configuration::get('PS_OS_ERROR')) {

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

joeszeto commented 8 years ago

I reported this bug to the developer of ganalytics from prestashop addon. and He told me to send this problem here. And now, who is the developer of ganalytics???

sweetyandlatina commented 8 years ago

I have no idea of this. Not what I have to do, only I have a prestashop store that charge alone, I register in google tools and in some cases complete settings because not as done. If you want to know something, clearer or question an easy way for you to understand you because they are not bug or anything that you write me. ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Thursday, November 03, 2016 11:48 AM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

I reported this bug to the developer of ganalytics from prestashop addon. and He told me to send this problem here. And now, who is the developer of ganalytics???

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

joeszeto commented 8 years ago

First of all, payment error send to the google analytics as successful case, this is not a bug? Then, all I want that if this Ganalytics module update the version, i dont need to fix this problem again.

sweetyandlatina commented 8 years ago

I think already, I went to gAnalytics module and update, if that, and this ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Thursday, November 03, 2016 12:55 PM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

First of all, payment error send to the google analytics as successful case, this is not a bug? Then, all I want that if this Ganalytics module update the version, i dont need to fix this problem again.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

joeszeto commented 8 years ago

sweetyandlatina

Are you the developer of gAnalytics module?

sweetyandlatina commented 8 years ago

What do you mean a developer. I told you in a previous post, I have only one store and set following the steps indicated google. Not if I did well or if it works properly. ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Friday, November 04, 2016 4:12 AM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

sweetyandlatina

Are you the developer of gAnalytics module?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

joeszeto commented 7 years ago

Well, All my problem is, I found a bug, and I fixed it. But if this module update, will this bug appear again? or do you have any solution?

sweetyandlatina commented 7 years ago

Thanks for solving, the truth is that I have no solution because I do not understand what to do, I am not an expert and as I told you in my last mail, I only have one store to sell my products that, maybe, does not work full since I do not know If I have missed doing something. Yesterday I updated the new version, I hope I have not done something that has complicated your arrangement. ----- Original Message ----- From: joeszeto To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Friday, November 11, 2016 4:11 AM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

Well, All my problem is, I found a bug, and I fixed it. But if this module update, will this bug appear again? or do you have any solution?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

Adel-Magebinary commented 7 years ago

does this problem still exists?

sweetyandlatina commented 7 years ago

??? ----- Original Message ----- From: Adel Abula To: PrestaShop/ganalytics Cc: sweetyandlatina ; Comment Sent: Saturday, July 22, 2017 2:50 AM Subject: Re: [PrestaShop/ganalytics] About the bug in google analytics version 2.3.4: (#104)

does this problem still exists?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

   Libre de virus. www.avg.com