In GA4 plugin - item_id = product_code?

  • Posts: 241
  • Thank you received: 29
  • Hikashop Business
1 week 5 days ago #367321

-- HikaShop version -- : 5.1.6
-- Joomla version -- : 5.3.0
-- PHP version -- : 8.1
-- Browser(s) name and version -- : Google chrome

Hi,

'item_id' => json_encode($product->product_code),
Is this right or it was a mistake, shouldn't that be product_id?
'item_id' => json_encode($product->product_id),
I ended up checking the plugin after noticing that my remarketing integration with newsman was no longer working.
GA4 sends the product code to the dataLayer at "product id" instead of the id.
I'm not saying it's wrong one way or another, I know that a long time ago when I did the integration everything worked ok with newsman and now it doesn't.
I'm trying to figure out where the change was made that creates this situation for me now ::side::
For a future update, perhaps the option to choose from the plugin settings what information to send to the dataLayer would be useful.
If I edit the plugin and make this change, will it still work ok with Google Analytics?

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

  • Posts: 83933
  • Thank you received: 13588
  • MODERATOR
1 week 5 days ago #367324

Hi,

The product id is a number attributed automatically by HikaShop for internal use.
Also, GA doesn't have a field named "item_code".
And GA recommends you to use the "SKU" for the item_id:
support.google.com/analytics/answer/13782210?hl=en
And the SKU of a product is usually stored in product_code.

So it's not a mistake. This is done like this because that's how it is supposed to be.
If your integration worked in the past, then I don't think you want to do this modification because the plugin has always used the product_code for the item_id. The problem must be elsewhere.

If you edit the code of the plugin with that change it should still work ok with GA. Note however that in your GA interface, you'll have your products in double. One product for the item_id with the id (from after the change) and one product for the item_id with the code (from before). So, you likely don't want to make that change.

The following user(s) said Thank You: oxido

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

Time to create page: 0.058 seconds
Powered by Kunena Forum