I would like to enhance the Sales order event sent to Google Analytics on placed orders. Is there a similar service to override as I’ve done with the GoogleShoopingPriceAgent?
I would like to add the following properties to enhance Google Ads:
Yes, this is required by google really to make enhanced conversions.
Let’s say it’s not allowed and we just play with the idea of this. How would one add properties? There is already tracking events emitted by Litium when configured in BO, how can I enhance the data submitted?
There is a class called TrackingScriptGeneratorGoogleAnalytics4 that generates the data. Or if you use the Tagmanager its TrackingScriptGeneratorGoogleTagManager
You can create a class that inherits this one, and overrides it methods to modify the data.
However, you have to make sure the original class doesnt also generate its data so that you get double tracking on the confirmation page, and that can be done by adding the original to the ignored list in appsettings under Plugins/Type/Ignores to make it not load during startup.
I have done it the above way a long time a go. Most of my projects however require alot more control/customization over the datalayers sent to Google Tag Manager. For that reason I have just turned off the tracking all together in backoffice, and instead implemented my own “EnhancedEcommerceScriptGenerator” to have better control over the data generated (it handles view_item, view_item_list, purchase, view_cart etc). Even if its not really called “EnhancedEcommerce” anymore since GA4, the name still sticks in my code