feat(adjust): add meta install referrer #277
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why
This PR adds support for the Meta (Facebook) install referrer plugin in the react-native-adjust config plugin. The Meta install referrer is required for tracking Facebook ad campaigns and attribution in React Native apps using the Adjust SDK.
Currently, users need to manually add the
com.adjust.sdk:adjust-android-meta-referrer:5.4.0dependency to their Android build.gradle file when they want to track Meta install referrers. This enhancement allows the config plugin to automatically handle this dependency injection when configured.Reference: https://dev.adjust.com/en/sdk/react-native/plugins/meta-referrer-plugin
How
metaInstallReferrerboolean parameter to the plugin configuration optionsaddAndroidPackagingOptionsfunction to conditionally include the Meta install referrer dependency (com.adjust.sdk:adjust-android-meta-referrer:5.4.0) when the parameter is enabledtargetAndroid12optionwithGradlefunction to pass through the new parameter to the dependency injection logicThe implementation follows the existing code patterns and architecture, ensuring consistency with the current plugin structure.
Test Plan
Manual Testing:
Basic functionality test:
{ "plugins": [ ["@config-plugins/react-native-adjust", { "metaInstallReferrer": true }] ] }npx expo prebuild --cleanandroid/app/build.gradlecontains the Meta install referrer dependencyCombined configuration test:
{ "plugins": [ [ "@config-plugins/react-native-adjust", { "targetAndroid12": true, "metaInstallReferrer": true } ] ] }npx expo prebuild --cleanBackward compatibility test:
{ "plugins": ["@config-plugins/react-native-adjust"] }npx expo prebuild --cleanParameter disabled test:
{ "plugins": [ ["@config-plugins/react-native-adjust", { "metaInstallReferrer": false }] ] }npx expo prebuild --cleanExpected Results:
metaInstallReferrer: true, the generatedandroid/app/build.gradleshould contain:implementation 'com.adjust.sdk:adjust-android-meta-referrer:5.4.0'false, the Meta dependency should not be present