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

  • Posts: 19
  • Thank you received: 3
1 year 2 months 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: 1 year 2 months ago by pvukovic.

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
1 year 2 months 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: 1 year 2 months ago by nicolas.

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

  • Posts: 19
  • Thank you received: 3
1 year 2 months 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: 83022
  • Thank you received: 13403
  • MODERATOR
1 year 2 months 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
1 year 2 months 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: 83022
  • Thank you received: 13403
  • MODERATOR
1 year 2 months 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
1 year 2 months 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: 83022
  • Thank you received: 13403
  • MODERATOR
1 year 2 months 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
1 year 2 months 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.

  • Posts: 221
  • Thank you received: 6
  • Hikashop Business
2 weeks 5 days ago #364804

Hi , i enanbled Hikashop - Google Analytics 4
and got Call to a member function getCart() on null error while trying to open
checkout page/

How to fix ?

Call Stack
# Function Location
1 () JROOT/plugins/system/hikashop_ga4/hikashop_ga4.php:992
2 plgSystemHikashop_ga4->onAfterCheckoutViewDisplay() JROOT/administrator/components/com_hikashop/pluginCompatJ4.php:50
3 hikashopJoomlaPlugin->__call() JROOT/libraries/vendor/joomla/event/src/Dispatcher.php:454
4 Joomla\Event\Dispatcher->dispatch() JROOT/libraries/src/Application/EventAware.php:111
5 Joomla\CMS\Application\WebApplication->triggerEvent() JROOT/components/com_hikashop/views/checkout/view.html.php:318
6 CheckoutViewCheckout->displayBlock() JROOT/components/com_hikashop/views/checkout/tmpl/show.php:51
7 include() JROOT/libraries/src/MVC/View/HtmlView.php:416
8 Joomla\CMS\MVC\View\HtmlView->loadTemplate() JROOT/administrator/components/com_hikashop/helpers/helper.php:2936
9 hikashopView->loadTemplate() JROOT/libraries/src/MVC/View/HtmlView.php:204
10 Joomla\CMS\MVC\View\HtmlView->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2890
11 hikashopView->display() JROOT/components/com_hikashop/views/checkout/view.html.php:53
12 CheckoutViewCheckout->display() JROOT/libraries/src/MVC/Controller/BaseController.php:697
13 Joomla\CMS\MVC\Controller\BaseController->display() JROOT/administrator/components/com_hikashop/helpers/helper.php:2597
14 hikashopController->display() JROOT/components/com_hikashop/controllers/checkout.php:66
15 checkoutController->display() JROOT/components/com_hikashop/controllers/checkout.php:233
16 checkoutController->show() JROOT/components/com_hikashop/controllers/checkout.php:82
17 checkoutController->step() JROOT/libraries/src/MVC/Controller/BaseController.php:730
18 Joomla\CMS\MVC\Controller\BaseController->execute() JROOT/administrator/components/com_hikashop/helpers/helper.php:2575
19 hikashopController->execute() JROOT/components/com_hikashop/hikashop.php:88
20 require_once() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:71
21 Joomla\CMS\Dispatcher\LegacyComponentDispatcher::Joomla\CMS\Dispatcher\{closure}() JROOT/libraries/src/Dispatcher/LegacyComponentDispatcher.php:73
22 Joomla\CMS\Dispatcher\LegacyComponentDispatcher->dispatch() JROOT/libraries/src/Component/ComponentHelper.php:361
23 Joomla\CMS\Component\ComponentHelper::renderComponent() JROOT/libraries/src/Application/SiteApplication.php:218
24 Joomla\CMS\Application\SiteApplication->dispatch() JROOT/libraries/src/Application/SiteApplication.php:261
25 Joomla\CMS\Application\SiteApplication->doExecute() JROOT/libraries/src/Application/CMSApplication.php:306
26 Joomla\CMS\Application\CMSApplication->execute() JROOT/includes/app.php:58
27 require_once() JROOT/index.php:32

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
2 weeks 5 days ago #364822

Hi,

Thank you for your feedback on this issue.
We've published an new version of the plugin in order to fix this:
www.hikashop.com/marketplace/product/108...egration-google.html
Update the plugin and you should not have the error anymore.

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

  • Posts: 221
  • Thank you received: 6
  • Hikashop Business
2 weeks 5 days ago #364826

thank you very much for fast help.
error is gone

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

  • Posts: 221
  • Thank you received: 6
  • Hikashop Business
2 weeks 5 days ago #364829

sorry Nicolas, after update
tag assistant cant find our tag

Google tag: Container ______ not found

also analitics no any

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

  • Posts: 83022
  • Thank you received: 13403
  • MODERATOR
2 weeks 5 days ago #364839

Hi,

Could you provide the URL of the page so that we can look at the situation please ?

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

Time to create page: 0.091 seconds
Powered by Kunena Forum