Skip to Content
ProcessesTasksReportsGuestLoyaltyReportTask

GuestLoyaltyReportTask

The GuestLoyaltyReportTask generates a guest-focused report containing loyalty KPIs and behavioral flags for CRM and marketing purposes.

Overview

This report enables:

  • Guest segmentation for marketing
  • Loyalty program management
  • Customer lifetime value analysis
  • Re-engagement campaign targeting

Data Structure

Output Schema

Includes all loyalty metrics from ProcessedGuestModel:

Identity

  • guest_cluster_id - Unique guest identifier
  • Guest contact info (name, email, phone, address)

Loyalty Metrics

  • stays - Total completed stays
  • lifetime_total_value - Total revenue
  • avg_total_net_revenue_per_stay
  • total_stay_nights
  • stays_category - Loyalty tier (1, 2, 3, 4-7, 8-10, 11-20, 20+)
  • returning_guest - Boolean flag

Booking Patterns

  • first_booking_date, last_booking_date
  • first_check_in_date, last_check_in_date
  • avg_booking_window
  • properties_visited - Comma-separated list

Behavioral Flag

  • guest_flag - Segmentation flag

The guest_flag column contains one of the following values assigned by the task based on booking and stay history:

  • GUEST_NO_BOOKING — guest has no bookings
  • GUEST_BOOKING_NO_STAY — guest has bookings but no recorded stays
  • GUEST_BOOKING_LAST_365_DAYS — guest had a stay in the past 365 days

Deduplication and writing

Before writing the task drops duplicates and cleans up internal id fields:

  • dropDuplicates(['guest_cluster_id'])
  • drops guest_id_og and guest_id columns

Writes go to a curated table guest_loyalty (the code uses CuratedTables.GUEST_LOYALTY from etl_lib.data.enums) if write_to_catalog is True. This is a curated guest-level table suitable for CRM integrations and BI.

Last updated on