14
14
15
15
#include " analytics/src/windows/analytics_windows.h"
16
16
#include " app/src/include/firebase/app.h"
17
- #include " analytics/src/include/firebase/analytics.h" // Path confirmed to remain as is
17
+ #include " analytics/src/include/firebase/analytics.h"
18
18
#include " analytics/src/common/analytics_common.h"
19
19
#include " common/src/include/firebase/variant.h"
20
20
#include " app/src/include/firebase/future.h"
@@ -50,11 +50,6 @@ void Initialize(const App& app) {
50
50
// Terminates the Analytics desktop API.
51
51
// Call this function when Analytics is no longer needed to free up resources.
52
52
void Terminate () {
53
- // The underlying Google Analytics C API for Windows does not have an explicit
54
- // global termination or shutdown function. Resources like event parameter maps
55
- // are managed at the point of their use (e.g., destroyed after logging).
56
- // This function is provided for API consistency with other Firebase platforms
57
- // and for any future global cleanup needs for the desktop wrapper.
58
53
if (g_future_data) {
59
54
delete g_future_data;
60
55
g_future_data = nullptr ;
@@ -94,11 +89,12 @@ static void ConvertParametersToGAParams(
94
89
continue ; // Skip this parameter
95
90
} else if (param.value .is_map ()) {
96
91
// This block handles parameters that are maps.
97
- // Each key-value pair in the map is converted into a GoogleAnalytics_Item,
98
- // and all such items are bundled into a GoogleAnalytics_ItemVector,
99
- // which is then inserted into the event parameters.
100
- // The original map's key becomes the "name" property of the GA_Item,
101
- // and the map's value becomes one of "int_value", "double_value", or "string_value".
92
+ // Each key-value pair from the input map is converted into a distinct GoogleAnalytics_Item.
93
+ // In each such GoogleAnalytics_Item, the original key from the map is used directly
94
+ // as the property key, and the original value (which must be a primitive)
95
+ // is set as the property's value.
96
+ // All these GoogleAnalytics_Items are then bundled into a single
97
+ // GoogleAnalytics_ItemVector, which is associated with the original parameter's name.
102
98
const std::map<std::string, firebase::Variant>& user_map =
103
99
param.value .map_value ();
104
100
if (user_map.empty ()) {
@@ -124,8 +120,6 @@ static void ConvertParametersToGAParams(
124
120
continue ; // Skip this key-value pair, try next one in map
125
121
}
126
122
127
- // Removed: GoogleAnalytics_Item_InsertString(c_item, "name", key_from_map.c_str());
128
-
129
123
bool successfully_set_property = false ;
130
124
if (value_from_map.is_int64 ()) {
131
125
GoogleAnalytics_Item_InsertInt (c_item, key_from_map.c_str (), value_from_map.int64_value ());
@@ -168,7 +162,7 @@ static void ConvertParametersToGAParams(
168
162
169
163
// Logs an event with the given name and parameters.
170
164
void LogEvent (const char * name,
171
- const Parameter* parameters, // firebase::analytics::Parameter
165
+ const Parameter* parameters,
172
166
size_t number_of_parameters) {
173
167
if (name == nullptr || name[0 ] == ' \0 ' ) {
174
168
LogError (" Analytics: Event name cannot be null or empty." );
0 commit comments