{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Class: AnalyticsManager"},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/readme"},"children":["PERS SDK - v2.3.26"]}," / ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/modules"},"children":["Exports"]}," / AnalyticsManager"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"class-analyticsmanager","__idx":0},"children":["Class: AnalyticsManager"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Analytics Manager - Clean, high-level interface for analytics operations"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Provides comprehensive analytics and business intelligence capabilities for the"," ","loyalty ecosystem including transaction analysis, user behavior tracking, campaign"," ","performance metrics, and business insights. Enables data-driven decision making"," ","with real-time and historical analytics across all system domains."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Get transaction analytics for the last 30 days\nconst analytics = await sdk.analytics.getTransactionAnalytics({\n  startDate: '2024-01-01',\n  endDate: '2024-01-31',\n  groupBy: 'day',\n  metrics: ['volume', 'count', 'averageValue']\n});\n\nconsole.log('Transaction Trends:');\nconsole.log(`Total Volume: $${analytics.totalVolume}`);\nconsole.log(`Total Transactions: ${analytics.totalCount}`);\nconsole.log(`Average Transaction: $${analytics.averageValue}`);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Analyze performance by business partner\nconst businessAnalytics = await sdk.analytics.getTransactionAnalytics({\n  startDate: '2024-01-01',\n  endDate: '2024-12-31',\n  groupBy: 'business',\n  includeDetails: true\n});\n\nconsole.log('Top Performing Partners:');\nbusinessAnalytics.businessBreakdown?.forEach((business, index) => {\n  console.log(`${index + 1}. ${business.name}`);\n  console.log(`   Volume: $${business.volume}`);\n  console.log(`   Transactions: ${business.count}`);\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Get comprehensive analytics dashboard data\nconst analyticsService = sdk.analytics.getAnalyticsService();\n\n// Get multiple analytics in parallel\nconst [userMetrics, campaignMetrics, tokenMetrics] = await Promise.all([\n  analyticsService.getUserEngagementMetrics(),\n  analyticsService.getCampaignPerformance(),\n  analyticsService.getTokenDistributionAnalytics()\n]);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"table-of-contents","__idx":1},"children":["Table of contents"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"constructors","__idx":2},"children":["Constructors"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#constructor"},"children":["constructor"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"methods","__idx":3},"children":["Methods"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#gettransactionanalytics"},"children":["getTransactionAnalytics"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getcampaignclaimanalytics"},"children":["getCampaignClaimAnalytics"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getredemptionredeemanalytics"},"children":["getRedemptionRedeemAnalytics"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getuseranalytics"},"children":["getUserAnalytics"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getuserranking"},"children":["getUserRanking"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getbusinessranking"},"children":["getBusinessRanking"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getretentionanalytics"},"children":["getRetentionAnalytics"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#gettaganalytics"},"children":["getTagAnalytics"]}]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager#getanalyticsservice"},"children":["getAnalyticsService"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"constructors-1","__idx":4},"children":["Constructors"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"constructor","__idx":5},"children":["constructor"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["• ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["new AnalyticsManager"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apiClient"]},"): ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AnalyticsManager"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters","__idx":6},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["apiClient"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/persapiclient"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PersApiClient"]}]}]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns","__idx":7},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsmanager"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AnalyticsManager"]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in","__idx":8},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L75"},"children":["managers/analytics-manager.ts:75"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"methods-1","__idx":9},"children":["Methods"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"gettransactionanalytics","__idx":10},"children":["getTransactionAnalytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getTransactionAnalytics"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get transaction analytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieves comprehensive transaction analytics with flexible filtering,"," ","grouping, and metric selection. Provides insights into transaction volumes,"," ","trends, business performance, and user behavior patterns across the"," ","loyalty ecosystem."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-1","__idx":11},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Analytics request parameters including date range, filters, and metrics"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-1","__idx":12},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TransactionAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to transaction analytics data with metrics and breakdowns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Throws"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When analytics data is unavailable or parameters are invalid"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"try {\n  const analytics = await sdk.analytics.getTransactionAnalytics({\n    startDate: '2024-01-01T00:00:00Z',\n    endDate: '2024-01-31T23:59:59Z',\n    groupBy: 'day',\n    metrics: ['volume', 'count', 'averageValue', 'tokens'],\n    includeComparisons: true  // Compare with previous period\n  });\n  \n  console.log('Transaction Analytics Summary:');\n  console.log(`Total Volume: $${analytics.totalVolume.toLocaleString()}`);\n  console.log(`Total Transactions: ${analytics.totalCount.toLocaleString()}`);\n  console.log(`Average Transaction: $${analytics.averageValue.toFixed(2)}`);\n  console.log(`Tokens Distributed: ${analytics.totalTokens.toLocaleString()}`);\n  \n  if (analytics.periodComparison) {\n    const volumeChange = analytics.periodComparison.volumeChangePercent;\n    const countChange = analytics.periodComparison.countChangePercent;\n    \n    console.log('\\nPeriod-over-Period Changes:');\n    console.log(`Volume: ${volumeChange > 0 ? '+' : ''}${volumeChange}%`);\n    console.log(`Count: ${countChange > 0 ? '+' : ''}${countChange}%`);\n  }\n  \n  // Display daily trend data\n  if (analytics.dailyBreakdown) {\n    console.log('\\nDaily Trends:');\n    analytics.dailyBreakdown.forEach(day => {\n      console.log(`${day.date}: $${day.volume} (${day.count} transactions)`);\n    });\n  }\n  \n} catch (error) {\n  console.log('Analytics retrieval failed:', error.message);\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Analyze transaction performance by business partner\nconst businessAnalytics = await sdk.analytics.getTransactionAnalytics({\n  startDate: '2024-01-01',\n  endDate: '2024-03-31',\n  groupBy: 'business',\n  metrics: ['volume', 'count', 'averageValue', 'customerCount'],\n  includeDetails: true,\n  minimumTransactionCount: 10  // Only include businesses with 10+ transactions\n});\n\nconsole.log('Business Partner Performance:');\n\nif (businessAnalytics.businessBreakdown) {\n  // Sort by volume descending\n  const sortedBusinesses = businessAnalytics.businessBreakdown\n    .sort((a, b) => b.volume - a.volume);\n  \n  console.log('\\nTop 10 Partners by Volume:');\n  sortedBusinesses.slice(0, 10).forEach((business, index) => {\n    console.log(`\\n${index + 1}. ${business.name}`);\n    console.log(`   Volume: $${business.volume.toLocaleString()}`);\n    console.log(`   Transactions: ${business.count}`);\n    console.log(`   Avg Transaction: $${business.averageValue.toFixed(2)}`);\n    console.log(`   Unique Customers: ${business.customerCount}`);\n    console.log(`   Customer LTV: $${(business.volume / business.customerCount).toFixed(2)}`);\n  });\n  \n  // Identify growth opportunities\n  const lowVolumeHighFrequency = sortedBusinesses.filter(b => \n    b.count > 50 && b.averageValue < 25\n  );\n  \n  if (lowVolumeHighFrequency.length > 0) {\n    console.log('\\nGrowth Opportunities (High Frequency, Low Value):');\n    lowVolumeHighFrequency.forEach(business => {\n      console.log(`${business.name}: ${business.count} transactions, $${business.averageValue} avg`);\n    });\n  }\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Analyze seasonal patterns and trends\nconst seasonalAnalytics = await sdk.analytics.getTransactionAnalytics({\n  startDate: '2023-01-01',\n  endDate: '2024-12-31',\n  groupBy: 'month',\n  metrics: ['volume', 'count'],\n  includeSeasonalAnalysis: true,\n  includeTrendLine: true\n});\n\nconsole.log('Seasonal Analysis:');\n\nif (seasonalAnalytics.monthlyBreakdown) {\n  const monthlyData = seasonalAnalytics.monthlyBreakdown;\n  \n  // Find peak months\n  const peakVolumeMonth = monthlyData.reduce((max, current) => \n    current.volume > max.volume ? current : max\n  );\n  \n  const peakCountMonth = monthlyData.reduce((max, current) => \n    current.count > max.count ? current : max\n  );\n  \n  console.log(`Peak Volume Month: ${peakVolumeMonth.month} ($${peakVolumeMonth.volume})`);\n  console.log(`Peak Transaction Month: ${peakCountMonth.month} (${peakCountMonth.count})`);\n  \n  // Calculate quarterly performance\n  const quarters = {\n    Q1: monthlyData.slice(0, 3).reduce((sum, m) => sum + m.volume, 0),\n    Q2: monthlyData.slice(3, 6).reduce((sum, m) => sum + m.volume, 0),\n    Q3: monthlyData.slice(6, 9).reduce((sum, m) => sum + m.volume, 0),\n    Q4: monthlyData.slice(9, 12).reduce((sum, m) => sum + m.volume, 0)\n  };\n  \n  console.log('\\nQuarterly Performance:');\n  Object.entries(quarters).forEach(([quarter, volume]) => {\n    console.log(`${quarter}: $${volume.toLocaleString()}`);\n  });\n}\n\nif (seasonalAnalytics.trendAnalysis) {\n  console.log('\\nTrend Analysis:');\n  console.log(`Growth Rate: ${seasonalAnalytics.trendAnalysis.growthRate}%/month`);\n  console.log(`Trend Direction: ${seasonalAnalytics.trendAnalysis.direction}`);\n  console.log(`Seasonality Score: ${seasonalAnalytics.trendAnalysis.seasonalityScore}`);\n}\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"// Get real-time metrics for dashboard display\nconst realTimeMetrics = await sdk.analytics.getTransactionAnalytics({\n  startDate: new Date(Date.now() - 24 * 60 * 60 * 1000).toISOString(), // Last 24 hours\n  endDate: new Date().toISOString(),\n  groupBy: 'hour',\n  metrics: ['volume', 'count', 'tokens'],\n  includeRealTimeMetrics: true\n});\n\nconsole.log('⚡ Real-time Metrics (Last 24 Hours):');\nconsole.log(`Current Volume: $${realTimeMetrics.totalVolume}`);\nconsole.log(`Active Users: ${realTimeMetrics.activeUserCount}`);\nconsole.log(`Transactions/Hour: ${realTimeMetrics.transactionsPerHour}`);\n\nif (realTimeMetrics.hourlyBreakdown) {\n  // Show last 6 hours\n  const lastSixHours = realTimeMetrics.hourlyBreakdown.slice(-6);\n  console.log('\\n� Last 6 Hours:');\n  lastSixHours.forEach(hour => {\n    console.log(`${hour.hour}:00 - $${hour.volume} (${hour.count} txns)`);\n  });\n}\n\n// Update dashboard in real-time\nconst updateDashboard = () => {\n  document.getElementById('totalVolume').textContent = `$${realTimeMetrics.totalVolume}`;\n  document.getElementById('transactionCount').textContent = realTimeMetrics.totalCount;\n  document.getElementById('activeUsers').textContent = realTimeMetrics.activeUserCount;\n};\n\nupdateDashboard();\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-1","__idx":13},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L260"},"children":["managers/analytics-manager.ts:260"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getcampaignclaimanalytics","__idx":14},"children":["getCampaignClaimAnalytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getCampaignClaimAnalytics"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CampaignClaimAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get campaign claim analytics with aggregation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieves aggregated analytics for campaign claims with flexible grouping,"," ","filtering, and metric selection. Provides insights into campaign performance,"," ","claim patterns, and user engagement across the loyalty ecosystem."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-2","__idx":15},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CampaignClaimAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Analytics request with filters, groupBy, and metrics"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-2","__idx":16},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CampaignClaimAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to campaign claim analytics data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getCampaignClaimAnalytics({\n  filters: { status: 'COMPLETED' },\n  groupBy: ['campaignId'],\n  metrics: ['count'],\n  sortBy: 'count',\n  sortOrder: 'DESC',\n  limit: 10\n});\n\nconsole.log('Top campaigns:', analytics.results);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-2","__idx":17},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L288"},"children":["managers/analytics-manager.ts:288"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getredemptionredeemanalytics","__idx":18},"children":["getRedemptionRedeemAnalytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getRedemptionRedeemAnalytics"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RedemptionRedeemAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get redemption redeem analytics with aggregation"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieves aggregated redemption redeem data with flexible grouping and metrics."," ","Perfect for charts, dashboards, and redeem pattern analysis across redemptions,"," ","businesses, and time periods."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-3","__idx":19},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RedemptionRedeemAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Analytics request with filters, groupBy, and metrics"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-3","__idx":20},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RedemptionRedeemAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to redemption redeem analytics data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getRedemptionRedeemAnalytics({\n  groupBy: ['redemptionId'],\n  metrics: ['count'],\n  sortBy: 'count',\n  sortOrder: 'DESC',\n  limit: 10\n});\n\nconsole.log('Top redemptions by redeems:', analytics.results);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getRedemptionRedeemAnalytics({\n  groupBy: ['month', 'status'],\n  metrics: ['count'],\n  sortBy: 'month',\n  sortOrder: 'DESC',\n  startDate: new Date('2026-01-01'),\n  endDate: new Date('2026-12-31')\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getRedemptionRedeemAnalytics({\n  filters: { status: 'COMPLETED' },\n  groupBy: ['businessId'],\n  metrics: ['count'],\n  sortBy: 'count',\n  sortOrder: 'DESC'\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-3","__idx":21},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L338"},"children":["managers/analytics-manager.ts:338"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getuseranalytics","__idx":22},"children":["getUserAnalytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getUserAnalytics"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request?"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UserAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get user analytics with engagement metrics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieves aggregated user statistics including engagement rate, active users,"," ","transaction metrics, and per-active-user averages. Provides comprehensive"," ","insights into user behavior, engagement patterns, and platform adoption metrics."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["NEW: Added per-active-user metrics (averageTransactionsPerActiveUser, etc.) which"," ","show concentrated engagement among active users - more useful than diluted all-user averages."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Request structure matches TransactionAnalytics and CampaignClaimAnalytics:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Use filters object for business-specific scoping"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["startDate/endDate at root level for date range filtering"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-4","__idx":23},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UserAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Analytics request with optional filters and date range"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-4","__idx":24},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UserAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to user analytics data with per-user and per-active-user metrics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getUserAnalytics({});\nconsole.log(`Total users: ${analytics.totalUsers}`);\nconsole.log(`Active users: ${analytics.activeUsers} (${analytics.engagementRate.toFixed(1)}%)`);\n\n// Per-user averages (includes inactive users - lower numbers)\nconsole.log(`\\\\nPer-User Averages (all users):`);\nconsole.log(`  Transactions: ${analytics.averageTransactionsPerUser.toFixed(2)}`);\nconsole.log(`  Claims: ${analytics.averageClaimsPerUser.toFixed(2)}`);\nconsole.log(`  Redemptions: ${analytics.averageRedemptionsPerUser.toFixed(2)}`);\n\n// Per-active-user averages (only engaged users - higher, more meaningful numbers)\nconsole.log(`\\\\nPer-Active-User Averages (engaged users only):`);\nconsole.log(`  Transactions: ${analytics.averageTransactionsPerActiveUser.toFixed(2)}`);\nconsole.log(`  Claims: ${analytics.averageClaimsPerActiveUser.toFixed(2)}`);\nconsole.log(`  Redemptions: ${analytics.averageRedemptionsPerActiveUser.toFixed(2)}`);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getUserAnalytics({\n  startDate: new Date('2026-02-01'),\n  endDate: new Date('2026-02-28')\n});\n\nconsole.log('February 2026 User Metrics:');\nconsole.log(`Total users: ${analytics.totalUsers}`);\nconsole.log(`Active users: ${analytics.activeUsers}`);\nconsole.log(`New users: ${analytics.newUsers}`);\nconsole.log(`Engagement rate: ${analytics.engagementRate.toFixed(2)}%`);\nconsole.log(`Total transaction volume: $${analytics.totalTransactionVolume.toLocaleString()}`);\nconsole.log(`Avg transaction amount: $${analytics.averageTransactionAmount.toFixed(2)}`);\nconsole.log(`\\\\nFilters applied: ${analytics.metadata.dateRange?.startDate} to ${analytics.metadata.dateRange?.endDate}`);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analytics = await sdk.analytics.getUserAnalytics({\n  filters: { businessId: 'business-123' },\n  startDate: new Date('2026-01-01'),\n  endDate: new Date('2026-12-31')\n});\n\nconsole.log(`Business customer metrics for 2026:`);\nconsole.log(`Active customers: ${analytics.activeUsers} / ${analytics.totalUsers}`);\nconsole.log(`Customer engagement: ${analytics.engagementRate.toFixed(1)}%`);\nconsole.log(`Avg spend per customer: $${analytics.averageTransactionAmount.toFixed(2)}`);\nconsole.log(`Avg spend per active customer: $${(analytics.totalTransactionVolume / analytics.activeUsers).toFixed(2)}`);\nconsole.log(`Avg claims per active customer: ${analytics.averageClaimsPerActiveUser.toFixed(2)}`);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-4","__idx":25},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L411"},"children":["managers/analytics-manager.ts:411"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getuserranking","__idx":26},"children":["getUserRanking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getUserRanking"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request?"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UserRankingAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get user transaction ranking with enriched user data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Retrieves ranked list of users with full user details (email, externalUserId)"," ","and transaction metrics. Data enrichment happens via efficient SQL JOINs + UNION"," ","(handles legacy transactions). Ideal for leaderboards, engagement analysis, and"," ","identifying power users for targeted campaigns."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Use Cases:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Admin leaderboards showing top users by activity"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["User engagement analysis with full user context"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Identifying power users for campaigns"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Customer segmentation by transaction behavior"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-5","__idx":27},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UserRankingAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Ranking request with filters, sorting, and limit"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-5","__idx":28},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UserRankingAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to ranked user list with transaction metrics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const ranking = await sdk.analytics.getUserRanking({\n  sortBy: 'totalTransactions',\n  sortOrder: 'DESC',\n  limit: 50\n});\n\nconsole.log(`Top ${ranking.totalUsers} users:`);\nranking.results.forEach((user, index) => {\n  console.log(`#${index + 1}: ${user.email || user.externalUserId}`);\n  console.log(`  Transactions: ${user.totalTransactions}`);\n  console.log(`  Token spent: ${user.tokenSpent}`);\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const ranking = await sdk.analytics.getUserRanking({\n  filters: { tokenType: 'STAMP' },\n  sortBy: 'tokenSpent',\n  sortOrder: 'DESC',\n  limit: 20\n});\n\nconsole.log('Top 20 STAMP spenders:');\nranking.results.forEach((user, index) => {\n  const identifier = user.email || user.externalUserId || user.userId;\n  console.log(`${index + 1}. ${identifier} - ${user.tokenSpent} STAMP`);\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-5","__idx":29},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L464"},"children":["managers/analytics-manager.ts:464"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getbusinessranking","__idx":30},"children":["getBusinessRanking"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getBusinessRanking"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request?"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BusinessRankingAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get business transaction ranking with enriched business data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns ranked list of businesses with full business details and transaction metrics."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-6","__idx":31},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BusinessRankingAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Ranking request with filters, sorting, and limit"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-6","__idx":32},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["BusinessRankingAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to ranked business list"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-6","__idx":33},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L476"},"children":["managers/analytics-manager.ts:476"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getretentionanalytics","__idx":34},"children":["getRetentionAnalytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getRetentionAnalytics"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request?"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RetentionAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get monthly user retention analytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Returns monthly retention data with user metrics and retention rates."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-7","__idx":35},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RetentionAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Retention request with monthsBack and filters"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-7","__idx":36},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["RetentionAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to monthly retention data"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-7","__idx":37},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L488"},"children":["managers/analytics-manager.ts:488"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"gettaganalytics","__idx":38},"children":["getTagAnalytics"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getTagAnalytics"]},"(",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request?"]},"): ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TagAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get tag usage analytics across entities"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Aggregates tag usage across all taggable entities (campaigns, redemptions,"," ","businesses, token metadata, user status types). Perfect for:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tag autocomplete/suggestions"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Tag management dashboards"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Usage analytics"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"parameters-8","__idx":39},"children":["Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"align":"left","data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["request"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TagAnalyticsRequestDTO"]}]},{"$$mdtype":"Tag","name":"td","attributes":{"align":"left"},"children":["Optional filters for entity types"]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-8","__idx":40},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Promise"]},"<",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TagAnalyticsResponseDTO"]},">"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Promise resolving to aggregated tag usage data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const allTags = await sdk.analytics.getTagAnalytics();\nconst suggestions = allTags.tags.map(t => t.tag);\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"import { TaggableEntityType } from '@explorins/pers-sdk';\n\nconst campaignTags = await sdk.analytics.getTagAnalytics({\n  entityTypes: [TaggableEntityType.CAMPAIGN]\n});\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-8","__idx":41},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L519"},"children":["managers/analytics-manager.ts:519"]}]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"getanalyticsservice","__idx":42},"children":["getAnalyticsService"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["▸ ",{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["getAnalyticsService"]},"(): ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsservice"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AnalyticsService"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Get the full analytics service for advanced operations"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Provides access to the complete AnalyticsService instance for advanced analytics"," ","operations, custom metrics, predictive analytics, cohort analysis, and"," ","operations not covered by the high-level manager methods."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"returns-9","__idx":43},"children":["Returns"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/sdk-reference/classes/analyticsservice"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AnalyticsService"]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["AnalyticsService instance with full API access"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Example"]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"typescript","header":{"controls":{"copy":{}}},"source":"const analyticsService = sdk.analytics.getAnalyticsService();\n\n// Access user engagement analytics\nconst engagementMetrics = await analyticsService.getUserEngagementMetrics({\n  timeframe: 'last-90-days',\n  includeSegmentation: true\n});\n\n// Access campaign performance analytics\nconst campaignMetrics = await analyticsService.getCampaignPerformance({\n  campaignIds: ['summer-2024', 'holiday-2024'],\n  includeConversionFunnel: true\n});\n\n// Access token distribution analytics\nconst tokenAnalytics = await analyticsService.getTokenDistributionAnalytics({\n  tokenTypes: ['CREDIT', 'REWARD'],\n  includePredictions: true\n});\n\n// Access cohort analysis\nconst cohorts = await analyticsService.getCohortAnalysis({\n    cohortType: 'monthly',\n    startDate: '2024-01-01',\n    metrics: ['retention', 'revenue', 'activity']\n});\n\n// Access predictive analytics\nconst predictions = await analyticsService.getPredictiveAnalytics({\n  model: 'customer-lifetime-value',\n  horizon: '12-months'\n});\n\n// Access real-time streaming analytics\nconst realTimeStream = analyticsService.getRealtimeMetrics();\nrealTimeStream.on('update', (metrics) => {\n  console.log('Real-time update:', metrics);\n});\n\n// Access custom analytics queries\nconst customAnalytics = await analyticsService.executeCustomQuery({\n  query: 'business-performance-by-region',\n  parameters: { region: 'north-america', timeframe: 'Q1-2024' }\n});\n\nconsole.log('Advanced analytics data retrieved');\n","lang":"typescript"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"defined-in-9","__idx":44},"children":["Defined in"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"https://github.com/eXplorins/PERS-sdks/blob/main/packages/pers-sdk/packages/pers-sdk/src/managers/analytics-manager.ts#L582"},"children":["managers/analytics-manager.ts:582"]}]}]},"headings":[{"value":"Class: AnalyticsManager","id":"class-analyticsmanager","depth":1},{"value":"Table of contents","id":"table-of-contents","depth":2},{"value":"Constructors","id":"constructors","depth":3},{"value":"Methods","id":"methods","depth":3},{"value":"Constructors","id":"constructors-1","depth":2},{"value":"constructor","id":"constructor","depth":3},{"value":"Parameters","id":"parameters","depth":4},{"value":"Returns","id":"returns","depth":4},{"value":"Defined in","id":"defined-in","depth":4},{"value":"Methods","id":"methods-1","depth":2},{"value":"getTransactionAnalytics","id":"gettransactionanalytics","depth":3},{"value":"Parameters","id":"parameters-1","depth":4},{"value":"Returns","id":"returns-1","depth":4},{"value":"Defined in","id":"defined-in-1","depth":4},{"value":"getCampaignClaimAnalytics","id":"getcampaignclaimanalytics","depth":3},{"value":"Parameters","id":"parameters-2","depth":4},{"value":"Returns","id":"returns-2","depth":4},{"value":"Defined in","id":"defined-in-2","depth":4},{"value":"getRedemptionRedeemAnalytics","id":"getredemptionredeemanalytics","depth":3},{"value":"Parameters","id":"parameters-3","depth":4},{"value":"Returns","id":"returns-3","depth":4},{"value":"Defined in","id":"defined-in-3","depth":4},{"value":"getUserAnalytics","id":"getuseranalytics","depth":3},{"value":"Parameters","id":"parameters-4","depth":4},{"value":"Returns","id":"returns-4","depth":4},{"value":"Defined in","id":"defined-in-4","depth":4},{"value":"getUserRanking","id":"getuserranking","depth":3},{"value":"Parameters","id":"parameters-5","depth":4},{"value":"Returns","id":"returns-5","depth":4},{"value":"Defined in","id":"defined-in-5","depth":4},{"value":"getBusinessRanking","id":"getbusinessranking","depth":3},{"value":"Parameters","id":"parameters-6","depth":4},{"value":"Returns","id":"returns-6","depth":4},{"value":"Defined in","id":"defined-in-6","depth":4},{"value":"getRetentionAnalytics","id":"getretentionanalytics","depth":3},{"value":"Parameters","id":"parameters-7","depth":4},{"value":"Returns","id":"returns-7","depth":4},{"value":"Defined in","id":"defined-in-7","depth":4},{"value":"getTagAnalytics","id":"gettaganalytics","depth":3},{"value":"Parameters","id":"parameters-8","depth":4},{"value":"Returns","id":"returns-8","depth":4},{"value":"Defined in","id":"defined-in-8","depth":4},{"value":"getAnalyticsService","id":"getanalyticsservice","depth":3},{"value":"Returns","id":"returns-9","depth":4},{"value":"Defined in","id":"defined-in-9","depth":4}],"frontmatter":{"seo":{"title":"Class: AnalyticsManager"}},"lastModified":"2026-08-21T18:40:55.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/sdk-reference/classes/analyticsmanager","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}