Can we get the total amount spend of a user in a checkout complete event

I see that right now we only get total order count in custom pixel events can we get the total amount spend in the checkout complete event. Because for google ads tracking we have to send customer life time value. So that we can identify a customer LTV.

Can anyone from Shopify team help me with this regard.

There is currently no way to do this with web-pixels directly.

You would be able to do this with a custom event before checkout and saved in session value accessible in checkout_complete web-pixel event.

note - you can see if someone is a new or returning customer though

"order": {
                "id": "5548510281798",
                "customer": {
                    "id": "6479304163398",
                    "isFirstOrder": false
                }
            },

@zamartz I know that. But I need the total amount spend. As it is required for tracking.

@Liam-Shopify Can you pls look into this matter. We need it urgent.

@Rahi_1994 the only way to get it is to grab it before checkout, store it in session, and grab it from session on checkout event.

@Dave_Strang Can you pls look into this. Can you pls pass this value in the checkout complete event. So that we can pass that value for Google Ads Tracking.

The checkout_completed web-pixel event provides the total amount. Please refer to the document below:

Hi @Rahi_1994

Does the transaction amount give you the info you need? See: https://screenshot.click/19-03-2rxgo-nu0ua.mp4

Also, please avoid tagging specific Shopify staff on the forums - teams will see topics which are related to their area, and different staff members monitor the forums on different days.

@Liam-Shopify No, Actually I want to get the total amount spend till now of a particular customer in my store. The video you have provided is only for the purchase total value. I need this because I have to send this to google ads so that we can identify the LTV of a customer. I hope It make sense.
Here is the screenshot of the value I need in the checkout complete event in custom Pixel.

@AMaL and @Liam-Shopify he’s not looking for the order total - he’s looking for how much that customer spent in the store since their first order (LTV)

@Rahi_1994 as I said before on:

there is an example for another session event on comment:Correctly Tracking Marketing Consent State Changes - #6 by zamartz

@zamartz Yes But it will be so much helpful if we get it by default in the checkout complete event. Then we don’t have to store this value in session storage and then again retrieve it.

That’s why I am asking the Shopify Team to consider it to implement in the checkout complete event.

By the way how can we get this value before the checkout event. Can you give me any code example. It will be helpful for me. Until Shopify team implement it I will go with your way.

You can actually get the customer total spent via liquid: {{ customer.total_spent }}.

From there you could parse it as a cart attribute, line_item attribute or some javascript magic. I’d prefer the first.

In the checkout_completed event you can access this value through event.data.checkout.attributes

Note: this solution requires the customer to be logged in pre-checkout.

@Rahi_1994 both @curzey and I provided the only two ways to do it currently.
both require users to be signed-in before checkout. One adds it to the cart/cart-items, one has it stored on the session.

Other suggestions like LTV here = What is the roadmap for Custom/Web Pixels

1 Like

@curzey and @zamartz Can we get it if the user is not logged in. Because when we get this particular value from the order object in GraphQL API user don’t have to login still we get that value. Can we get this in similar pattern in custom pixel.

Or can you add it in the roadmap of custom pixel so that we don’t have to do all this tricks to get a simple value in the checkout complete event.