File tree 2 files changed +24
-3
lines changed
2 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -305,6 +305,26 @@ func serveDevfileStarterProjectWithVersion(c *gin.Context) {
305
305
return
306
306
}
307
307
308
+ // Track event for telemetry. Ignore indirect calls from clients.
309
+ if enableTelemetry && ! util .IsWebClient (c ) && ! util .IsIndirectCall (c ) {
310
+
311
+ user := util .GetUser (c )
312
+ client := util .GetClient (c )
313
+
314
+ err := util .TrackEvent (analytics.Track {
315
+ Event : eventTrackMap ["spdownload" ],
316
+ UserId : user ,
317
+ Context : util .SetContext (c ),
318
+ Properties : analytics .NewProperties ().
319
+ Set ("devfile" , devfileName ).
320
+ Set ("starterProject" , starterProjectName ).
321
+ Set ("client" , client ),
322
+ })
323
+ if err != nil {
324
+ log .Println (err )
325
+ }
326
+ }
327
+
308
328
c .Header ("Content-Disposition" , fmt .Sprintf ("attachment; filename=\" %s.zip\" " , starterProjectName ))
309
329
c .Data (http .StatusAccepted , starterProjectMediaType , downloadBytes )
310
330
}
Original file line number Diff line number Diff line change @@ -41,9 +41,10 @@ import (
41
41
)
42
42
43
43
var eventTrackMap = map [string ]string {
44
- "list" : "list devfile" ,
45
- "view" : "view devfile" ,
46
- "download" : "download devfile" ,
44
+ "list" : "list devfile" ,
45
+ "view" : "view devfile" ,
46
+ "download" : "download devfile" ,
47
+ "spdownload" : "Starter Project Downloaded" ,
47
48
}
48
49
49
50
var mediaTypeMapping = map [string ]string {
You can’t perform that action at this time.
0 commit comments