Statistics Enricher

Overview

When a loyalty program member performs an activity other than new member registration for a loyalty program, the Loyalty Statistics Enricher detects the activity and updates SAP Hybris Profile.

The enricher updates the following nodes and relationships in the Secure Graph service:

  • (Identity)-\[HAS\]->(Tier) relationship with current loyalty balance points
  • (LoyaltyPointsHistory) node with loyalty points for the current activity, and updates the points history
  • (LoyaltyActivityStatistics) node with the recalculated activity score, and updates the activity scores history

If the LoyaltyActivityStatistics node is connected to the old Month node, this enricher creates a new month node if it does not exist. It also creates a relationship between the LoyaltyActivityStatistics node and the new Month node. It also deletes the relationship between the LoyaltyActivityStatistics node and the old Month node.

On the first day of every month, a background job updates the activity scores for all loyalty program members in SAP Hybris Profile.


Events

For more information about events, see the PubSub service documentation.

The creation of any member activity, except member registration, in SAP Hybris Loyalty triggers the Loyalty Statistics Enricher.

The Loyalty Statistics Enricher:

  • Creates or updates the relationship between the Identity (Loyalty) and Tier nodes.
  • Creates or updates the Loyalty Points History and Loyalty Activity Statistics nodes.

Every month, the Statistics Enricher updates the activity score of all the loyalty members in SAP Hybris Profile.

Triggered by SchemaPayload example
context/loyalty/loyaltyactivity

The Statistics Enricher updates these nodes and relations in the Secure Graph service:

Node or Relationproperties
nodes/loyalty/Identitytype
nodes/loyalty/LoyaltyActivityStatisticsactivityScore
nodes/loyalty/LoyaltyActivityStatisticsactivityScoreHistory
nodes/loyalty/LoyaltyPointsHistoryloyaltyPointsHistory
nodes/loyalty/LoyaltyPointsHistorypointsToNextTier
nodes/loyalty/LoyaltyPointsHistorycurrentLoyaltyBalance
relations/loyalty/LoyaltyActivityStatistics/core/Month/loyalty/UPDATEDupdateTimeStamp
relations/loyalty/Identity/loyalty/LoyaltyTier/loyalty/HAScurrentLoyaltyBalance
relations/loyalty/Identity/loyalty/LoyaltyTier/loyalty/NEXT_TIERpointsToNextTier
nodes/loyalty/LoyaltyTier
nodes/core/Month


Metamodel

This interactive graphic displays the schemas that invoke this enricher and the schemas this enricher can affect in the graph, as defined in a current snapshot of the metamodel.


Glossary

TermDescription
Activity ScoreActivity scores are calculated for each loyalty member based on a formula that depends on the number of loyalty points accrued in the last six months. The formula for the activity score is `1.0*(Points from Month "N") + 0.8*(Points from Month "N-1") + 0.6*(Points from Month "N-2") + 0.4*(Points from Month "N-3") + 0.2*(Points from Month "N-4") + 0.1*(Points from Month "N-5")`, where **N** is the current month.


  • Send feedback

    If you find any information that is unclear or incorrect, please let us know so that we can improve the Dev Portal content.

  • Get Help

    Use our private help channel. Receive updates over email and contact our specialists directly.

  • hybris Experts

    If you need more information about this topic, visit hybris Experts to post your own question and interact with our community and experts.