@@ -5,14 +5,18 @@ import (
55 "path/filepath"
66
77 "github.com/ActiveState/cli/internal/analytics/dimensions"
8+ "github.com/ActiveState/cli/internal/config"
9+ "github.com/ActiveState/cli/internal/constants"
810 "github.com/ActiveState/cli/internal/errs"
911 "github.com/ActiveState/cli/internal/fileutils"
1012 "github.com/ActiveState/cli/internal/installation/storage"
1113 "github.com/ActiveState/cli/internal/logging"
14+ configMediator "github.com/ActiveState/cli/internal/mediators/config"
1215)
1316
1417type TestReporter struct {
1518 path string
19+ cfg * config.Instance
1620}
1721
1822const TestReportFilename = "analytics.log"
@@ -23,8 +27,12 @@ func TestReportFilepath() string {
2327 return filepath .Join (appdata , TestReportFilename )
2428}
2529
26- func NewTestReporter (path string ) * TestReporter {
27- return & TestReporter {path }
30+ func NewTestReporter (path string , cfg * config.Instance ) * TestReporter {
31+ reporter := & TestReporter {path , cfg }
32+ configMediator .AddListener (constants .AnalyticsPixelOverrideConfig , func () {
33+ reporter .cfg = cfg
34+ })
35+ return reporter
2836}
2937
3038func (r * TestReporter ) ID () string {
@@ -36,11 +44,13 @@ type TestLogEntry struct {
3644 Action string
3745 Source string
3846 Label string
47+ URL string
3948 Dimensions * dimensions.Values
4049}
4150
4251func (r * TestReporter ) Event (category , action , source , label string , d * dimensions.Values ) error {
43- b , err := json .Marshal (TestLogEntry {category , action , source , label , d })
52+ url := r .cfg .GetString (constants .AnalyticsPixelOverrideConfig )
53+ b , err := json .Marshal (TestLogEntry {category , action , source , label , url , d })
4454 if err != nil {
4555 return errs .Wrap (err , "Could not marshal test log entry" )
4656 }
0 commit comments