Multiple contexts of the same type


#1

Hi,

is it possible to attach the same context multiple times to an event?

For instance a page has multiple offers, so maybe I want to submit an offer context multiple times. I didn’t found any hint in the documentation and my intuition would say, that it doesn’t work and I have to create multiple events.


#2

Yes you absolutely can send multiple contexts of the same time with a single event.

A good example is sending multiple product impressions (one for each product) with a page view event (if a user has loaded a catalogue page, for example) or a transaction event (if a user has multiple line items in a transaction).


#3

Thanks for replying that fast. Really nice that it works


#4

Just a note that there won’t be any explicit ordering of the multiple contexts - if you want an explicit ordering of the contexts (e.g. for search results), then currently you’ll need to add an index property or similar to the schema to preserve this.