Configures AI Chat Session Analytics in Orchard Core with CrestApps modules. Covers session metrics, AI resolution detection, conversion goals, reports, CSV/Excel/PDF exports, feedback ratings, inactivity timeout, and custom analytics reports.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
You are an Orchard Core expert. Generate code, configuration, and recipes for AI chat session analytics and reporting with the CrestApps modules.
CrestApps.OrchardCore.AI.Chat.Analytics (AIConstants.Feature.ChatAnalytics) ships in the CrestApps.OrchardCore.AI.Chat package and depends on CrestApps.OrchardCore.AI.Chat, CrestApps.OrchardCore.AI.Chat.Core and CrestApps.OrchardCore.Reports (enabled with it).AnalyticsMetadata.EnableSessionMetrics) on the Data processing & metrics tab. The analytics fields only appear on Chat profiles.orchardcore-reports) under Reports > Artificial Intelligence Reports. They use the shared date range selector (applied to the session start), open on All time (DefaultDateRange => ReportDefaultDateRange.AllTime), accept a single bound as "on or after" or "on or before", and add an AI profile filter. Extracted Data and Conversion Goals require a profile.CrestApps.OrchardCore.AI.UsageAnalytics), is listed under Reports > Billing & Usage, and is covered by orchardcore-ai-usage-analytics.AIChatAnalyticsReport and filters on AIChatAnalyticsFilter are gone; add your own figures as another report (see below).AIChatSessionEvent documents indexed by AIChatSessionMetricsIndex.{ "steps": [...] } and C# classes are sealed, except view models.{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.AI.Chat",
"CrestApps.OrchardCore.AI.Chat.Analytics",
"CrestApps.OrchardCore.OpenAI"
],
"disable": []
}
]
}
| Report | Class | Route | Permission |
|---|---|---|---|
| AI Chat Session Analytics | AIChatSessionAnalyticsReport | /Admin/Reports/view/ai-chat-session-analytics | ViewChatAnalytics |
| AI Chat Extracted Data | AIChatExtractedDataReport | /Admin/Reports/view/ai-chat-extracted-data | ViewChatAnalytics |
| AI Chat Conversion Goals | AIChatConversionGoalsReport | /Admin/Reports/view/ai-chat-conversion-goals | ViewChatAnalytics |
| Export of these three reports | ExportChatAnalytics (their IReport.ExportPermission) |
Both permissions are granted to the Administrator role. Without Export AI chat analytics (ExportChatAnalytics) the export buttons are hidden, ReportsController.Export refuses, and a report subscription cannot be saved with a file format or attach the file. View AI chat analytics (ViewChatAnalytics) alone also runs and exports the AI usage report.
AI Chat Session Analytics shows these sections, each with a description, a tooltip per figure (ReportMetric.Description) and an empty-state message saying how to start collecting the data: the overview (sessions, unique visitors, containment and abandonment rate, average duration, messages per session, returning users, steps to resolve), sessions by time of day and by day of week (site time zone, 24-hour clock where the culture uses one), who chats (authenticated versus anonymous), performance (latency and average total, input and output tokens per session), resolution and conversion, and feedback.
Exports (CSV, Excel with Reports (OpenXml), PDF with Reports (PDF)) of these three reports are one flat table, the only section in ReportRunMode.Export, with the old invariant CSV columns so parsing scripts keep working:
SessionId,ProfileId,VisitorId,UserId,IsAuthenticated,SessionStartedUtc,SessionEndedUtc,MessageCount,HandleTimeSeconds,IsResolved.SessionStartedUtc,SessionId,TotalPoints, then a column per goal.SessionStartedUtc,SessionId, then a column per extracted field.A report subscription emails the report as it looks on screen and attaches the export from a second run.
{
"steps": [
{
"name": "AIProfile",
"Profiles": [
{
"Name": "support-chat",
"DisplayText": "Support Chat",
"Type": "Chat",
"Properties": {
"AnalyticsMetadata": {
"EnableSessionMetrics": true,
"EnableAIResolutionDetection": true,
"EnableConversionMetrics": true,
"ConversionGoals": [
{
"Name": "issue_resolution",
"Description": "Rate whether the user's primary issue was fully resolved.",
"MinScore": 0,
"MaxScore": 10
}
]
}
},
"Settings": {
"AIProfileDataExtractionSettings": {
"SessionInactivityTimeoutInMinutes": 30
}
}
}
]
}
]
}
EnableAIResolutionDetection defaults to true. It lets an AI review a closed session and mark it resolved even when the user simply stopped chatting.Description is required; MinScore defaults to 0 and MaxScore to 10, and the maximum must exceed the minimum.In code:
profile.Put(new AnalyticsMetadata
{
EnableSessionMetrics = true,
EnableAIResolutionDetection = true,
EnableConversionMetrics = true,
ConversionGoals =
[
new ConversionGoal
{
Name = "issue_resolution",
Description = "Rate whether the user's primary issue was fully resolved.",
MinScore = 0,
MaxScore = 10,
},
],
});
Both are on the same Data processing & metrics tab and come with AI Chat.
{
"steps": [
{
"name": "AIProfile",
"Profiles": [
{
"Name": "support-chat",
"Settings": {
"AIProfileDataExtractionSettings": {
"EnableDataExtraction": true,
"DataExtractionEntries": [
{ "Name": "customer_email", "Description": "The customer's email address.", "AllowMultipleValues": false, "IsUpdatable": true }
]
},
"AIProfilePostSessionSettings": {
"EnablePostSessionProcessing": true,
"PostSessionTasks": [
{
"Name": "disposition",
"Type": "PredefinedOptions",
"Instructions": "Classify the outcome of this conversation.",
"AllowMultipleValues": false,
"Options": [
{ "Value": "Resolved", "Description": "The issue was fully addressed." },
{ "Value": "Escalated", "Description": "The user asked for a human." }
]
},
{
"Name": "summary",
"Type": "Semantic",
"Instructions": "Write a 2-3 sentence summary of the conversation."
}
]
}
}
}
]
}
]
}
PredefinedOptions task needs at least one option with unique values, and enabling processing needs at least one task.Succeeded or Failed, the AI Chat Session Post-Processed workflow event fires (see orchardcore-ai-workflows).ToolNames) are available only during post-session processing.With CrestApps.OrchardCore.AI.Agent also enabled, the tools queryChatSessionMetrics (optional profileId, startDateUtc, endDateUtc), listAIProfiles and viewAIProfile let a profile query analytics. Combine them with generate_chart for charts.
When OrchardCore.DataPipelines.Core is enabled, AI Chat registers the AI chat data source (AIChat) with a Chat sessions data set, and this feature (ChatAnalyticsDataSourcesStartup) adds Chat session metrics (one row per tracked session with usage, feedback and conversion metrics), AI completion usage (one row per metered AI request, with every billed unit and estimated cost), AI voice usage (one row per automated AI voice call summary) and Conversation evaluations, all gated by ViewChatAnalytics. See orchardcore-report-builder.
Custom figures are a report of their own on the Reports framework, not a section of these reports:
using CrestApps.OrchardCore.AI.Chat.Reports;
using CrestApps.OrchardCore.AI.Chat.Services;
using CrestApps.OrchardCore.Reports;
using CrestApps.OrchardCore.Reports.Models;
using OrchardCore.Localization;
using OrchardCore.Security.Permissions;
namespace MyModule.Reports;
public sealed class LongSessionsReport : IReport, IReportFilterMetadata
{
private readonly IAIChatSessionEventReader _reader;
public LongSessionsReport(IAIChatSessionEventReader reader)
{
_reader = reader;
}
public static string Name => "my-long-ai-sessions";
public static LocalizationSource DisplayName { get; } = LocalizationSource.Create<LongSessionsReport>("Long AI chat sessions");
public static LocalizationSource Description { get; } = LocalizationSource.Create<LongSessionsReport>("Sessions with more than 20 messages.");
public static string Category => ReportsConstants.Categories.AIReports;
public static Permission Permission => ChatAnalyticsPermissionProvider.ViewChatAnalytics;
public static ReportDefaultDateRange DefaultDateRange => ReportDefaultDateRange.AllTime;
// Shows the shared AI profile filter (AIChatReportFilters.RequiredProfile makes it required).
public IReadOnlyCollection<string> FilterNames { get; } = [AIChatReportFilters.Profile];
public async Task<ReportDocument> RunAsync(ReportContext context, CancellationToken cancellationToken = default)
{
var range = context.Filter.GetDateRange();
var sessions = await _reader.ListAsync(new AIChatSessionEventQuery
{
ProfileId = context.Filter.GetOrDefault<string>(AIChatReportFilters.ProfileId),
FromUtc = range.FromUtc,
ToUtc = range.ToUtc,
}, cancellationToken);
return new ReportDocument().Add(ReportSection.ForMetrics("Long sessions",
[
new ReportMetric("Sessions", ReportFormat.Number(sessions.Count(session => session.MessageCount > 20))),
]));
}
}
Register it with services.AddReport<LongSessionsReport>() in a startup marked [RequireFeatures(ReportsConstants.Feature)]. IAIChatSessionEventReader and AIChatSessionEventQuery (ProfileId, FromUtc, ToUtc, both bounds nullable) are in CrestApps.OrchardCore.AI.Chat.Services; AIChatReportFilters (Profile, RequiredProfile, ProfileId) is in CrestApps.OrchardCore.AI.Chat.Reports.
Dates a report shows (and its CSV, Excel and PDF exports) are in the local time zone, never UTC: inject Orchard Core's ILocalClock and call ConvertToLocalAsync(DateTime.SpecifyKind(utc, DateTimeKind.Utc)), and group rows by the local day or hour. The built-in Extracted Data and Conversion Goals reports label their column Session started (no longer "(UTC)").
| Service | Role |
|---|---|
IAIChatSessionEventService | Stores session events (DefaultAIChatSessionEventService) |
DefaultAIChatSessionAnalyticsHandler | Records analytics on session events |
AIChatSessionPostCloseProcessor | Resolution, conversion and post-session tasks after close |
IAICompletionUsageService | Completion usage records used by usage analytics |
AIChatAnalyticsFilter.StartDateUtc and EndDateUtc.LocalizationSource; the permission names are unchanged.AI/ChatAnalytics/Index-style routes, AIChatAnalyticsReport and AIChatAnalyticsFilter are gone. Move a DisplayDriver<AIChatAnalyticsReport> section into its own IReport (above); a filter driver becomes a DisplayDriver<ReportFilter> gated by IReportFilterMetadata.What SKILL.md sets; muted values are Claude Code's defaults
/crestapps-orchardcore:orchardcore-ai-chat-analyticsfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job