- Posts: 73
- Thank you received: 2
Wrong sales statistics in Google Analytics
10 years 4 months ago - 10 years 4 months ago #241071
by mypetfly
Wrong sales statistics in Google Analytics was created by mypetfly
-- HikaShop version -- : 2.6.1
-- Joomla version -- : 3.5
-- PHP version -- : 5.3.29
Hello, I have enabled HikaShop Google Analytics plugin, but I see wrong statistics in GA.
See attached examples.
I understand that Orders page in Hikashop doesn't include shipping. Let me choose one of the orders and show detailed view. Let's choose order number 138. I attached screenshot for this order. As you can see from screenshot - user paid 184.4 AUD. But I see 319.5 AUD for this order in GA.
I also attached my plugin confuguration.
-- Joomla version -- : 3.5
-- PHP version -- : 5.3.29
Hello, I have enabled HikaShop Google Analytics plugin, but I see wrong statistics in GA.
See attached examples.
I understand that Orders page in Hikashop doesn't include shipping. Let me choose one of the orders and show detailed view. Let's choose order number 138. I attached screenshot for this order. As you can see from screenshot - user paid 184.4 AUD. But I see 319.5 AUD for this order in GA.
I also attached my plugin confuguration.
Last edit: 10 years 4 months ago by mypetfly.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #241082
by Xavier
Replied by Xavier on topic Wrong sales statistics in Google Analytics
Hi,
What is your Shop currency ? US Dollar or CAD Dollar ?
It seems that the difference is the conversion rate, on you shop the currency seems to be US dollar and the google analytics account is set in CAD Dollar. That could explain that difference.
What is your Shop currency ? US Dollar or CAD Dollar ?
It seems that the difference is the conversion rate, on you shop the currency seems to be US dollar and the google analytics account is set in CAD Dollar. That could explain that difference.
Please Log in or Create an account to join the conversation.
10 years 3 months ago - 10 years 3 months ago #241225
by mypetfly
Replied by mypetfly on topic Wrong sales statistics in Google Analytics
I am using AUD anywhere, but I don't really think that problem is in the currency. For example - see order 136. GA showing almost twice bigger price than hikashop orders page. But have a look at order 131 - GA showing price that is less than in Hikashop orders page. Such things cannot be explained by currency differences.
Last edit: 10 years 3 months ago by mypetfly.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #241238
by nicolas
Replied by nicolas on topic Wrong sales statistics in Google Analytics
Hi,
I don't see why it would do that.
The GA plugin uses the order_full_price variable of the order, which contains the total amount of the order. And that's what is also used on your backend listing.
One thing I noticed while checking the code of the plugin is that the currency of the order is not sent to GA (it shouldn't matter normally and it's not mandatory), but mainly that could help.
Try to add the code:
after the code:
in the file plugins/system/hikashopanalytics/hikashopanalytics.php
and that will add the currency of the order to the request sent to GA. That's all I got.
I don't see why it would do that.
The GA plugin uses the order_full_price variable of the order, which contains the total amount of the order. And that's what is also used on your backend listing.
One thing I noticed while checking the code of the plugin is that the currency of the order is not sent to GA (it shouldn't matter normally and it's not mandatory), but mainly that could help.
Try to add the code:
Code:
,
"currency: "'.$currencyInfo->currency_code.'"
Code:
"tax": "' . round($tax, 2) . '"
and that will add the currency of the order to the request sent to GA. That's all I got.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #241846
by mypetfly
Replied by mypetfly on topic Wrong sales statistics in Google Analytics
Seems all is fine after adding your code except tax value. Have a look at attachments.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #241875
by nicolas
Replied by nicolas on topic Wrong sales statistics in Google Analytics
Hi,
Try changing the line:
$tax = $order->order_subtotal_no_vat + $order->order_shipping_tax + $order->order_discount_tax;
to:
$tax = ($order->order_subtotal - $order->order_subtotal_no_vat) + $order->order_shipping_tax + $order->order_discount_tax + $order->order_payment_tax;
in the same file.
Try changing the line:
$tax = $order->order_subtotal_no_vat + $order->order_shipping_tax + $order->order_discount_tax;
to:
$tax = ($order->order_subtotal - $order->order_subtotal_no_vat) + $order->order_shipping_tax + $order->order_discount_tax + $order->order_payment_tax;
in the same file.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242616
by mypetfly
Replied by mypetfly on topic Wrong sales statistics in Google Analytics
Didn't help.
Please Log in or Create an account to join the conversation.
10 years 3 months ago #242927
by mypetfly
Replied by mypetfly on topic Wrong sales statistics in Google Analytics
Any news on it?
Please Log in or Create an account to join the conversation.
10 years 3 months ago #243906
by Jerome
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Replied by Jerome on topic Wrong sales statistics in Google Analytics
Hi,
Cf : developers.google.com/analytics/devguide...nalyticsjs/ecommerce
Your order have 10% taxes.
Total : 18.05 (16.41 + 1.64)
So we can see how the different parts are composed (with a little approximation due to some rouding).
Subtotal: $12.00 (10.90 + 1.1)
Shipping: $6.05 (5.5 + 0.55)
The 11.46 you have in Google Analytics reports can be processed like that :
12 + 1.1 - 1.64 = 11.46
Which does not have any logical sense.
What you can do is activate the "debug" mode in the Google Analytics plugin so you will have some trace in the HikaShop payment log for the calls made to the analytics plateform.
There you will be able to see what content has been processed for the tax.
Regards,
Cf : developers.google.com/analytics/devguide...nalyticsjs/ecommerce
Your order have 10% taxes.
Total : 18.05 (16.41 + 1.64)
So we can see how the different parts are composed (with a little approximation due to some rouding).
Subtotal: $12.00 (10.90 + 1.1)
Shipping: $6.05 (5.5 + 0.55)
The 11.46 you have in Google Analytics reports can be processed like that :
12 + 1.1 - 1.64 = 11.46
Which does not have any logical sense.
What you can do is activate the "debug" mode in the Google Analytics plugin so you will have some trace in the HikaShop payment log for the calls made to the analytics plateform.
There you will be able to see what content has been processed for the tax.
Regards,
Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
Please Log in or Create an account to join the conversation.
Time to create page: 0.222 seconds