Recently I discovered a few errors with the implementation that was done at my company before I started.
And I would like some practical examples to show my IT team so we can fix it.
One of the errors encontered was Check Out / Cart with Multiple Products
As Revenue = Price x Quantity
But what if you have two different priced products.
Our implementation was “adding” the prices, adding the quantities and multiplying … but obviously this is wrong.
What is the best way to solve this?
Precalculate an average price based on quantities??
Best answer by sydney.koh
Hello David!
Nice find Saish Denis presented a great way to set up multiple products purchases! After reading your questions there is another implementation that is very similar to Denis’ but slightly different and may help your case.
Create an event called Order Completed (or whatever name you want) that will track an order. You will need to have some property like order_id on the event. You will have a unique order_id for each Order Completed events. This event will track the entire order and can be logged as Revenue in SDKs or sending revenue field with the event. You can also add custom event properties for this event like a product array. If you had a 3 products at $1 and 2 products at $2. You can have one Order Completed event that has a total revenue of $7.
Create another event called Product Purchased (or whatever name you want) in which fires for each item purchased in an Order. There should be an event property on each event called something like item_id in order to show each unique item. This event will not be tracked as Revenue. So that revenue is not double-counted since they are counted in the event above.
This solution is a little different so you should consider the logic of both and see which one fits your case better! It may also be a good idea to try them in a test project before you implemented them in your main project.
I believe that sending an event property like order_id for those individual events under one purchase order will help in some charts, but there isn’t a direct way of using a direct linking mechanism afaik.
Denis also mentions in his answer about sending in a consolidated final purchase event with the individual products as an array as one of the most common approaches. So using the Uniques metric in your event segmentation chart for this event will help you track the unique individuals who are purchasing.
Nice find Saish Denis presented a great way to set up multiple products purchases! After reading your questions there is another implementation that is very similar to Denis’ but slightly different and may help your case.
Create an event called Order Completed (or whatever name you want) that will track an order. You will need to have some property like order_id on the event. You will have a unique order_id for each Order Completed events. This event will track the entire order and can be logged as Revenue in SDKs or sending revenue field with the event. You can also add custom event properties for this event like a product array. If you had a 3 products at $1 and 2 products at $2. You can have one Order Completed event that has a total revenue of $7.
Create another event called Product Purchased (or whatever name you want) in which fires for each item purchased in an Order. There should be an event property on each event called something like item_id in order to show each unique item. This event will not be tracked as Revenue. So that revenue is not double-counted since they are counted in the event above.
This solution is a little different so you should consider the logic of both and see which one fits your case better! It may also be a good idea to try them in a test project before you implemented them in your main project.
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. You can also create a Guest account below!
If you're a current customer, select the domain you use to sign in with Amplitude.
If you don't have an Amplitude account, you can create an Amplitude Starter account for free and enjoy direct access to the Community via SSO. Create an Amplitude account. Want to sign up as a guest? Create a Community account.
If you're a current customer, select the domain you use to sign in with Amplitude.
We use 3 different kinds of cookies. You can choose which cookies you want to accept. We need basic cookies to make this site work, therefore these are the minimum you can select. Learn more about our cookies.