Finished file name tracking
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package controllers
|
package controllers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
@@ -26,7 +27,8 @@ func HandleFileDownload(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send analytics event
|
// Send analytics event
|
||||||
utils.SendAnalyticsEvent("pageview", "/api/download/"+fileID+"/"+filename)
|
properties := fmt.Sprintf(`{"filename": "%s"}`, filename)
|
||||||
|
_ = utils.SendCustomEvent("file_download", "/api/download/"+fileID+"/"+filename, properties)
|
||||||
|
|
||||||
c.Header("Content-Description", "File Transfer")
|
c.Header("Content-Description", "File Transfer")
|
||||||
c.Header("Content-Transfer-Encoding", "binary")
|
c.Header("Content-Transfer-Encoding", "binary")
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package controllers
|
|||||||
import (
|
import (
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@@ -102,7 +103,8 @@ func HandleFileUpload(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Send analytics event
|
// Send analytics event
|
||||||
utils.SendAnalyticsEvent("pageview", "/api/upload")
|
properties := fmt.Sprintf(`{"filename": "%s", "size": %d}`, header.Filename, header.Size)
|
||||||
|
utils.SendCustomEvent("file_upload", "/api/upload", properties)
|
||||||
|
|
||||||
c.JSON(http.StatusOK, gin.H{
|
c.JSON(http.StatusOK, gin.H{
|
||||||
"message": "File uploaded successfully",
|
"message": "File uploaded successfully",
|
||||||
|
|||||||
BIN
dist/fitra-darwin-amd64
vendored
BIN
dist/fitra-darwin-amd64
vendored
Binary file not shown.
BIN
dist/fitra-darwin-arm64
vendored
BIN
dist/fitra-darwin-arm64
vendored
Binary file not shown.
BIN
dist/fitra-linux-amd64
vendored
BIN
dist/fitra-linux-amd64
vendored
Binary file not shown.
BIN
dist/fitra-linux-arm64
vendored
BIN
dist/fitra-linux-arm64
vendored
Binary file not shown.
@@ -49,3 +49,12 @@ func SendAnalyticsEvent(eventType, pathname string) error {
|
|||||||
Pathname: pathname,
|
Pathname: pathname,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func SendCustomEvent(eventName, pathname, properties string) error {
|
||||||
|
return trackEvent(TrackingEvent{
|
||||||
|
Type: "custom_event",
|
||||||
|
Pathname: pathname,
|
||||||
|
EventName: eventName,
|
||||||
|
Properties: properties,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user