Expand my Community achievements bar.

SOLVED

How to configure multiple events with numeric value

Avatar

Level 2

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? 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

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.

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

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.

Avatar

Community Advisor

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.