Skip to main content

Overview

Integrate ZKScore metrics into analytics dashboards for user segmentation and behavioral analysis.

Implementation

async function getUserSegment(address) {
  const score = await zkScore.getScore(address);
  const breakdown = await zkScore.getScoreBreakdown(address);
  
  return {
    address,
    totalScore: score.total,
    primaryCategory: Object.entries(breakdown)
      .sort(([,a], [,b]) => b - a)[0][0],
    segment: score.total >= 700 ? 'high_value' : score.total >= 400 ? 'mid_value' : 'new_user'
  };
}