Skip to content

Commit e8c7cfd

Browse files
authored
fix: analytics no set (#3264)
* fix: analytics no set * fix: add server url to group and identify
1 parent 4535af7 commit e8c7cfd

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

pkg/analytics/posthog/posthog.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,10 @@ func (p *PosthogAnalytics) Start() {
172172
}
173173

174174
func (p *PosthogAnalytics) Identify(userId uuid.UUID, properties analytics.Properties) {
175+
if p.serverURL != "" {
176+
properties["server_url"] = p.serverURL
177+
}
178+
175179
err := (*p.client).Enqueue(posthog.Identify{
176180
DistinctId: analytics.DistinctID(&userId, nil, nil),
177181
Properties: posthog.Properties(properties),
@@ -187,10 +191,14 @@ func (p *PosthogAnalytics) Tenant(tenantId uuid.UUID, data analytics.Properties)
187191
}
188192

189193
func (p *PosthogAnalytics) Group(groupType string, groupKey string, data analytics.Properties) {
194+
if p.serverURL != "" {
195+
data["server_url"] = p.serverURL
196+
}
197+
190198
err := (*p.client).Enqueue(posthog.GroupIdentify{
191199
Type: groupType,
192200
Key: groupKey,
193-
Properties: posthog.Properties{"$set": data},
201+
Properties: posthog.Properties(data),
194202
})
195203
if err != nil {
196204
p.l.Error().Err(err).Str("group_type", groupType).Str("group_key", groupKey).Msg("error enqueuing posthog group identify")

0 commit comments

Comments
 (0)