Skip to content

Commit 88346c6

Browse files
Abhi591rohitesh-wingify
authored andcommitted
fix: send usageStats
1 parent 63bbb4b commit 88346c6

File tree

4 files changed

+15
-4
lines changed

4 files changed

+15
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.4.0] - 2025-12-12
9+
10+
### Fixed
11+
12+
- Send `vwo_sdkUsageStats` event when `usageStatsAccountId` is present in settings.
13+
814
## [1.3.0] - 2025-11-06
915

1016
### Added

pkg/constants/constants.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const (
3737

3838
// SDK information
3939
SDKName = "vwo-fme-go-sdk"
40-
SDKVersion = "1.3.0"
40+
SDKVersion = "1.4.0"
4141

4242
// Settings constants
4343
SettingsExpiry = 10000000

pkg/utils/usage_stats_util.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package utils
1818

1919
import (
20+
"fmt"
2021
"runtime"
2122

2223
"github.com/wingify/vwo-fme-go-sdk/pkg/models"
@@ -139,6 +140,8 @@ func SendSDKUsageStatsEvent(
139140
"",
140141
"",
141142
)
143+
// add usage stats account id to the properties
144+
properties["a"] = fmt.Sprintf("%d", usageStatsAccountId)
142145

143146
// Construct payload data for tracking the user
144147
payload := GetSDKUsageStatsEventPayload(

vwo_client.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ func sendInitAndUsageStatsEvents(serviceContainer interfaces.ServiceContainerInt
117117
wasInitializedEarlier = val
118118
}
119119
}
120-
if serviceContainer.GetSettingsManager().GetIsSettingsValidOnInit() && !wasInitializedEarlier {
121-
// Send SDK init event
122-
utils.SendSDKInitEvent(serviceContainer, contextModel, int(settingsFetchTime), int(sdkInitTime))
120+
if serviceContainer.GetSettingsManager().GetIsSettingsValidOnInit() {
121+
if !wasInitializedEarlier {
122+
// Send SDK init event
123+
utils.SendSDKInitEvent(serviceContainer, contextModel, int(settingsFetchTime), int(sdkInitTime))
124+
}
123125

124126
// get usage stats account id
125127
usageStatsAccountId := serviceContainer.GetSettings().GetUsageStatsAccountID()

0 commit comments

Comments
 (0)