Enhanced sales order tracking

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:

“user_data”: {
“email_address”: “harry@test.com”,
“first_name”: “TEST”,
“last_name”: “Company”,
“phone_number”: “+46 32 234 97 23”,
“street”: “Önskegatan 1”,
“postal_code”: “21458”,
“city”: “Malmö”,
“country”: “SE”
}

Litium version: 8.15.0

Not sure about the technical aspects of it, but I believe that sending such information to Google Analytics would violate Googles terms of service.

See Best practices to avoid sending Personally Identifiable Information (PII) - Analytics Help

Oddly enough Google wants you to send this type of data. It is a way to counter the 3rd party cookie death.

2 Likes

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 :slight_smile:

This is exactly the answer I was looking for. Thank you Martin.

I’ll get back to my team to discuss if we want to override or build our own analytics layer as you mentioned.

I’ll get back and update this thread when we have implemented a solution.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.