Lead with seats together and a hotel for a family trip
A traveler searched for four passengers to Orlando, out on Friday and back on Monday, and has picked a fare. The extras page opens with the lounge pass, then priority boarding, then seats, in the order set for every booking. Those offers suit a traveler on their own, and the passenger count reaches the extras page once the booking is built, after the first offer has been shown. Four people on a three-night trip want to sit together and need somewhere to sleep, and both offers are ready to show.
passengers_session- Passengers on the last search this visit
nights_session- Nights between the outbound and the return on the last search this visit
Puts seats together and the hotel offer for the destination at the top of the extras page when the last search this visit has three or more passengers and at least two nights, and leaves the lounge pass further down.
from snowplow_signals import (
Attribute, Event, EventProperty, StreamAttributeGroup, domain_sessionid,
)
flight_search = Event(name="flight_search", vendor="com.example", version="1-0-0")
passengers_session = Attribute(
name="passengers_session",
type="int32",
events=[flight_search],
aggregation="last",
property=EventProperty(vendor="com.example", name="flight_search", major_version=1, path="passengers"),
)
nights_session = Attribute(
name="nights_session",
type="int32",
events=[flight_search],
aggregation="last",
property=EventProperty(vendor="com.example", name="flight_search", major_version=1, path="nights"),
)
# Keyed on the visit, so the shape of this trip is ready before the booking is built.
trip_extras_family = StreamAttributeGroup(
name="trip_extras_family",
version=1,
attribute_key=domain_sessionid,
owner="you@example.com",
attributes=[passengers_session, nights_session],
)// In the code that renders the extras page
const trip = await signals.getServiceAttributes({
name: "trip_extras_family",
attribute_key: "domain_sessionid",
identifier: sessionId,
});
// { passengers_session: 4, nights_session: 3 }
if (trip.passengers_session >= 3 && trip.nights_session >= 2) {
extras.order(["seats_together", "hotel", "bags", "lounge"]);
}