Skip to content

Commit 6c26a59

Browse files
authored
Add new Analytics OnDevice Conversion methods (#1047)
1 parent 9c928b8 commit 6c26a59

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

analytics/src/swig/analytics.i

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,10 @@ class ParameterCopy : private firebase::analytics::Parameter {
291291
}
292292
%}
293293

294+
// Mark these as internal, so that we can do the conversion of types manually
295+
%rename(InitiateOnDeviceConversionMeasurementWithHashedEmailAddressInternal) firebase::analytics::InitiateOnDeviceConversionMeasurementWithHashedEmailAddress;
296+
%rename(InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberInternal) firebase::analytics::InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber;
297+
294298
// GetSessionId returns Future<long long> in SWIG.
295299
%include "app/src/swig/future.i"
296300
%SWIG_FUTURE(Future_LongLong, long, internal, long long, FirebaseException)
@@ -337,6 +341,26 @@ namespace analytics {
337341
}
338342
SetConsentInternal(consentSettingsMap);
339343
}
344+
345+
/// Initiates on-device conversion measurement given a sha256-hashed user email address.
346+
/// Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is
347+
/// a no-op.
348+
/// @param hashedEmailAddress User email address as a UTF8-encoded string normalized and
349+
/// hashed according to the instructions at
350+
/// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3.
351+
public static void InitiateOnDeviceConversionMeasurementWithHashedEmailAddress(byte[] hashedEmailAddress) {
352+
InitiateOnDeviceConversionMeasurementWithHashedEmailAddressInternal(new CharVector(hashedEmailAddress));
353+
}
354+
355+
/// Initiates on-device conversion measurement given a sha256-hashed phone number in E.164
356+
/// format. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in,
357+
/// otherwise it is a no-op.
358+
/// @param hashedPhoneNumber UTF8-encoded user phone number in E.164 format and then hashed
359+
/// according to the instructions at
360+
/// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3.
361+
public static void InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber(byte[] hashedPhoneNumber) {
362+
InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberInternal(new CharVector(hashedPhoneNumber));
363+
}
340364
%}
341365

342366
} // namespace analytics

docs/readme.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ Support
7171

7272
Release Notes
7373
-------------
74+
### Upcoming
75+
- Changes
76+
- Analytics (iOS): Add support for
77+
`InitiateOnDeviceConversionMeasurementWithHashedEmailAddress` and
78+
`InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber`.
79+
7480
### 12.0.0
7581
- Changes
7682
- General: Update to Firebase C++ SDK version 12.0.0.

0 commit comments

Comments
 (0)