Skip to content

Commit

Permalink
improve AQL for reporting
Browse files Browse the repository at this point in the history
  • Loading branch information
trieu committed Oct 15, 2024
1 parent 14d432d commit 97ba33f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions configs/database-query-template.aql
Original file line number Diff line number Diff line change
Expand Up @@ -1191,16 +1191,18 @@ AQL_PROFILE_STATS_COLLECTOR =>
FILTER p.type == 0
COLLECT WITH COUNT INTO length RETURN length)

LET customerBehaviors = ["subscribe","purchase","order-failed", "product-return", "order-checkout","repurchase","call-for-support","chat-for-support","add-to-cart"]
LET totalCustomerProfile = FIRST(
FOR p IN cdp_profile
FILTER p.status > 0
FILTER p.type > 0
FILTER ( LENGTH(p.primaryPhone) > 0 || LENGTH(p.primaryEmail) > 0 )
FILTER (p.behavioralEvents ANY IN ["subscribe","purchase"] || p.totalTransactionValue > 0)
FILTER (p.behavioralEvents ANY IN customerBehaviors)
COLLECT WITH COUNT INTO length RETURN length)

LET totalContactProfile = FIRST(FOR p IN cdp_profile
FILTER p.status > 0 FILTER p.type > 0 FILTER (LENGTH(p.primaryEmail) > 0 OR LENGTH(p.primaryPhone) > 0)
FILTER p.status > 0
FILTER p.type > 0
FILTER (LENGTH(p.primaryEmail) > 0 OR LENGTH(p.primaryPhone) > 0)
COLLECT WITH COUNT INTO length RETURN length)

LET totalSegments = FIRST(FOR s IN cdp_segment
Expand Down

0 comments on commit 97ba33f

Please sign in to comment.