Skip to content

Add new Analytics OnDevice Conversion methods #1047

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions analytics/src/swig/analytics.i
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ class ParameterCopy : private firebase::analytics::Parameter {
}
%}

// Mark these as internal, so that we can do the conversion of types manually
%rename(InitiateOnDeviceConversionMeasurementWithHashedEmailAddressInternal) firebase::analytics::InitiateOnDeviceConversionMeasurementWithHashedEmailAddress;
%rename(InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberInternal) firebase::analytics::InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber;

// GetSessionId returns Future<long long> in SWIG.
%include "app/src/swig/future.i"
%SWIG_FUTURE(Future_LongLong, long, internal, long long, FirebaseException)
Expand Down Expand Up @@ -337,6 +341,26 @@ namespace analytics {
}
SetConsentInternal(consentSettingsMap);
}

/// Initiates on-device conversion measurement given a sha256-hashed user email address.
/// Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in, otherwise it is
/// a no-op.
/// @param hashedEmailAddress User email address as a UTF8-encoded string normalized and
/// hashed according to the instructions at
/// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3.
public static void InitiateOnDeviceConversionMeasurementWithHashedEmailAddress(byte[] hashedEmailAddress) {
InitiateOnDeviceConversionMeasurementWithHashedEmailAddressInternal(new CharVector(hashedEmailAddress));
}

/// Initiates on-device conversion measurement given a sha256-hashed phone number in E.164
/// format. Requires dependency GoogleAppMeasurementOnDeviceConversion to be linked in,
/// otherwise it is a no-op.
/// @param hashedPhoneNumber UTF8-encoded user phone number in E.164 format and then hashed
/// according to the instructions at
/// https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3.
public static void InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber(byte[] hashedPhoneNumber) {
InitiateOnDeviceConversionMeasurementWithHashedPhoneNumberInternal(new CharVector(hashedPhoneNumber));
}
%}

} // namespace analytics
Expand Down
6 changes: 6 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ Support

Release Notes
-------------
### Upcoming
- Changes
- Analytics (iOS): Add support for
`InitiateOnDeviceConversionMeasurementWithHashedEmailAddress` and
`InitiateOnDeviceConversionMeasurementWithHashedPhoneNumber`.

### 12.0.0
- Changes
- General: Update to Firebase C++ SDK version 12.0.0.
Expand Down
Loading