React Native Integraiton document
Yieldlove SDK for React Native
- 1 Yieldlove SDK for React Native
- 1.1.1 Release Note (v4.1.0)
- 1.2 Installation
- 1.2.1 Using npm
- 1.2.2 Using yarn
- 1.3 Set-Up
- 1.4 Gravite Set-Up (Optional)
- 1.5 Confiant Set-Up (Optional)
- 1.6 Example Code
- 1.7 Example Code for Gravite (Optional)
- 1.8 Example Code for Confiant (Optional)
- 1.9 Enable ID5
- 1.10 Troubleshooting
As of version 4, the main class name has been renamed to StroeerSDK.
The Yieldlove class is no longer supported.
For more information, please see this document.
Starting from Version 3, all libraries will share the same version number to prevent mismatches and reduce confusion.
Additionally, the SDK configuration has been updated. Please verify that all configurations are correctly set in your project.
Ensure you are using the correct version for all dependencies.
Release Note (v4.1.0)
Added support for IO campaign banners from Ströer.(Android, iOS)
Implemented disableErrorLog. When enabled, Android error messages will be replaced with informational messages. The default value is false.(Android)
Fixed a minor issue related to configuration loading. (Android)
Enhanced debug panel with more detailed information.(iOS)
General bug fixes and stability improvements (iOS)
Installation
Using npm
$ npm install react-native-yieldlove --save
Using yarn
$ yarn add react-native-yieldlove
Set-Up
If you don't want use Cocoapods, you can always link the library manually.
Android
Add our ad-integration SDK into your app's build.gradle file:
allprojects {
repositories {
maven {
url 'https://slabs-yieldlove-ad-integration.s3.eu-central-1.amazonaws.com/android'
content {
includeGroup("com.yieldlove.adIntegration")
}
}
}
}iOS
The package is automatically linked when building the app. All you need to do is:
$ cd ios && pod install
Gravite Set-Up (Optional)
Please reach out to your Ströer Publisher Account Manager to enable the Gravite plugin.
Confiant Set-Up (Optional)
Please contact your Ströer Publisher Account Manager to enable the Confiant plugin.
Example Code
Contact to your account manager to obtain your application name (APPLICATION_NAME) and call strings (INTERSTITIAL_CALL_STRING and BANNER_CALL_STRING). Each call string represents a single slot.
import {
StroeerSDK,
StroeerIdentity
} from 'react-native-yieldlove';
// Initialize SDK first - MUST be called before any other SDK calls
StroeerSDK.setApplicationName(applicationName);
console.log(`[RN] SDK initialized with application: ${applicationName}`);
StroeerSDK.enableDebugMode();
// StroeerSDK.enableInspectionMode(); // This will give more debug information and allows to open the debug information panel
// optional global custom targeting
// Meaning: targeting values set per ad request / per ad unit / per placement.
StroeerSDK.setCustomTargeting({
userAge: ['25'],
userInterest: ['sports', 'technology', 'music'],
userLocation: ['New York'],
});
// Set global context targeting
// Meaning: targeting values applied globally for the whole app/session/user context, and automatically included in all ad requests (or most of them).
// Note: iOS SDK doesn't support context targeting yet
StroeerSDK.setContextTargeting(['sport', 'news']);
// optional for additional user information
// If you add this information using the user information, you may be able to get more expensive ads.
StroeerIdentity.setEmail('freeschool@gmail.com');
StroeerIdentity.setPhone('123456788');
StroeerIdentity.setPuid('123456');
StroeerIdentity.setRegionCode('DE');
StroeerIdentity.setCityCode('Berlin');
StroeerIdentity.apply();
export default function BannerSimpleExample() {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<StroeerBannerAd
publisherSlotName={SLOT}
contentUrl="https://stroeer.de"
customTargeting={{ pos: 'top', test: 'banner' }}
style={{
width: 320,
height: 50, // initial size (native will update it after load)
}}
onAdLoaded={({ width, height, publisherSlotName, source }) => {
console.log(
`[RN] Banner loaded: ${publisherSlotName} -> ${width}x${height} (${source})`
);
}}
onAdFailedToLoad={({ message }) => {
console.log(`[RN] Banner failed: ${message}`);
}}
onAdClicked={() => {
console.log('[RN] Banner clicked');
}}
onAdImpression={() => {
console.log('[RN] Banner impression');
}}
/>
</View>
);
}
Example Code for Gravite (Optional)
Example Code for Confiant (Optional)
Enable ID5
Starting from Version 3, the SDK supports ID5. This feature is disabled by default. To enable it, please contact your Ströer account manager.
You don’t need to make any code changes to use ID5. However, for improved identification, you can provide additional user information to ID5. Please refer to the ID5 website for details.
This information can be added at any time. StroeerSDK automatically checks the provided variables and updates the ID from ID5. However, for optimal identification, we recommend setting this information before SDK initialization, if possible.
To use ID5, the user must provide consent as required by the publisher. Additionally, if the user opts out of ID5 in their privacy settings, the SDK will not use ID5.
StroeerIdentity.setEmail('test@test.com'); //User Email
StroeerIdentity.setPhone('12345656'); //User Phonenumber
StroeerIdentity.setPuid('115352342'); //Publisher User ID
StroeerIdentity.setRegionCode('CA'); //Region Code
StroeerIdentity.setCityCode('MTL'); //City Code
StroeerIdentity.apply(); //Call to apply the updatesCustom Information
CustomInfo is optional, and you are not required to provide all the information.
For RegionalCode, use the ISO-3166-2 standard. If the location is in the USA, specify the 2-letter state code(reference).
For CityCode, use the United Nations Code for Trade & Transport Locations (UN/LOCODE) format (reference).
Troubleshooting
Error: Multiple dependencies with different sources with CocoaPod
Error: Confiant could not block Gravite Banner.
Unfortunately, Confiant doesn’t block the Gravite Banner very well. We are investigating with the Confiant team.
Error: AsyncStroage is null
add dependency in the package.json file
"dependencies": {
"@react-native-async-storage/async-storage": "^1.23.1",
},After adding the dependency, add the following lines in the podfile.
# AsyncStorage - manually added for monorepo setup
pod 'RNCAsyncStorage', :path => '../../node_modules/@react-native-async-storage/async-storage'
My application crashes on start
The Google Mobile Ads SDK may be initialized without an application ID.
Ad Manager
iOS: Update your Info.plist.
Android: Get Started
AdMob
iOS: Update your Info.plist.
Android: Get Started
Package.json
{
"name": "react-native-yieldlove",
"title": "React Native Yieldlove",
"version": "4.1.0",
"description": "Yieldlove SDK bridge for React Native",
"main": "lib/commonjs/index.js",
"module": "lib/module/index.js",
"types": "lib/typescript/src/index.d.ts",
"react-native": "src/index",
"source": "src/index",
"sideEffects": false,
"files": [
"src",
"lib",
"android",
"ios",
"cpp",
"*.podspec",
"!ios/build",
"!android/build",
"!android/gradle",
"!android/gradlew",
"!android/gradlew.bat",
"!android/local.properties",
"!**/__tests__",
"!**/__fixtures__",
"!**/__mocks__",
"!**/.*"
],
"exports": {
".": {
"types": "./lib/typescript/src/index.d.ts",
"react-native": "./src/index.js",
"import": "./lib/module/index.js",
"require": "./lib/commonjs/index.js",
"default": "./lib/module/index.js"
},
"react-native": "./src/index.js"
},
"scripts": {
"example": "yarn workspace react-native-yieldlove-example",
"test": "jest",
"typecheck": "tsc --noEmit",
"lint": "eslint \"**/*.{js,ts,tsx}\"",
"clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
"prepare": "bob build",
"release": "release-it"
},
"keywords": [
"react",
"react-native",
"react native",
"yieldlove",
"ads integration",
"mobile ads",
"ads"
],
"repository": "https://github.com/mbrtargeting/stroeerSDK-react-native",
"author": "Stroeer Media Lab <stroeerlabs@adscale.co.nz>",
"license": "MIT",
"bugs": {
"url": "https://github.com/mbrtargeting/stroeerSDK-react-native/issues"
},
"homepage": "https://github.com/mbrtargeting/stroeerSDK-react-native#readme",
"publishConfig": {
"registry": "https://registry.npmjs.org/"
},
"devDependencies": {
"@babel/core": "^7.28.5",
"@commitlint/config-conventional": "^17.0.2",
"@evilmartians/lefthook": "^1.5.0",
"@react-native-community/cli": "15.0.0",
"@react-native/eslint-config": "^0.80.0",
"@types/jest": "^28.1.2",
"@types/react": "19.1.0",
"commitlint": "^17.0.2",
"del-cli": "^5.0.0",
"eslint": "^8.4.1",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^28.1.1",
"pod-install": "^0.1.0",
"prettier": "^2.0.5",
"react": "19.1.0",
"react-native": "0.80.2",
"react-native-builder-bob": "^0.20.0",
"release-it": "^19.0.6",
"turbo": "^1.10.7",
"typescript": "^5.1.6"
},
"resolutions": {
"@types/react": "19.1.0"
},
"peerDependencies": {
"react": ">=19.1.0",
"react-native": ">=0.80.2"
},
"workspaces": [
"example"
],
"packageManager": "yarn@4.6.0",
"engines": {
"node": ">=20.0.0"
},
"jest": {
"preset": "react-native",
"modulePathIgnorePatterns": [
"<rootDir>/example/node_modules",
"<rootDir>/lib/",
"<rootDir>/Legacy/",
"<rootDir>/example/ios/Pods/",
"<rootDir>/example/android/"
],
"testPathIgnorePatterns": [
"/node_modules/",
"/lib/",
"/Legacy/",
"/example/ios/",
"/example/android/",
"\\.d\\.ts$"
]
},
"commitlint": {
"extends": []
},
"release-it": {
"git": {
"commitMessage": "chore: release ${version}",
"tagName": "v${version}"
},
"npm": {
"publish": true
},
"github": {
"release": false
}
},
"eslintConfig": {
"root": true,
"extends": [
"@react-native"
],
"rules": {
"prettier/prettier": "off",
"@typescript-eslint/no-unused-vars": "off",
"react-hooks/exhaustive-deps": "off"
}
},
"eslintIgnore": [
"node_modules/",
"lib/",
"Legacy/",
"**/build/",
"**/android/**",
"**/ios/**",
"*.js",
"babel.config.js",
"metro.config.js",
"jest.config.js"
],
"prettier": {
"quoteProps": "consistent",
"singleQuote": true,
"tabWidth": 2,
"trailingComma": "es5",
"useTabs": false
},
"react-native-builder-bob": {
"source": "src",
"output": "lib",
"targets": [
"commonjs",
"module",
[
"typescript",
{
"project": "tsconfig.build.json"
}
]
]
}
}