Bug: HikaShop GA 4 Plugin fires "view_cart" on every page view

  • Posts: 19
  • Thank you received: 3
6 months 4 weeks ago #355459

-- HikaShop version -- : 4.7.5
-- Joomla version -- : 4.3.4
-- PHP version -- : 8.0.27

Hi,

we're setting up a new Joomla 4 website with the latest version of Hikashop + Hikashop Google Analytics 4 plugin (v. 1.1.1)

I have noticed that, when the user is logged in and has something in their cart, the "view_cart" event is fired on every page load. This skews our analytics data by overreporting cart views.

The expected behavior is to see the view_cart event only when the user actually views their cart, i.e. goes to the cart display page, or goes to a page where a cart module is rendered.

Upon inspecting the plugin code it seems that is indeed only checking whether the cart is empty in order to fire this event or not, and not checking for the current page/module rendering.

Is there something I'm missing or is this a bug? If bug, is there a workaround you can suggest?

Thank you

Last edit: 6 months 4 weeks ago by pvukovic.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 months 4 weeks ago #355476

Hi,

You're not missing anything, and it's not a bug.
We decided to make it like that as it's not really easy to know whether the cart module is displayed on the current page or not, and we didn't know of any downside of over reporting cart views. In what way is that a problem for you ?
If there is a real need, we could look into it to see if there is a way to do it.

Last edit: 6 months 4 weeks ago by nicolas.

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

  • Posts: 19
  • Thank you received: 3
6 months 4 weeks ago #355511

We are creating a funnel report in Google analytics that shows the conversion rate across checkout steps:

For example:

1. Visit Website (100% users)
2. Add Item (20% users)
3. View Cart (10% users)
4. Begin Checkout (5% users)
5. Purchase (1% users)

The problem is that it appears as if all users who added an item (step 2) also completed step 3, which is incorrect.

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 months 4 weeks ago #355529

Hi,

Thanks for your feedback. I've made a new version of the plugin with an extra option for this and support for Joomla 5.

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

  • Posts: 19
  • Thank you received: 3
6 months 3 weeks ago #355574

Thank you,

just tried to install it but I'm getting an error:

Undefined constant "HIKASHOP_J50"
in /home/ws_website/public_html/plugins/system/hikashop_ga4/hikashop_ga4.php:49

Screenshot:
prnt.sc/Q0ZDmtuvYiTg

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 months 3 weeks ago #355583

Hi,

Thank you for your feedback. I've made a patch for it. Please update the plugin and try again.

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

  • Posts: 19
  • Thank you received: 3
6 months 3 weeks ago #355600

Hi,

thanks for reacting so quickly.

The installation went fine this time, but the checkout page is showing a warning message when the system is in debug mode:

Warning: Attempt to read property "id" on null in /home/ws_website/public_html/plugins/system/hikashop_ga4/hikashop_ga4.php on line 793

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

  • Posts: 81540
  • Thank you received: 13071
  • MODERATOR
6 months 3 weeks ago #355604

Hi,

Thank you for your feedback. I've made a patch for it. Please update the plugin and try again.

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

  • Posts: 19
  • Thank you received: 3
6 months 3 weeks ago #355642

Thanks, the warning is gone.

The following user(s) said Thank You: nicolas

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

Time to create page: 0.071 seconds
Powered by Kunena Forum