Closed phillmorgan28 closed 11 months ago
How exactly are you adding an item to the basket? What Commerce APIs are you using to do so?
I'm using the standard Commerce HTML form to add items to the basket. Excerpt below.
<form method="POST">
<input type="hidden" name="successMessage" value="{{ 'Item has been added to your basket.' | t | hash }}">
<input type="hidden" name="purchasableId" value="{{ product.defaultVariant.id }}">
{{ actionInput('commerce/cart/update-cart') }}
{{ redirectInput(addToBasketRedirect('basket')) }}
{{ csrfInput() }}
I've confirmed this is calling the Commerce line item events for before and after one is added, using my own plugin event hooks.
That's really strange... is it calling through to the event listeners that Instant Analytics adds? Will try to reproduce locally, but we have confirmed it does listen for these events.
Thanks for looking into this one. I've had a look at the plugin code myself and I can't see any issues that would prevent the hooks from working. I'll try to get approval from our client to start debugging our end to see if something else is getting in the way. I'll report back any findings if applicable to the plugin. Thanks again
Hi, thanks for taking the time to check on this for me. I've been able to confirm that the plugin IS sending the events after enabling info level logging in Craft. Our client was using a closed funnel (Purchase Journey) in GA4 which was missing a step, so made it look as though events were not coming through. I've added the product/item view GA4 event using the manual twig tag which should solve the issue.
Describe the bug
The automatic Commerce events never trigger
To reproduce
Steps to reproduce the behaviour:
Expected behaviour
The add to basket event (and others) to fire and be received by GA4
Log file test
Versions