@coursebuilder/analytics 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -32,6 +32,9 @@ interface DatabaseAnalyticsSchema {
32
32
  shortlink: any;
33
33
  shortlinkAttribution: any;
34
34
  shortlinkClick: any;
35
+ questionResponse?: any;
36
+ contactEvent?: any;
37
+ sideEffectIntent?: any;
35
38
  }
36
39
  /**
37
40
  * Creates a database analytics provider that wraps all analytics query
@@ -53,7 +56,9 @@ declare function createDatabaseProvider(db: any, schema: DatabaseAnalyticsSchema
53
56
  getRecentPurchases: (limit?: number, filter?: 'all' | 'team' | 'individual', range?: AnalyticsTimeRange) => Promise<any>;
54
57
  getAttributionSummary: (range?: AnalyticsTimeRange) => Promise<any>;
55
58
  getShortlinkPerformance: (range?: AnalyticsTimeRange) => Promise<any>;
56
- getRevenueBySource: (range?: AnalyticsTimeRange) => Promise<any>;
59
+ getRevenueBySource: (range?: AnalyticsTimeRange, filters?: {
60
+ productId?: string;
61
+ }) => Promise<any>;
57
62
  getConversionFunnel: (range?: AnalyticsTimeRange) => Promise<{
58
63
  totalSignups: any;
59
64
  totalPurchases: any;
@@ -61,14 +66,151 @@ declare function createDatabaseProvider(db: any, schema: DatabaseAnalyticsSchema
61
66
  conversionRate: number;
62
67
  attributionCoverage: number;
63
68
  }>;
64
- getAttributedRevenueSummary: (range?: AnalyticsTimeRange) => Promise<{
69
+ getCommerceLaneSummary: (range?: AnalyticsTimeRange, filters?: {
70
+ productId?: string;
71
+ }) => Promise<{
72
+ commerceRecords: any;
73
+ paidPurchases: any;
74
+ paidRevenue: number;
75
+ accessGrants: any;
76
+ accessGrantRevenue: number;
77
+ freeUpgrades: any;
78
+ syntheticPurchases: any;
79
+ byAccessGrantReason: {
80
+ [k: string]: any;
81
+ };
82
+ }>;
83
+ getAttributedRevenueSummary: (range?: AnalyticsTimeRange, filters?: {
84
+ productId?: string;
85
+ }) => Promise<{
65
86
  totalRevenue: number;
66
87
  attributedRevenue: number;
67
88
  unattributedRevenue: number;
68
89
  attributionRate: number;
69
90
  totalPurchases: any;
91
+ paidPurchases: any;
92
+ purchaseFieldAttributedPurchases: any;
93
+ purchaseFieldAttributedRevenue: number;
94
+ recoveredFromShortlinkAttributionTablePurchases: any;
95
+ recoveredFromShortlinkAttributionTableRevenue: number;
96
+ commerceRecords: any;
97
+ accessGrants: any;
98
+ freeUpgrades: any;
99
+ syntheticPurchases: any;
100
+ commerce: {
101
+ commerceRecords: any;
102
+ paidPurchases: any;
103
+ paidRevenue: number;
104
+ accessGrants: any;
105
+ accessGrantRevenue: number;
106
+ freeUpgrades: any;
107
+ syntheticPurchases: any;
108
+ byAccessGrantReason: {
109
+ [k: string]: any;
110
+ };
111
+ };
112
+ signals: {
113
+ shortlink: any;
114
+ utm: any;
115
+ paidClickId: any;
116
+ gaClientId: any;
117
+ selfReportedSource: any;
118
+ recoveredFromShortlinkAttributionTable: any;
119
+ internalFreeUpgrade: any;
120
+ };
70
121
  }>;
71
122
  getContentPurchaseCorrelation: (range?: AnalyticsTimeRange, limit?: number) => Promise<any>;
123
+ getCheckoutAttributionReceipt: (opts: {
124
+ purchaseId?: string;
125
+ }) => Promise<{
126
+ purchase: null;
127
+ checks: {
128
+ purchaseFound: boolean;
129
+ attributionSnapshot: boolean;
130
+ utm: boolean;
131
+ actualUtm: boolean;
132
+ clickId: boolean;
133
+ synthetic: boolean;
134
+ shortlink: boolean;
135
+ selfReportedSource: boolean;
136
+ gaClientId: boolean;
137
+ };
138
+ attribution: null;
139
+ legacy: {};
140
+ fieldKeys: never[];
141
+ } | {
142
+ purchase: {
143
+ id: any;
144
+ createdAt: any;
145
+ productId: any;
146
+ productName: any;
147
+ totalAmount: number;
148
+ status: any;
149
+ country: any;
150
+ };
151
+ checks: {
152
+ purchaseFound: boolean;
153
+ attributionSnapshot: boolean;
154
+ utm: boolean;
155
+ actualUtm: boolean;
156
+ clickId: boolean;
157
+ synthetic: boolean;
158
+ shortlink: boolean;
159
+ selfReportedSource: boolean;
160
+ gaClientId: boolean;
161
+ };
162
+ attribution: Record<string, any> | null;
163
+ legacy: any;
164
+ fieldKeys: string[];
165
+ }>;
166
+ getCheckoutSurveyFallbackReport: (range?: AnalyticsTimeRange, limit?: number, filters?: {
167
+ productId?: string;
168
+ }) => Promise<{
169
+ label: string;
170
+ productId: string | null;
171
+ totalDarkPurchases: any;
172
+ totalDarkRevenue: any;
173
+ exactPurchaseLinkedPurchases: number;
174
+ exactPurchaseLinkedRevenue: number;
175
+ userLinkedPurchases: number;
176
+ userLinkedRevenue: number;
177
+ byAnswer: {
178
+ answer: string;
179
+ confidence: 'exact_purchase_link' | 'user_linked';
180
+ purchases: number;
181
+ revenue: number;
182
+ }[];
183
+ notes: string[];
184
+ }>;
185
+ getValuePathSummary: (range?: AnalyticsTimeRange) => Promise<{
186
+ contacts: number;
187
+ events: any;
188
+ intents: any;
189
+ completedIntents: any;
190
+ pendingIntents: any;
191
+ blockedIntents: any;
192
+ answerEvents: any;
193
+ dripEvents: any;
194
+ enteredEvents: any;
195
+ participantsWithAnswerClicks: number;
196
+ participantsWithNoAnswerClicks: number;
197
+ terminalParticipants: number;
198
+ answerOptions: {
199
+ key: string;
200
+ step: string;
201
+ optionValue: string;
202
+ count: number;
203
+ }[];
204
+ answerSteps: {
205
+ step: string;
206
+ count: number;
207
+ }[];
208
+ terminalSteps: {
209
+ emailResourceId: string;
210
+ count: number;
211
+ }[];
212
+ notes: string[];
213
+ }>;
72
214
  traceAttribution: (opts: {
73
215
  email?: string;
74
216
  purchaseId?: string;