Hi,
Thanks for your feedback.
The debug message you're providing is something I added to the GA plugin in case the client_id was missing in the order in order to skip sending the purchase event to GA because GA would refuse the event without a client_id.
I didn't put much more thought into it.
Also, the plugin has a mechanism to get the client_id from the javascript of GA during the checkout and store it inside the order when the order is being created, at the end of the checkout.
This way, GA can link the purchase event with the activity of the user on the website.
Now, it is possible the client_id is missing. For example, if you use the "new" button of the orders listing in the backend in order to manually enter an order, then there won't be a client_id for it.
So, I've looked a bit online about it and found this nice page explaining the issue and providing some possible solutions:
stackoverflow.com/questions/68773179/wha...nalytics-4-using-the
So, based on this, I think that instead of the "return" just after the line:
hikashop_writeToLog('no client_id in order '.$orderData->order_id);
in the file plugins/system/hikashop_ga4/hikashop_ga4.php, I think you want to have :
$payload->clientId = $orderData->order_id;
That way, instead of skipping the purchase event, it will use the order_id as client_id and proceed with the purchase event.
I've implemented the change on our end with a new version of the plugin.