Skip to content

Commit ecd7e83

Browse files
authored
Merge branch 'main' into analytics-windows-dll-update
2 parents fd814e9 + 52db94f commit ecd7e83

File tree

54 files changed

+394
-142
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+394
-142
lines changed

Android/firebase_dependencies.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ def firebaseDependenciesMap = [
3636
'remote_config' : ['com.google.firebase:firebase-config'],
3737
'storage' : ['com.google.firebase:firebase-storage'],
3838
'testlab' : [],
39-
'ump' : ['com.google.android.ump:user-messaging-platform:3.2.0']
39+
'ump' : ['com.google.android.ump:user-messaging-platform:4.0.0']
4040
]
4141

4242
// A map of library to the gradle resources that they depend upon.
@@ -149,7 +149,7 @@ project.afterEvaluate {
149149

150150
// Add the bill-of-materials
151151
project.dependencies {
152-
implementation platform('com.google.firebase:firebase-bom:34.4.0')
152+
implementation platform('com.google.firebase:firebase-bom:34.6.0')
153153
}
154154
for (String lib : firebaseCpp.dependencies.libSet) {
155155
// Generate and include the proguard file

analytics/integration_test/Podfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ use_frameworks! :linkage => :static
55

66
target 'integration_test' do
77
platform :ios, '15.0'
8-
pod 'Firebase/Analytics', '12.4.0'
8+
pod 'Firebase/Analytics', '12.6.0'
99
end
1010

1111
target 'integration_test_tvos' do
1212
platform :tvos, '15.0'
13-
pod 'Firebase/Analytics', '12.4.0'
13+
pod 'Firebase/Analytics', '12.6.0'
1414
end
1515

1616
post_install do |installer|

analytics/integration_test/src/integration_test.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,18 @@ TEST_F(FirebaseAnalyticsTest, TestLogEventWithComplexParameters) {
324324
sizeof(kViewCartParameters) / sizeof(kViewCartParameters[0]));
325325
}
326326

327+
TEST_F(FirebaseAnalyticsTest, TestSetDefaultEventParameters) {
328+
const std::vector<firebase::analytics::Parameter> kDefaultParameters = {
329+
firebase::analytics::Parameter("default_parameter_double", 123.456),
330+
firebase::analytics::Parameter("default_parameter_int", 4),
331+
firebase::analytics::Parameter("default_parameter_str", "Hello World"),
332+
};
333+
334+
firebase::analytics::SetDefaultEventParameters(kDefaultParameters);
335+
firebase::analytics::LogEvent("default_parameter_event");
336+
firebase::analytics::SetDefaultEventParameters(nullptr, 0);
337+
}
338+
327339
TEST_F(FirebaseAnalyticsTest, TestSetConsent) {
328340
// On Android, this test must be performed at the end, after all the tests for
329341
// session ID and instance ID. This is because once you call SetConsent to

analytics/ios_headers/FIREventNames.h

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2025 Google LLC
22

3-
// Copied from Firebase Analytics iOS SDK 12.4.0.
3+
// Copied from Firebase Analytics iOS SDK 12.6.0.
44

55
/// @file FIREventNames.h
66
///
@@ -151,6 +151,26 @@ static NSString *const kFIREventEarnVirtualCurrency
151151
static NSString *const kFIREventGenerateLead NS_SWIFT_NAME(AnalyticsEventGenerateLead) =
152152
@"generate_lead";
153153

154+
/// In-App Purchase event. This event signifies that extra content or a subscription was purchased
155+
/// by a user inside an app. Note: This is different from the ecommerce purchase event. Note: If you
156+
/// supply the @c AnalyticsParameterValue parameter, you must also supply the
157+
/// @c AnalyticsParameterCurrency parameter so that revenue metrics can be computed accurately.
158+
/// Params:
159+
///
160+
/// <ul>
161+
/// <li>@c AnalyticsParameterCurrency (String)</li>
162+
/// <li>@c AnalyticsParameterFreeTrial (Int) (optional)</li>
163+
/// <li>@c AnalyticsParameterPrice (Double) (optional)</li>
164+
/// <li>@c AnalyticsParameterPriceIsDiscounted (Int) (optional)</li>
165+
/// <li>@c AnalyticsParameterProductID (String) (optional)</li>
166+
/// <li>@c AnalyticsParameterProductName (String) (optional)</li>
167+
/// <li>@c AnalyticsParameterQuantity (Int) (optional)</li>
168+
/// <li>@c AnalyticsParameterSubscription (Int) (optional)</li>
169+
/// <li>@c AnalyticsParameterValue (Double)</li>
170+
/// </ul>
171+
static NSString *const kFIREventInAppPurchase NS_SWIFT_NAME(AnalyticsEventInAppPurchase) =
172+
@"in_app_purchase";
173+
154174
/// Join Group event. Log this event when a user joins a group such as a guild, team or family. Use
155175
/// this event to analyze how popular certain groups or social features are in your app. Params:
156176
///

analytics/ios_headers/FIRParameterNames.h

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2025 Google LLC
22

3-
// Copied from Firebase Analytics iOS SDK 12.4.0.
3+
// Copied from Firebase Analytics iOS SDK 12.6.0.
44

55
/// @file FIRParameterNames.h
66
///
@@ -248,6 +248,17 @@ static NSString *const kFIRParameterExtendSession NS_SWIFT_NAME(AnalyticsParamet
248248
static NSString *const kFIRParameterFlightNumber NS_SWIFT_NAME(AnalyticsParameterFlightNumber) =
249249
@"flight_number";
250250

251+
/// Indicates if the user is on a free trial of a subscription. Specify 1 to indicate true and 0 to
252+
/// indicate false (Int).
253+
/// <pre>
254+
/// let params = [
255+
/// AnalyticsParameterFreeTrial : 1,
256+
/// // ...
257+
/// ]
258+
/// </pre>
259+
static NSString *const kFIRParameterFreeTrial NS_SWIFT_NAME(AnalyticsParameterFreeTrial) =
260+
@"free_trial";
261+
251262
/// Group/clan/guild ID (String).
252263
/// <pre>
253264
/// let params = [
@@ -519,6 +530,37 @@ static NSString *const kFIRParameterPaymentType NS_SWIFT_NAME(AnalyticsParameter
519530
/// </pre>
520531
static NSString *const kFIRParameterPrice NS_SWIFT_NAME(AnalyticsParameterPrice) = @"price";
521532

533+
/// Indicates if an item's price is discounted. Specify 1 to indicate true and 0 to indicate false
534+
/// (Int).
535+
/// <pre>
536+
/// let params = [
537+
/// AnalyticsParameterPriceIsDiscounted : 1,
538+
/// // ...
539+
/// ]
540+
/// </pre>
541+
static NSString *const kFIRParameterPriceIsDiscounted
542+
NS_SWIFT_NAME(AnalyticsParameterPriceIsDiscounted) = @"price_is_discounted";
543+
544+
/// The ID of a product (String).
545+
/// <pre>
546+
/// let params = [
547+
/// AnalyticsParameterProductID : "PROD_12345",
548+
/// // ...
549+
/// ]
550+
/// </pre>
551+
static NSString *const kFIRParameterProductID NS_SWIFT_NAME(AnalyticsParameterProductID) =
552+
@"product_id";
553+
554+
/// The name of a product (String).
555+
/// <pre>
556+
/// let params = [
557+
/// AnalyticsParameterProductName : "My Awesome Product",
558+
/// // ...
559+
/// ]
560+
/// </pre>
561+
static NSString *const kFIRParameterProductName NS_SWIFT_NAME(AnalyticsParameterProductName) =
562+
@"product_name";
563+
522564
/// The ID of a product promotion (String).
523565
/// <pre>
524566
/// let params = [
@@ -646,6 +688,17 @@ static NSString *const kFIRParameterSourcePlatform NS_SWIFT_NAME(AnalyticsParame
646688
static NSString *const kFIRParameterStartDate NS_SWIFT_NAME(AnalyticsParameterStartDate) =
647689
@"start_date";
648690

691+
/// Indicates if the purchase is a subscription. Specify 1 to indicate true and 0 to indicate false
692+
/// (Int).
693+
/// <pre>
694+
/// let params = [
695+
/// AnalyticsParameterSubscription : 1,
696+
/// // ...
697+
/// ]
698+
/// </pre>
699+
static NSString *const kFIRParameterSubscription NS_SWIFT_NAME(AnalyticsParameterSubscription) =
700+
@"subscription";
701+
649702
/// The result of an operation. Specify 1 to indicate success and 0 to indicate failure (Int).
650703
/// <pre>
651704
/// let params = [

analytics/ios_headers/FIRUserPropertyNames.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2025 Google LLC
22

3-
// Copied from Firebase Analytics iOS SDK 12.4.0.
3+
// Copied from Firebase Analytics iOS SDK 12.6.0.
44

55
/// @file FIRUserPropertyNames.h
66
///

analytics/src/analytics_android.cc

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
#include <cstdint>
2121
#include <cstring>
22+
#include <vector>
2223

2324
#include "analytics/src/analytics_common.h"
2425
#include "analytics/src/include/firebase/analytics.h"
@@ -60,7 +61,9 @@ static const ::firebase::App* g_app = nullptr;
6061
"()Lcom/google/android/gms/tasks/Task;"), \
6162
X(GetInstance, "getInstance", "(Landroid/content/Context;)" \
6263
"Lcom/google/firebase/analytics/FirebaseAnalytics;", \
63-
firebase::util::kMethodTypeStatic)
64+
firebase::util::kMethodTypeStatic), \
65+
X(SetDefaultEventParameters, "setDefaultEventParameters", \
66+
"(Landroid/os/Bundle;)V")
6467
// clang-format on
6568

6669
// clang-format off
@@ -340,8 +343,8 @@ void AddToBundle(JNIEnv* env, jobject bundle, const char* key,
340343
void AddToBundle(JNIEnv* env, jobject bundle, const char* key, double value) {
341344
jstring key_string = env->NewStringUTF(key);
342345
env->CallVoidMethod(bundle,
343-
util::bundle::GetMethodId(util::bundle::kPutFloat),
344-
key_string, static_cast<jfloat>(value));
346+
util::bundle::GetMethodId(util::bundle::kPutDouble),
347+
key_string, static_cast<jdouble>(value));
345348
util::CheckAndClearJniExceptions(env);
346349
env->DeleteLocalRef(key_string);
347350
}
@@ -518,6 +521,60 @@ void LogEvent(const char* name, const Parameter* parameters,
518521
});
519522
}
520523

524+
// log an event and the associated parameters via a vector.
525+
void LogEvent(const char* name, const std::vector<Parameter>& parameters) {
526+
LogEvent(name, parameters.data(), parameters.size());
527+
}
528+
529+
// Set the default event parameters.
530+
void SetDefaultEventParameters(const Parameter* parameters,
531+
size_t number_of_parameters) {
532+
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
533+
JNIEnv* env = g_app->GetJNIEnv();
534+
535+
if (!parameters || number_of_parameters == 0) {
536+
env->CallVoidMethod(
537+
g_analytics_class_instance,
538+
analytics::GetMethodId(analytics::kSetDefaultEventParameters), nullptr);
539+
if (util::CheckAndClearJniExceptions(env)) {
540+
LogError("Failed to set default event parameters");
541+
}
542+
return;
543+
}
544+
545+
jobject bundle =
546+
env->NewObject(util::bundle::GetClass(),
547+
util::bundle::GetMethodId(util::bundle::kConstructor));
548+
if (util::CheckAndClearJniExceptions(env) || !bundle) {
549+
LogError("Failed to create bundle for SetDefaultEventParameters.");
550+
if (bundle) env->DeleteLocalRef(bundle);
551+
return;
552+
}
553+
554+
for (size_t i = 0; i < number_of_parameters; ++i) {
555+
const Parameter& parameter = parameters[i];
556+
if (!AddVariantToBundle(env, bundle, parameter.name, parameter.value)) {
557+
// A Variant type that couldn't be handled was passed in.
558+
LogError(
559+
"SetDefaultEventParameters(%s): %s is not a valid parameter value"
560+
" type. Excluded from default parameters.",
561+
parameter.name, Variant::TypeName(parameter.value.type()));
562+
}
563+
}
564+
env->CallVoidMethod(
565+
g_analytics_class_instance,
566+
analytics::GetMethodId(analytics::kSetDefaultEventParameters), bundle);
567+
if (util::CheckAndClearJniExceptions(env)) {
568+
LogError("Failed to set default event parameters");
569+
}
570+
env->DeleteLocalRef(bundle);
571+
}
572+
573+
// Set the default event parameters
574+
void SetDefaultEventParameters(const std::vector<Parameter>& parameters) {
575+
SetDefaultEventParameters(parameters.data(), parameters.size());
576+
}
577+
521578
/// Initiates on-device conversion measurement given a user email address on iOS
522579
/// (no-op on Android). On iOS, requires dependency
523580
/// GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is a

analytics/src/analytics_desktop.cc

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,11 @@ void LogEvent(const char* name, const Parameter* parameters,
318318
// c_event_params if non-null.
319319
}
320320

321+
// log an event and the associated parameters via a vector.
322+
void LogEvent(const char* name, const std::vector<Parameter>& parameters) {
323+
LogEvent(name, parameters.data(), parameters.size());
324+
}
325+
321326
// Sets a user property to the given value.
322327
//
323328
// Up to 25 user property names are supported. Once set, user property values
@@ -480,6 +485,15 @@ void LogEvent(const char* name, const char* parameter_name,
480485

481486
// --- Stub Implementations for Unsupported Features ---
482487

488+
void SetDefaultEventParameters(const Parameter* parameters,
489+
size_t number_of_parameters) {
490+
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
491+
}
492+
493+
void SetDefaultEventParameters(const std::vector<Parameter>& parameters) {
494+
SetDefaultEventParameters(parameters.data(), parameters.size());
495+
}
496+
483497
void SetConsent(const std::map<ConsentType, ConsentStatus>& consent_settings) {
484498
FIREBASE_ASSERT_RETURN_VOID(internal::IsInitialized());
485499

analytics/src/analytics_desktop_dynamic.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,10 @@ static void Stub_GoogleAnalytics_LogEvent(const char* name, GoogleAnalytics_Even
140140
// No return value.
141141
}
142142

143+
static void Stub_GoogleAnalytics_SetDefaultEventParameters(GoogleAnalytics_EventParameters* parameters, size_t number_of_parameters) {
144+
// No return value.
145+
}
146+
143147
// Stub for GoogleAnalytics_SetUserProperty
144148
static void Stub_GoogleAnalytics_SetUserProperty(const char* name,
145149
const char* value) {
@@ -191,6 +195,7 @@ bool (*ptr_GoogleAnalytics_EventParameters_InsertItemVector)(GoogleAnalytics_Eve
191195
void (*ptr_GoogleAnalytics_EventParameters_Destroy)(GoogleAnalytics_EventParameters* event_parameter_map) = &Stub_GoogleAnalytics_EventParameters_Destroy;
192196
bool (*ptr_GoogleAnalytics_Initialize)(GoogleAnalytics_Options* options) = &Stub_GoogleAnalytics_Initialize;
193197
void (*ptr_GoogleAnalytics_LogEvent)(const char* name, GoogleAnalytics_EventParameters* parameters) = &Stub_GoogleAnalytics_LogEvent;
198+
void (*ptr_GoogleAnalytics_SetDefaultEventParameters)(GoogleAnalytics_EventParameters* parameters, size_t number_of_parameters) = &Stub_GoogleAnalytics_SetDefaultEventParameters;
194199
void (*ptr_GoogleAnalytics_SetUserProperty)(const char* name, const char* value) = &Stub_GoogleAnalytics_SetUserProperty;
195200
void (*ptr_GoogleAnalytics_SetUserId)(const char* user_id) = &Stub_GoogleAnalytics_SetUserId;
196201
void (*ptr_GoogleAnalytics_ResetAnalyticsData)() = &Stub_GoogleAnalytics_ResetAnalyticsData;

analytics/src/analytics_desktop_dynamic.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ extern bool (*ptr_GoogleAnalytics_EventParameters_InsertItemVector)(GoogleAnalyt
206206
extern void (*ptr_GoogleAnalytics_EventParameters_Destroy)(GoogleAnalytics_EventParameters* event_parameter_map);
207207
extern bool (*ptr_GoogleAnalytics_Initialize)(GoogleAnalytics_Options* options);
208208
extern void (*ptr_GoogleAnalytics_LogEvent)(const char* name, GoogleAnalytics_EventParameters* parameters);
209+
extern void (*ptr_GoogleAnalytics_SetDefaultEventParameters)(GoogleAnalytics_EventParameters* parameters, size_t number_of_parameters);
209210
extern void (*ptr_GoogleAnalytics_SetUserProperty)(const char* name, const char* value);
210211
extern void (*ptr_GoogleAnalytics_SetUserId)(const char* user_id);
211212
extern void (*ptr_GoogleAnalytics_ResetAnalyticsData)();

0 commit comments

Comments
 (0)