Disclaimer: This website requires Please enable JavaScript in your browser settings for the best experience.

Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Loyalty and rewards

How to map external data that tracks loyalty points, rewards, and referrals to the Optimizely Data Platform (ODP) schema.

Concluding the ecommerce use case, your website has a loyalty and rewards system that you want to track through Optimizely Data Platform (ODP). To do so, you need to create custom events, objects, fields, and relationships.

Events

To learn about events, see events.

Event Type: loyalty

Event ActionFields
points_addedprevious_loyalty_points_balance
current_loyalty_points_balance
loyalty_change_in_points
points_addedprevious_loyalty_points_balance
current_loyalty_points_balance
loyalty_change_in_points
referral_completedloyalty_referral_code_id
loyalty_referred_customer_email
referral_link_sharedloyalty_referral_code_id
loyalty_referred_customer_email
tier_earnedprevious_loyalty_tier_id
current_loyalty_tier_id
tier_lostprevious_loyalty_tier_id
current_loyalty_tier_id
yotpo_coupon_awardedyotpo_redemption_id
yotpo_redemption_option_id
yotpo_perk_id
yotpo_coupon_redeemedyotpo_redemption_id
yotpo_redemption_option_id
yotpo_coupon_reminderyotpo_redemption_option_id
yotpo_points_needed

Schema

To learn about creating objects, fields and relationships and then update the newly created schema, see Objects and fields.

Objects

Object NameDescription
Loyalty Tiers (loyalty_tiers)Stores data about available Loyalty Tiers that customers can attain via loyal actions.
Loyalty Referral Codes (loyalty_referral_codes)Stores all available referral codes and metrics on sharing.

Fields

Events (events)

Field NameTypeDescription
previous_loyalty_tier_idstringThe ID of the tier that the customer was previously associated with.
current_loyalty_tier_idstringThe ID of the tier that the customer is now associated with.
previous_loyalty_points_balancenumberThe loyalty points balance of the customer before this event.
current_loyalty_points_balancenumberThe loyalty points balance of the customer after this event.
loyalty_change_in_pointsnumberThe total change in loyalty points due to this event.
loyalty_referral_code_idstringThe unique referral code that this event applies to.
loyalty_referred_customer_emailstringThe email of the customer that was referred.

Customers (customers)

To learn about Customers in ODP, see Customers.

Field NameTypeDescription
loyalty_points_balancenumberThe number of loyalty points that the customer currently has.
loyalty_referral_code_idstringThe unique Referral Code ID assigned to the customer.
loyalty_tier_idstringThe ID of the Loyalty Tier that the customer is associated with.
loyalty_profile_created_attsThe date & time that the customer record was created in the connected loyalty app.
loyalty_profile_updated_attsThe date & time that the customer record was last updated in the connected loyalty app.
loyalty_is_enrolled_memberbooleanIf true, the customer is currently enrolled in your loyalty program.

Loyalty tiers (loyalty_tiers)

Field NameTypeDescription
loyalty_tier_idstringThe unique identifier for a Loyalty Tier.
namestringThe name of the Loyalty Tier.
ranknumberThe numeric rank of this Loyalty tier relative to other Loyalty Tiers.
required_dollar_spendnumberThe amount of dollars required to be spent by a customer to reach this Loyalty Tier.
descriptionstringA description of this Loyalty Tier.
required_pointsnumberThe number of points required to reach this Loyalty Tier.
required_purchasesnumberThe number of purchases required to reach this Loyalty Tier.

Loyalty referral codes (loyalty_referral_codes)

Field NameTypeDescription
loyalty_referral_code_idstringThe unique referral code assigned to a customer.
total_sharesnumberThe number of times that this referral code has been shared.
order_conversions_countnumberThe number of orders that have resulted from this referral code.
order_conversions_amountnumberThe dollar amount of the number of orders that have resulted from this referral code.
expiration_tstsThe date & time that the referral code expires, if it does.
is_expiredbooleanDetermines whether or not the referral code is expired.
total_clicksnumberThe total number of clicks of the shared referral code URL.
referral_urlstringThe unique referral code URL.

Relationships

NameParentChild
loyalty_referral_codeevents.loyalty_referral_code_idloyalty_referral_codes.loyalty_referral_code_id
previous_loyalty_tierevents.previous_loyalty_tier_idloyalty_tiers.loyalty_tier_id
current_loyalty_tierevents.current_loyalty_tier_idloyalty_tiers.loyalty_tier_id
loyalty_referral_codecustomers.loyalty_referral_code_idloyalty_referral_codes.loyalty_referral_code_id
loyalty_tiercustomers.loyalty_tier_idloyalty_tiers.loyalty_tier_id