mbuzz 0.7.3 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +7 -0
- data/lib/mbuzz/version.rb +1 -1
- data/lib/mbuzz.rb +15 -3
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 31940df7a70689cccec128ba1f99498c1fda911604ca48ad9c243584c71ba228
|
|
4
|
+
data.tar.gz: e1b98becc405f8043831645c9ce6ee3010716466e2cd5c960d1ca5ac4a3d875a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 80ca2e08d316b5b06526dc2375ccede006ef8e369c6a796cec73182aacca047f5874eb76e1de7e3612298379e8ebd3cb7cdc75bb45f9f3f8f43b410d5ed4f11b
|
|
7
|
+
data.tar.gz: 0ce7d660c3b17d2fa26ab14acb79c8942cbc4caacc40690b4fe772a7b1fb92d45a4ae59a4dfee32e6836535d930b4b49d2fbb88d72c7f59884e1924347ee14c2
|
data/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.7.4] - 2026-02-17
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **`conversion()` now resolves `user_id` from context** — the `user_id: nil` parameter was shadowing `self.user_id`, preventing the identify → convert flow from working. `event()` was not affected.
|
|
13
|
+
- **`identify()` now stores `user_id` in context** — after a successful API call, `user_id` is written to `Current.user_id` and `request.env` so that subsequent `conversion()` calls in the same request can resolve it.
|
|
14
|
+
|
|
8
15
|
## [0.7.3] - 2026-02-02
|
|
9
16
|
|
|
10
17
|
### Breaking Changes
|
data/lib/mbuzz/version.rb
CHANGED
data/lib/mbuzz.rb
CHANGED
|
@@ -161,13 +161,14 @@ module Mbuzz
|
|
|
161
161
|
#
|
|
162
162
|
def self.conversion(conversion_type, visitor_id: nil, revenue: nil, user_id: nil, is_acquisition: false, inherit_acquisition: false, identifier: nil, **properties)
|
|
163
163
|
resolved_visitor_id = visitor_id || self.visitor_id
|
|
164
|
+
resolved_user_id = user_id || self.user_id
|
|
164
165
|
|
|
165
166
|
# Must have at least one identifier (visitor_id or user_id)
|
|
166
|
-
return false unless resolved_visitor_id ||
|
|
167
|
+
return false unless resolved_visitor_id || resolved_user_id
|
|
167
168
|
|
|
168
169
|
Client.conversion(
|
|
169
170
|
visitor_id: resolved_visitor_id,
|
|
170
|
-
user_id:
|
|
171
|
+
user_id: resolved_user_id,
|
|
171
172
|
conversion_type: conversion_type,
|
|
172
173
|
revenue: revenue,
|
|
173
174
|
is_acquisition: is_acquisition,
|
|
@@ -193,17 +194,28 @@ module Mbuzz
|
|
|
193
194
|
# Mbuzz.identify("user_123", visitor_id: "abc123...", traits: { email: "jane@example.com" })
|
|
194
195
|
#
|
|
195
196
|
def self.identify(user_id, traits: {}, visitor_id: nil)
|
|
196
|
-
Client.identify(
|
|
197
|
+
result = Client.identify(
|
|
197
198
|
user_id: user_id,
|
|
198
199
|
visitor_id: visitor_id || self.visitor_id,
|
|
199
200
|
traits: traits
|
|
200
201
|
)
|
|
202
|
+
|
|
203
|
+
store_user_id_in_context(user_id) if result
|
|
204
|
+
|
|
205
|
+
result
|
|
201
206
|
end
|
|
202
207
|
|
|
203
208
|
# ============================================================================
|
|
204
209
|
# Private Helpers
|
|
205
210
|
# ============================================================================
|
|
206
211
|
|
|
212
|
+
def self.store_user_id_in_context(uid)
|
|
213
|
+
str_id = uid.to_s
|
|
214
|
+
Current.user_id = str_id if defined?(Current)
|
|
215
|
+
RequestContext.current&.request&.env&.[]=(ENV_USER_ID_KEY, str_id)
|
|
216
|
+
end
|
|
217
|
+
private_class_method :store_user_id_in_context
|
|
218
|
+
|
|
207
219
|
def self.enriched_properties(custom_properties)
|
|
208
220
|
return custom_properties unless RequestContext.current
|
|
209
221
|
|