Wrong sales statistics in Google Analytics

  • Posts: 73
  • Thank you received: 2
8 years 5 months ago #241071

-- 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.

Attachments:
Last edit: 8 years 5 months ago by mypetfly.

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
8 years 5 months ago #241082

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.

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 2
8 years 5 months ago #241225

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: 8 years 5 months ago by mypetfly.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 5 months ago #241238

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:

,
	"currency: "'.$currencyInfo->currency_code.'"
after the code:
"tax": "' . round($tax, 2) . '"
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.

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 2
8 years 5 months ago #241846

Seems all is fine after adding your code except tax value. Have a look at attachments.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 5 months ago #241875

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.

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 2
8 years 5 months ago #242616

Didn't help.

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 73
  • Thank you received: 2
8 years 5 months ago #242927

Any news on it?

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
8 years 4 months ago #243906

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,


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.076 seconds
Powered by Kunena Forum