Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit96a04cd

Browse files
authored
Merge pull request#463 from coderoad/feature/analytics
Fix/analytics
2 parentsac33002 +b1ee1cf commit96a04cd

File tree

5 files changed

+36
-17
lines changed

5 files changed

+36
-17
lines changed

‎src/actions/onTutorialConfigNew.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ const onTutorialConfigNew = async (action: T.Action, context: Context): Promise<
1414
constdata:TT.Tutorial=action.payload.tutorial
1515

1616
onEvent('tutorial_start',{
17-
tutorial_id:data.id,
18-
tutorial_version:data.version,
19-
tutorial_title:data.summary.title,
17+
tutorialId:data.id,
18+
tutorialVersion:data.version,
19+
tutorialTitle:data.summary.title,
2020
})
2121

2222
// validate extension version

‎src/services/hooks/index.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ import { loadWatchers, resetWatchers } from './utils/watchers'
55
importopenFilesfrom'./utils/openFiles'
66
importrunCommandsfrom'./utils/runCommands'
77
importrunVSCodeCommandsfrom'./utils/runVSCodeCommands'
8-
import{onErrorastelemetryOnError}from'../telemetry'
8+
import*astelemetryfrom'../telemetry'
99
import{runTest}from'../../actions/onTest'
1010
importloggerfrom'../logger'
11+
import{VERSION}from'../../environment'
1112

1213
// run at the end of when a tutorial is configured
1314
exportconstonInit=async(actions:TT.StepActions):Promise<void>=>{
@@ -50,21 +51,35 @@ export const onReset = async (actions: TT.StepActions): Promise<void> => {
5051

5152
// run when an uncaught exception is thrown
5253
exportconstonError=async(error:Error):Promise<void>=>{
53-
telemetryOnError(error)
54+
telemetry.onError(error)
5455
}
5556

5657
// run when a step task passes
57-
exportconstonStepComplete=async({ levelId, stepId}:{levelId:string;stepId:string}):Promise<void>=>{
58+
exportconstonStepComplete=async({
59+
tutorialId,
60+
levelId,
61+
stepId,
62+
}:{
63+
tutorialId:string
64+
levelId:string
65+
stepId:string
66+
}):Promise<void>=>{
5867
git.saveCommit(`Save progress:${stepId}`)
59-
logger(`ON STEP COMPLETE:${JSON.stringify({ levelId,stepId})}`)
68+
telemetry.onEvent('step_complete',{ tutorialId, stepId, levelId,version:VERSION})
6069
}
6170

6271
// run when a level is complete (all tasks pass or no tasks)
63-
exportconstonLevelComplete=async({ levelId}:{levelId:string}):Promise<void>=>{
64-
logger(`ON LEVEL COMPLETE:${JSON.stringify(levelId)}`)
72+
exportconstonLevelComplete=async({
73+
tutorialId,
74+
levelId,
75+
}:{
76+
tutorialId:string
77+
levelId:string
78+
}):Promise<void>=>{
79+
telemetry.onEvent('level_complete',{ tutorialId, levelId,version:VERSION})
6580
}
6681

6782
// run when all levels are complete
6883
exportconstonTutorialComplete=async({ tutorialId}:{tutorialId:string}):Promise<void>=>{
69-
logger(`ON TUTORIAL COMPLETE:${JSON.stringify(tutorialId)}`)
84+
telemetry.onEvent('tutorial_complete',{ tutorialId,version:VERSION})
7085
}

‎src/services/telemetry/index.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
importTelemetryReporterfrom'vscode-extension-telemetry'
2-
import{EXTENSION_ID,VERSION,INSTRUMENTATION_KEY,NODE_ENV}from'../../environment'
2+
import{EXTENSION_ID,VERSION,INSTRUMENTATION_KEY}from'../../environment'
3+
importloggerfrom'../logger'
34

45
/**
56
* Telemetry
@@ -18,10 +19,9 @@ interface Measurements {
1819
letreporter:any
1920

2021
exportconstactivate=(subscribeFn:(reporter:any)=>void):void=>{
21-
if(NODE_ENV==='production'){
22-
reporter=newTelemetryReporter(EXTENSION_ID,VERSION,INSTRUMENTATION_KEY)
23-
subscribeFn(reporter)
24-
}
22+
logger(EXTENSION_ID,VERSION,INSTRUMENTATION_KEY)
23+
reporter=newTelemetryReporter(EXTENSION_ID,VERSION,INSTRUMENTATION_KEY)
24+
subscribeFn(reporter)
2525
}
2626

2727
exportconstdeactivate=():void=>{
@@ -31,12 +31,14 @@ export const deactivate = (): void => {
3131
}
3232

3333
exportconstonError=(error:Error,properties?:Properties,measurements?:Measurements):void=>{
34+
logger(error,properties,measurements)
3435
if(reporter){
3536
reporter.sendTelemetryException(error,properties,measurements)
3637
}
3738
}
3839

3940
exportconstonEvent=(eventName:string,properties?:Properties,measurements?:Measurements):void=>{
41+
logger(eventName,properties,measurements)
4042
if(reporter){
4143
reporter.sendTelemetryEvent(eventName,properties,measurements)
4244
}

‎web-app/src/services/state/actions/editor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export default (editorSend: any) => ({
137137
editorSend({
138138
type:'EDITOR_STEP_COMPLETE',
139139
payload:{
140+
tutorialId:context.tutorial?.id||'',
140141
levelId:context.position.levelId,
141142
stepId:context.position.stepId,
142143
},
@@ -146,6 +147,7 @@ export default (editorSend: any) => ({
146147
editorSend({
147148
type:'EDITOR_LEVEL_COMPLETE',
148149
payload:{
150+
tutorialId:context.tutorial?.id||'',
149151
levelId:context.position.levelId,
150152
},
151153
})
@@ -154,7 +156,7 @@ export default (editorSend: any) => ({
154156
editorSend({
155157
type:'EDITOR_TUTORIAL_COMPLETE',
156158
payload:{
157-
tutorialId:context.tutorial?.id,
159+
tutorialId:context.tutorial?.id||'',
158160
},
159161
})
160162
},

‎web-app/src/services/state/machine.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ export const createMachine = (options: any) => {
199199
},
200200
LEVEL_COMPLETE:{
201201
target:'LevelComplete',
202-
actions:['onLevelComplete'],
203202
},
204203
},
205204
},
206205
LevelComplete:{
206+
onEntry:['onLevelComplete'],
207207
onExit:['testClear','incrementLevel'],
208208
on:{
209209
NEXT_LEVEL:'LoadNext',

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp