-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(analytics): initiate on device measurement with sha256-hashed va…
…lues (#7963)
- Loading branch information
Showing
7 changed files
with
245 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -489,6 +489,17 @@ describe('analytics() modular', function () { | |
.analytics() | ||
.initiateOnDeviceConversionMeasurementWithEmailAddress('[email protected]'); | ||
}); | ||
|
||
it('calls native API successfully with hashed email', async function () { | ||
// Normalized email address: '[email protected]' | ||
// echo -n '[email protected]' | shasum -a 256 | ||
|
||
await firebase | ||
.analytics() | ||
.initiateOnDeviceConversionMeasurementWithHashedEmailAddress( | ||
'73914334417d04bc2922331e5fb3b3572ab88debfa0c63beb0c56f7b31d4aaed', | ||
); | ||
}); | ||
}); | ||
|
||
// Test this last so it does not stop delivery to DebugView | ||
|
@@ -499,6 +510,14 @@ describe('analytics() modular', function () { | |
.initiateOnDeviceConversionMeasurementWithPhoneNumber('+14155551212'); | ||
}); | ||
|
||
it('calls native API successfully with hashed phone', async function () { | ||
await firebase | ||
.analytics() | ||
.initiateOnDeviceConversionMeasurementWithHashedPhoneNumber( | ||
'5dce05f429bc23dbd9e2caa03f336b56d4ee2aa374d8708f4f12eb4e10204c2b', | ||
); | ||
}); | ||
|
||
it('handles mal-formatted phone number', async function () { | ||
try { | ||
await firebase | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1755,23 +1755,51 @@ export namespace FirebaseAnalyticsTypes { | |
setDefaultEventParameters(params?: { [key: string]: any }): Promise<void>; | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* | ||
* @platform ios | ||
* @param emailAddress email address, properly formatted complete with domain name e.g, '[email protected]' | ||
*/ | ||
initiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress: string): Promise<void>; | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* You need to pass the sha256-hashed of normalized email address to this function. See [this link](https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials) for more information. | ||
* | ||
* @platform ios | ||
* @param hashedEmailAddress sha256-hashed of normalized email address, properly formatted complete with domain name e.g, '[email protected]' | ||
*/ | ||
initiateOnDeviceConversionMeasurementWithHashedEmailAddress( | ||
hashedEmailAddress: string, | ||
): Poromise<void>; | ||
|
||
/** | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* | ||
* @platform ios | ||
* @param phoneNumber phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces. | ||
*/ | ||
initiateOnDeviceConversionMeasurementWithPhoneNumber(phoneNumber: string): Promise<void>; | ||
|
||
/** | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* You need to pass the sha256-hashed of phone number in E.164 format. See [this link](https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials) for more information. | ||
* | ||
* @platform ios | ||
* @param hashedPhoneNumber sha256-hashed of normalized phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces. | ||
*/ | ||
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber( | ||
hashedPhoneNumber: string, | ||
): Promise<void>; | ||
|
||
/** | ||
* For Consent Mode! | ||
* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1143,6 +1143,7 @@ export function logViewSearchResults( | |
* For Web, the values passed persist on the current page and are passed with all | ||
* subsequent events. | ||
* | ||
* @platform ios | ||
* @param analytics Analytics instance. | ||
* @param params Parameters to be added to the map of parameters added to every event. | ||
*/ | ||
|
@@ -1152,10 +1153,11 @@ export function setDefaultEventParameters( | |
): Promise<void>; | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* | ||
* @platform ios | ||
* @param analytics Analytics instance. | ||
* @param emailAddress email address, properly formatted complete with domain name e.g, '[email protected]' | ||
*/ | ||
|
@@ -1165,10 +1167,26 @@ export function initiateOnDeviceConversionMeasurementWithEmailAddress( | |
): Promise<void>; | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* You need to pass the sha256-hashed of normalized email address to this function. See [this link](https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials) for more information. | ||
* | ||
* @platform ios | ||
* @param analytics Analytics instance. | ||
* @param hashedEmailAddress sha256-hashed of normalized email address, properly formatted complete with domain name e.g, '[email protected]' | ||
*/ | ||
export function initiateOnDeviceConversionMeasurementWithHashedEmailAddress( | ||
analytics: Analytics, | ||
hashedEmailAddress: string, | ||
): Poromise<void>; | ||
|
||
/** | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* | ||
* @platform ios | ||
* @param analytics Analytics instance. | ||
* @param phoneNumber phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces. | ||
*/ | ||
|
@@ -1177,6 +1195,21 @@ export function initiateOnDeviceConversionMeasurementWithPhoneNumber( | |
phoneNumber: string, | ||
): Promise<void>; | ||
|
||
/** | ||
* Start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile. | ||
* You need to pass the sha256-hashed of phone number in E.164 format. See [this link](https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials) for more information. | ||
* | ||
* @platform ios | ||
* @param analytics Analytics instance. | ||
* @param hashedPhoneNumber sha256-hashed of normalized phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces. | ||
*/ | ||
export function initiateOnDeviceConversionMeasurementWithHashedPhoneNumber( | ||
analytics: Analytics, | ||
hashedPhoneNumber: string, | ||
): Promise<void>; | ||
|
||
/** | ||
* Checks four different things. | ||
* 1. Checks if it's not a browser extension environment. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -524,6 +524,22 @@ export function initiateOnDeviceConversionMeasurementWithEmailAddress(analytics, | |
return analytics.initiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress); | ||
} | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile | ||
* | ||
* @param analytics Analytics instance. | ||
* @param hashedEmailAddress sha256-hashed of normalized email address, properly formatted complete with domain name e.g, '[email protected]' | ||
* @link https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials | ||
*/ | ||
export function initiateOnDeviceConversionMeasurementWithHashedEmailAddress( | ||
analytics, | ||
hashedEmailAddress, | ||
) { | ||
return analytics.initiateOnDeviceConversionMeasurementWithHashedEmailAddress(hashedEmailAddress); | ||
} | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
|
@@ -535,6 +551,22 @@ export function initiateOnDeviceConversionMeasurementWithPhoneNumber(analytics, | |
return analytics.initiateOnDeviceConversionMeasurementWithPhoneNumber(phoneNumber); | ||
} | ||
|
||
/** | ||
* start privacy-sensitive on-device conversion management. | ||
* This is iOS-only. | ||
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile | ||
* | ||
* @param analytics Analytics instance. | ||
* @param hashedPhoneNumber sha256-hashed of normalized phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces. | ||
* @link https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials | ||
*/ | ||
export function initiateOnDeviceConversionMeasurementWithHashedPhoneNumber( | ||
analytics, | ||
hashedPhoneNumber, | ||
) { | ||
return analytics.initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(hashedPhoneNumber); | ||
} | ||
|
||
/** | ||
* Checks four different things. | ||
* 1. Checks if it's not a browser extension environment. | ||
|