How to configure multiple events with numeric value | Community
Skip to main content
Level 2
October 11, 2023
Solved

How to configure multiple events with numeric value

We are currently passing total value of the order with numeric event. Below is an example of the same-

 

s.events = "purchase,event5="+ digitalData.order.orderGrandtotal;

 

Is it possible to add more numeric events in above mentioned code? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Jennifer_Dungan
Jennifer_DunganAccepted solution
Level 2
October 11, 2023

Hi,

 

I assume you mean that you want something like:

  • event5 - increment by the order grand total (as above)
  • event6 - increment by number of items in the order (example)
  • event7 - increment by how many searches the user performed before purchasing (ok, farfetched, but just another example 🙂 )

 

so you need to increment 3 separate numeric events?

 

You can just do this:

s.events = "purchase,event5=" + digitalData.order.orderGrandtotal + ",event6=" + digitalData.order.itemsInOrder + ",event7=" + digitalData.order.totalSearches;

 

So long as the resulting events string has the comma delimiter between your events ("purchase,event5=9.99,event6=2,event7=4") then this is fine.

3 replies

Jennifer_Dungan
Jennifer_DunganAccepted solution
Level 2
October 11, 2023

Hi,

 

I assume you mean that you want something like:

  • event5 - increment by the order grand total (as above)
  • event6 - increment by number of items in the order (example)
  • event7 - increment by how many searches the user performed before purchasing (ok, farfetched, but just another example 🙂 )

 

so you need to increment 3 separate numeric events?

 

You can just do this:

s.events = "purchase,event5=" + digitalData.order.orderGrandtotal + ",event6=" + digitalData.order.itemsInOrder + ",event7=" + digitalData.order.totalSearches;

 

So long as the resulting events string has the comma delimiter between your events ("purchase,event5=9.99,event6=2,event7=4") then this is fine.

Translate
S_K_3_11Author
Level 2
October 11, 2023

Hi Jennifer,

 

It Works. Thanks for the help

Translate
Jennifer_Dungan
Level 2
October 11, 2023

You're welcome!

 

I too have a complex event implementation, so I do stuff like that a lot. So I'm happy to pass on any advice that will help other people out.

Translate