@thealteroffice/react-native-adgeist 0.0.19 → 0.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Adgeist.podspec +1 -1
- package/README.md +70 -521
- package/android/build.gradle +6 -3
- package/android/generated/java/com/adgeist/NativeAdgeistSpec.java +11 -11
- package/android/generated/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerDelegate.java +55 -0
- package/android/generated/java/com/facebook/react/viewmanagers/HTML5AdNativeComponentManagerInterface.java +24 -0
- package/android/generated/jni/RNAdgeistSpec-generated.cpp +12 -12
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.cpp +22 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ComponentDescriptors.h +24 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.cpp +60 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/EventEmitters.h +49 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/Props.cpp +28 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/Props.h +52 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +14 -22
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +36 -36
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.cpp +17 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/ShadowNodes.h +32 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/States.cpp +16 -0
- package/android/generated/jni/react/renderer/components/RNAdgeistSpec/States.h +29 -0
- package/android/src/main/java/com/adgeist/AdgeistPackage.kt +8 -7
- package/android/src/main/java/com/adgeist/components/HTML5AdViewManagerImpl.kt +125 -0
- package/android/src/main/java/com/adgeist/modules/AdgeistImpl.kt +114 -0
- package/android/src/main/java/com/adgeist/utils/CreativeExtensions.kt +151 -0
- package/android/src/newarch/java/com/Adgeist.kt +119 -0
- package/android/src/newarch/java/com/HTML5AdViewManager.kt +77 -0
- package/android/src/oldarch/java/com/Adgeist.kt +132 -0
- package/android/src/oldarch/java/com/HTML5AdViewManager.kt +63 -0
- package/ios/Adgeist-Bridging-Header.h +3 -0
- package/ios/Adgeist.h +1 -1
- package/ios/Adgeist.mm +154 -38
- package/ios/AdgeistImpl.swift +188 -53
- package/ios/NativeHTML5AdManager.h +9 -0
- package/ios/NativeHTML5AdManager.mm +178 -0
- package/ios/NativeHTML5AdView.swift +136 -0
- package/ios/generated/RNAdgeistSpec/ComponentDescriptors.cpp +22 -0
- package/ios/generated/RNAdgeistSpec/ComponentDescriptors.h +24 -0
- package/ios/generated/RNAdgeistSpec/EventEmitters.cpp +60 -0
- package/ios/generated/RNAdgeistSpec/EventEmitters.h +49 -0
- package/ios/generated/RNAdgeistSpec/Props.cpp +28 -0
- package/ios/generated/RNAdgeistSpec/Props.h +52 -0
- package/ios/generated/RNAdgeistSpec/RCTComponentViewHelpers.h +65 -0
- package/ios/generated/RNAdgeistSpec/RNAdgeistSpec-generated.mm +17 -17
- package/ios/generated/RNAdgeistSpec/RNAdgeistSpec.h +17 -25
- package/ios/generated/RNAdgeistSpec/ShadowNodes.cpp +17 -0
- package/ios/generated/RNAdgeistSpec/ShadowNodes.h +32 -0
- package/ios/generated/RNAdgeistSpec/States.cpp +16 -0
- package/ios/generated/RNAdgeistSpec/States.h +29 -0
- package/ios/generated/RNAdgeistSpecJSI-generated.cpp +14 -22
- package/ios/generated/RNAdgeistSpecJSI.h +36 -36
- package/lib/module/cdpclient/index.js +1 -25
- package/lib/module/cdpclient/index.js.map +1 -1
- package/lib/module/components/HTML5AdView.js +128 -0
- package/lib/module/components/HTML5AdView.js.map +1 -0
- package/lib/module/components/{BannerAd.js → deprecated/BannerAdView.js} +50 -79
- package/lib/module/components/deprecated/BannerAdView.js.map +1 -0
- package/lib/module/components/{ConsentModal.js → deprecated/ConsentModal.js} +2 -2
- package/lib/module/components/deprecated/ConsentModal.js.map +1 -0
- package/lib/module/constants.js +14 -0
- package/lib/module/constants.js.map +1 -0
- package/lib/module/index.js +3 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/{components → providers}/AdgeistProvider.js +10 -35
- package/lib/module/providers/AdgeistProvider.js.map +1 -0
- package/lib/module/specs/HTML5AdNativeComponent.ts +46 -0
- package/lib/module/specs/NativeAdgeist.js.map +1 -0
- package/lib/module/types/AdSize.js +2 -0
- package/lib/module/types/AdSize.js.map +1 -0
- package/lib/module/types/CPMAdResponse.js +2 -0
- package/lib/module/types/CPMAdResponse.js.map +1 -0
- package/lib/module/types/FixedAdResponse.js +2 -0
- package/lib/module/types/FixedAdResponse.js.map +1 -0
- package/lib/module/types/HTML5AdNativeComponentProps.js +4 -0
- package/lib/module/types/HTML5AdNativeComponentProps.js.map +1 -0
- package/lib/module/types/Provider.js +2 -0
- package/lib/module/types/Provider.js.map +1 -0
- package/lib/typescript/src/cdpclient/index.d.ts +1 -21
- package/lib/typescript/src/cdpclient/index.d.ts.map +1 -1
- package/lib/typescript/src/components/HTML5AdView.d.ts +3 -0
- package/lib/typescript/src/components/HTML5AdView.d.ts.map +1 -0
- package/lib/typescript/src/components/deprecated/BannerAdView.d.ts +17 -0
- package/lib/typescript/src/components/deprecated/BannerAdView.d.ts.map +1 -0
- package/lib/typescript/src/components/deprecated/ConsentModal.d.ts.map +1 -0
- package/lib/typescript/src/constants.d.ts +10 -0
- package/lib/typescript/src/constants.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/providers/AdgeistProvider.d.ts +9 -0
- package/lib/typescript/src/providers/AdgeistProvider.d.ts.map +1 -0
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts +29 -0
- package/lib/typescript/src/specs/HTML5AdNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAdgeist.d.ts +28 -0
- package/lib/typescript/src/specs/NativeAdgeist.d.ts.map +1 -0
- package/lib/typescript/src/types/AdSize.d.ts +5 -0
- package/lib/typescript/src/types/AdSize.d.ts.map +1 -0
- package/lib/typescript/src/types/CPMAdResponse.d.ts +25 -0
- package/lib/typescript/src/types/CPMAdResponse.d.ts.map +1 -0
- package/lib/typescript/src/types/FixedAdResponse.d.ts +50 -0
- package/lib/typescript/src/types/FixedAdResponse.d.ts.map +1 -0
- package/lib/typescript/src/types/HTML5AdNativeComponentProps.d.ts +24 -0
- package/lib/typescript/src/types/HTML5AdNativeComponentProps.d.ts.map +1 -0
- package/lib/typescript/src/types/Provider.d.ts +16 -0
- package/lib/typescript/src/types/Provider.d.ts.map +1 -0
- package/package.json +8 -3
- package/plugin/build/android/withRNAdgeistMainApplication.d.ts +3 -0
- package/plugin/build/android/withRNAdgeistMainApplication.js +65 -0
- package/plugin/build/index.d.ts +3 -0
- package/plugin/build/index.js +25 -0
- package/plugin/build/ios/withRNAdgeistAppDelegate.d.ts +4 -0
- package/plugin/build/ios/withRNAdgeistAppDelegate.js +66 -0
- package/react-native.config.js +1 -1
- package/src/cdpclient/index.ts +1 -21
- package/src/components/HTML5AdView.tsx +161 -0
- package/src/components/{BannerAd.tsx → deprecated/BannerAdView.tsx} +80 -115
- package/src/components/{ConsentModal.tsx → deprecated/ConsentModal.tsx} +2 -2
- package/src/constants.ts +8 -0
- package/src/index.tsx +4 -2
- package/src/{components → providers}/AdgeistProvider.tsx +26 -60
- package/src/specs/HTML5AdNativeComponent.ts +46 -0
- package/src/{NativeAdgeist.ts → specs/NativeAdgeist.ts} +26 -25
- package/src/types/AdSize.ts +4 -0
- package/src/types/CPMAdResponse.ts +26 -0
- package/src/types/FixedAdResponse.ts +51 -0
- package/src/types/HTML5AdNativeComponentProps.ts +28 -0
- package/src/types/Provider.ts +16 -0
- package/android/src/main/AndroidManifestNew.xml +0 -2
- package/android/src/main/java/com/adgeist/implementation/AdgeistModuleImpl.kt +0 -252
- package/android/src/newarch/java/com/AdgeistModule.kt +0 -135
- package/android/src/oldarch/java/com/AdgeistModule.kt +0 -148
- package/ios/adgeist-Bridging-Header.h +0 -1
- package/lib/module/NativeAdgeist.js.map +0 -1
- package/lib/module/components/AdgeistProvider.js.map +0 -1
- package/lib/module/components/BannerAd.js.map +0 -1
- package/lib/module/components/ConsentModal.js.map +0 -1
- package/lib/typescript/src/NativeAdgeist.d.ts +0 -28
- package/lib/typescript/src/NativeAdgeist.d.ts.map +0 -1
- package/lib/typescript/src/components/AdgeistProvider.d.ts +0 -50
- package/lib/typescript/src/components/AdgeistProvider.d.ts.map +0 -1
- package/lib/typescript/src/components/BannerAd.d.ts +0 -64
- package/lib/typescript/src/components/BannerAd.d.ts.map +0 -1
- package/lib/typescript/src/components/ConsentModal.d.ts.map +0 -1
- /package/lib/module/{NativeAdgeist.js → specs/NativeAdgeist.js} +0 -0
- /package/lib/typescript/src/components/{ConsentModal.d.ts → deprecated/ConsentModal.d.ts} +0 -0
package/Adgeist.podspec
CHANGED
|
@@ -16,7 +16,7 @@ Pod::Spec.new do |s|
|
|
|
16
16
|
s.source_files = "ios/**/*.{h,m,mm,cpp,swift}"
|
|
17
17
|
s.private_header_files = "ios/**/*.h"
|
|
18
18
|
|
|
19
|
-
s.dependency "AdgeistKit", '=
|
|
19
|
+
s.dependency "AdgeistKit", '= 1.0.1-qa'
|
|
20
20
|
|
|
21
21
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
22
22
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
package/README.md
CHANGED
|
@@ -4,23 +4,24 @@
|
|
|
4
4
|
|
|
5
5
|
# @thealteroffice/react-native-adgeist
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Integrating Adgeist Mobile Ads SDK into an app is the first step toward displaying ads and earning revenue. Once you've integrated the SDK, you can choose an ad format (such as banner or display) and follow the steps to implement it.
|
|
8
8
|
|
|
9
|
-
##
|
|
9
|
+
## Before you begin
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
- ✅ **Modern Architecture**: Support for both legacy and new React Native architectures
|
|
13
|
-
- ✅ **TurboModule**: Enhanced performance with TurboModule implementation
|
|
14
|
-
- ✅ **TypeScript**: Full TypeScript support with type definitions
|
|
15
|
-
- ✅ **Expo Compatible**: Config plugin for seamless Expo integration
|
|
16
|
-
- ✅ **Analytics**: Built-in impression and click tracking
|
|
17
|
-
- ✅ **Customizable**: Flexible ad display options
|
|
18
|
-
- ✅ **Consent Management**: Support for user consent collection for personalized ads
|
|
19
|
-
- ✅ **User Data Platform**: Built-in CDP client for user data and event tracking
|
|
11
|
+
To prepare your app, complete the steps in the following sections.
|
|
20
12
|
|
|
21
|
-
|
|
13
|
+
### App prerequisites
|
|
22
14
|
|
|
23
|
-
|
|
15
|
+
Make sure that your app's build file uses the following values:
|
|
16
|
+
|
|
17
|
+
- Minimum SDK version of 24 or higher
|
|
18
|
+
- Compile SDK version of 35 or higher
|
|
19
|
+
|
|
20
|
+
## Configure your app
|
|
21
|
+
|
|
22
|
+
### STEP 1: Initiate the Installation Process for the SDK
|
|
23
|
+
|
|
24
|
+
Install the Adgeist SDK in your React Native project using npm or yarn. This step sets up the necessary package for ad integration.
|
|
24
25
|
|
|
25
26
|
```bash
|
|
26
27
|
npm install @thealteroffice/react-native-adgeist
|
|
@@ -28,549 +29,97 @@ npm install @thealteroffice/react-native-adgeist
|
|
|
28
29
|
yarn add @thealteroffice/react-native-adgeist
|
|
29
30
|
```
|
|
30
31
|
|
|
31
|
-
|
|
32
|
+
### Android Configuration
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
cd ios && pod install
|
|
35
|
-
```
|
|
34
|
+
Add your Adgeist publisher ID, api key and package id, as identified in the Adgeist web interface, to your app's `AndroidManifest.xml` file. To do so, add a `<meta-data>` tag with `android:name="com.adgeistkit.ads.ADGEIST_APP_ID"`, `android:name="com.adgeistkit.ads.ADGEIST_API_KEY"`, and `android:name="com.adgeistkit.ads.ADGEIST_CUSTOM_PACKAGE_OR_BUNDLE_ID"`.
|
|
36
35
|
|
|
37
|
-
|
|
36
|
+
You can find your app ID in the Adgeist web interface. For `android:value`, insert your own Adgeist publisher ID, surrounded by quotation marks.
|
|
38
37
|
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
38
|
+
```xml
|
|
39
|
+
<manifest>
|
|
40
|
+
<application>
|
|
41
|
+
<!-- Sample Adgeist app ID: 69326f9fbb280f9241cabc94 -->
|
|
42
|
+
<!-- Sample Adgeist api key: b4e33bb73061d4e33670f229033f14bf770d35b15512dc1f106529e38946e49c -->
|
|
43
|
+
<!-- Sample Adgeist package id: https://adgeist-ad-integration.d49kd6luw1c4m.amplifyapp.com -->
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
<meta-data
|
|
46
|
+
android:name="com.adgeistkit.ads.ADGEIST_APP_ID"
|
|
47
|
+
android:value="ADGEIST_APP_ID"/>
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
<meta-data
|
|
50
|
+
android:name="com.adgeistkit.ads.ADGEIST_API_KEY"
|
|
51
|
+
android:value="ADGEIST_API_KEY"/>
|
|
50
52
|
|
|
51
|
-
|
|
53
|
+
<meta-data
|
|
54
|
+
android:name="com.adgeistkit.ads.ADGEIST_CUSTOM_PACKAGE_OR_BUNDLE_ID"
|
|
55
|
+
android:value="ADGEIST_CUSTOM_PACKAGE_OR_BUNDLE_ID"/>
|
|
56
|
+
</application>
|
|
57
|
+
</manifest>
|
|
58
|
+
```
|
|
52
59
|
|
|
53
|
-
|
|
60
|
+
Replace `ADGEIST_APP_ID`, `ADGEIST_API_KEY`, `ADGEIST_CUSTOM_PACKAGE_OR_BUNDLE_ID` with your Adgeist IDs.
|
|
54
61
|
|
|
55
|
-
###
|
|
62
|
+
### iOS Configuration
|
|
56
63
|
|
|
57
|
-
|
|
64
|
+
#### CocoaPods
|
|
58
65
|
|
|
59
|
-
|
|
66
|
+
Before you continue, review Using CocoaPods for information on creating and using Podfiles.
|
|
60
67
|
|
|
61
|
-
|
|
68
|
+
To use CocoaPods, follow these steps:
|
|
62
69
|
|
|
63
|
-
|
|
64
|
-
- **If your app does not have `react-native-video` installed**: Please install it manually:
|
|
70
|
+
In a terminal, run:
|
|
65
71
|
|
|
66
72
|
```bash
|
|
67
|
-
|
|
73
|
+
cd ios && pod install --repo-update
|
|
68
74
|
```
|
|
69
75
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
yarn add react-native-video@^4.5.2
|
|
74
|
-
```
|
|
76
|
+
#### Update your Info.plist
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
Update your app's `Info.plist` file to add three keys:
|
|
77
79
|
|
|
78
|
-
|
|
80
|
+
A `ADGEIST_APP_ID`, `ADGEIST_API_KEY`, `ADGEIST_CUSTOM_PACKAGE_OR_BUNDLE_ID` key with a string value of your Adgeist IDs found in the Adgeist UI.
|
|
79
81
|
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
+
```xml
|
|
83
|
+
<key>ADGEIST_API_KEY</key>
|
|
84
|
+
<string>e31edf10067897a3904b64b6a4b5f18b1260470183ae203cc521b0479166d597</string>
|
|
85
|
+
<key>ADGEIST_APP_ID</key>
|
|
86
|
+
<string>69326f9fbb280f9241cabc94</string>
|
|
87
|
+
<key>ADGEIST_CUSTOM_PACKAGE_OR_BUNDLE_ID</key>
|
|
88
|
+
<string>https://adgeist-ad-integration.d49kd6luw1c4m.amplifyapp.com/</string>
|
|
82
89
|
```
|
|
83
90
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
Adding `react-native-video` to dependencies directly in this library would:
|
|
87
|
-
|
|
88
|
-
- ❌ Cause duplicate native module linking
|
|
89
|
-
- ❌ Lead to iOS/Android build failures
|
|
90
|
-
- ❌ Break compatibility with apps already using `react-native-video`
|
|
91
|
+
## Perform the Configuration of AdgeistProvider
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
| Package | Install It? | Why? |
|
|
95
|
-
| -------------------- | --------------------- | ------------------------------------------------------------------ |
|
|
96
|
-
| `react-native-video` | ✅ **Yes (required)** | Your app must install this manually to satisfy the peer dependency |
|
|
97
|
-
|
|
98
|
-
## 🔧 Setup & Configuration
|
|
99
|
-
|
|
100
|
-
### Basic Setup
|
|
101
|
-
|
|
102
|
-
Wrap your app with `AdgeistProvider` to configure global settings:
|
|
93
|
+
Add an `AdgeistProvider` at the root level of your app.
|
|
103
94
|
|
|
104
95
|
```tsx
|
|
105
|
-
import
|
|
106
|
-
import {
|
|
107
|
-
AdgeistProvider,
|
|
108
|
-
BannerAd,
|
|
109
|
-
} from '@thealteroffice/react-native-adgeist';
|
|
96
|
+
import { AdgeistProvider } from '@thealteroffice/react-native-adgeist';
|
|
110
97
|
|
|
111
98
|
export default function App() {
|
|
112
99
|
return (
|
|
113
|
-
<AdgeistProvider
|
|
114
|
-
|
|
115
|
-
apiKey="your-api-key"
|
|
116
|
-
domain="your-domain"
|
|
117
|
-
isTestEnvironment={false}
|
|
118
|
-
>
|
|
119
|
-
<YourAppContent />
|
|
100
|
+
<AdgeistProvider isTestEnvironment={false}>
|
|
101
|
+
{/* Your app content */}
|
|
120
102
|
</AdgeistProvider>
|
|
121
103
|
);
|
|
122
104
|
}
|
|
123
105
|
```
|
|
124
106
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
Set `isTestEnvironment` based on your app's environment:
|
|
128
|
-
|
|
129
|
-
```tsx
|
|
130
|
-
const isTestMode = __DEV__ || process.env.NODE_ENV === 'development';
|
|
131
|
-
|
|
132
|
-
<AdgeistProvider
|
|
133
|
-
publisherId="your-publisher-id"
|
|
134
|
-
apiKey="your-api-key"
|
|
135
|
-
domain="your-domain"
|
|
136
|
-
isTestEnvironment={isTestMode}
|
|
137
|
-
>
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
## 🛡️ Consent Management for Personalized Ads
|
|
141
|
-
|
|
142
|
-
To deliver personalized ads, user data and events must be collected and sent to the AdGeist CDP platform. This requires obtaining user consent. You can use your own Consent Management Platform (CMP) or the SDK's built-in CMP.
|
|
143
|
-
|
|
144
|
-
### Using Your Own CMP
|
|
145
|
-
|
|
146
|
-
If you use your own CMP, update the consent status in the SDK by calling `updateConsentStatus(boolean)`:
|
|
147
|
-
|
|
148
|
-
```tsx
|
|
149
|
-
import { updateConsentStatus } from '@thealteroffice/react-native-adgeist/src/cdpclient';
|
|
150
|
-
|
|
151
|
-
const updateConsent = async (hasConsent: boolean) => {
|
|
152
|
-
updateConsentStatus(hasConsent);
|
|
153
|
-
};
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
### Using SDK's Built-in CMP
|
|
157
|
-
|
|
158
|
-
To use the SDK's Consent Management Platform, check the consent status with `getConsentStatus` and display the consent modal if needed:
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
import React, { useEffect } from 'react';
|
|
162
|
-
import { useAdgeistContext } from '@thealteroffice/react-native-adgeist';
|
|
163
|
-
import { getConsentStatus } from '@thealteroffice/react-native-adgeist/src/cdpclient';
|
|
164
|
-
|
|
165
|
-
function ConsentHandler() {
|
|
166
|
-
const { setAdgeistConsentModal } = useAdgeistContext();
|
|
167
|
-
|
|
168
|
-
useEffect(() => {
|
|
169
|
-
(async () => {
|
|
170
|
-
const consentStatus = await getConsentStatus();
|
|
171
|
-
if (consentStatus === 'DENIED') {
|
|
172
|
-
setAdgeistConsentModal(true);
|
|
173
|
-
}
|
|
174
|
-
})();
|
|
175
|
-
}, [setAdgeistConsentModal]);
|
|
176
|
-
|
|
177
|
-
return null;
|
|
178
|
-
}
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
The SDK will display a popup to collect user consent when `setAdgeistConsentModal(true)` is called.
|
|
182
|
-
|
|
183
|
-
### User Data and Event Tracking
|
|
184
|
-
|
|
185
|
-
#### Log Events
|
|
186
|
-
|
|
187
|
-
Use `logEvent` to store user interaction details for analytics:
|
|
188
|
-
|
|
189
|
-
```tsx
|
|
190
|
-
import { logEvent } from '@thealteroffice/react-native-adgeist/src/cdpclient';
|
|
191
|
-
|
|
192
|
-
const logUserEvent = async (
|
|
193
|
-
eventType: string,
|
|
194
|
-
eventProperties: Record<string, any>
|
|
195
|
-
) => {
|
|
196
|
-
await logEvent({
|
|
197
|
-
eventType,
|
|
198
|
-
eventProperties,
|
|
199
|
-
});
|
|
200
|
-
};
|
|
201
|
-
|
|
202
|
-
// Example usage
|
|
203
|
-
await logUserEvent('product_view', {
|
|
204
|
-
productId: '12345',
|
|
205
|
-
category: 'electronics',
|
|
206
|
-
price: 299.99,
|
|
207
|
-
});
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
#### Set User Details
|
|
211
|
-
|
|
212
|
-
After user login, send user details using `setUserDetails` to associate the entire session lifecycle with the user. These details will be included with all events:
|
|
213
|
-
|
|
214
|
-
```tsx
|
|
215
|
-
import { setUserDetails } from '@thealteroffice/react-native-adgeist/src/cdpclient';
|
|
216
|
-
|
|
217
|
-
const setUser = async (userDetails: UserDetails) => {
|
|
218
|
-
setUserDetails(userDetails);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
// Example usage
|
|
222
|
-
setUser({
|
|
223
|
-
userId: '12345',
|
|
224
|
-
userName: 'John Doe',
|
|
225
|
-
email: 'user@example.com',
|
|
226
|
-
phone: '+1234567890',
|
|
227
|
-
});
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## 📱 Components
|
|
231
|
-
|
|
232
|
-
### AdgeistProvider
|
|
233
|
-
|
|
234
|
-
The root provider component that configures the SDK globally.
|
|
235
|
-
|
|
236
|
-
#### Props
|
|
237
|
-
|
|
238
|
-
| Prop | Type | Required | Default | Description |
|
|
239
|
-
| ------------------- | ----------------- | -------- | ------- | --------------------------------------------------- |
|
|
240
|
-
| `children` | `React.ReactNode` | ✅ | - | Child components |
|
|
241
|
-
| `publisherId` | `string` | ✅ | - | Your publisher ID from AdGeist dashboard |
|
|
242
|
-
| `apiKey` | `string` | ✅ | - | Your API key from AdGeist dashboard |
|
|
243
|
-
| `domain` | `string` | ✅ | - | Your registered domain (e.g., "https://adgeist.ai") |
|
|
244
|
-
| `isTestEnvironment` | `boolean` | ✅ | - | Enable test mode for development |
|
|
245
|
-
|
|
246
|
-
#### Example
|
|
247
|
-
|
|
248
|
-
```tsx
|
|
249
|
-
<AdgeistProvider
|
|
250
|
-
publisherId="67f8ad1350ff1e0870da3f5b"
|
|
251
|
-
apiKey="7f6b3361bd6d804edfb40cecf3f42e5ebc0b11bd88d96c8a6d64188b93447ad9"
|
|
252
|
-
domain="https://adgeist.ai"
|
|
253
|
-
isTestEnvironment={false}
|
|
254
|
-
>
|
|
255
|
-
<App />
|
|
256
|
-
</AdgeistProvider>
|
|
257
|
-
```
|
|
258
|
-
|
|
259
|
-
### BannerAd
|
|
260
|
-
|
|
261
|
-
Display banner or video advertisements in your app with responsive layout options.
|
|
262
|
-
|
|
263
|
-
#### Props
|
|
264
|
-
|
|
265
|
-
| Prop | Type | Required | Default | Description |
|
|
266
|
-
| ---------------- | ---------------------------------- | -------- | ---------- | ----------------------------------------------------------- |
|
|
267
|
-
| `dataAdSlot` | `string` | ✅ | - | Ad slot ID from your AdGeist dashboard |
|
|
268
|
-
| `dataSlotType` | `'banner' \| 'video'` | ❌ | `'banner'` | Type of ad content to display |
|
|
269
|
-
| `width` | `number` | ❌ | `0` | Width of the ad banner (ignored if `isResponsive` is true) |
|
|
270
|
-
| `height` | `number` | ❌ | `0` | Height of the ad banner (ignored if `isResponsive` is true) |
|
|
271
|
-
| `isResponsive` | `boolean` | ✅ | - | Enable responsive layout that adapts to container |
|
|
272
|
-
| `responsiveType` | `'SQUARE' \| 'VERTICAL' \| 'WIDE'` | ❌ | `'SQUARE'` | Responsive layout type (used when `isResponsive` is true) |
|
|
273
|
-
|
|
274
|
-
#### Examples
|
|
275
|
-
|
|
276
|
-
**Basic Banner Ad:**
|
|
277
|
-
|
|
278
|
-
```tsx
|
|
279
|
-
import { BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
280
|
-
|
|
281
|
-
function MyScreen() {
|
|
282
|
-
return (
|
|
283
|
-
<View>
|
|
284
|
-
<BannerAd
|
|
285
|
-
dataAdSlot="686149fac1fd09fff371e53c"
|
|
286
|
-
dataSlotType="banner"
|
|
287
|
-
width={350}
|
|
288
|
-
height={250}
|
|
289
|
-
isResponsive={false}
|
|
290
|
-
/>
|
|
291
|
-
</View>
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
```
|
|
295
|
-
|
|
296
|
-
**Video Ad:**
|
|
297
|
-
|
|
298
|
-
```tsx
|
|
299
|
-
function MyScreen() {
|
|
300
|
-
return (
|
|
301
|
-
<View>
|
|
302
|
-
<BannerAd
|
|
303
|
-
dataAdSlot="686149fac1fd09fff371e53c"
|
|
304
|
-
dataSlotType="video"
|
|
305
|
-
width={350}
|
|
306
|
-
height={200}
|
|
307
|
-
isResponsive={false}
|
|
308
|
-
/>
|
|
309
|
-
</View>
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
**Responsive Banner Ad:**
|
|
315
|
-
|
|
316
|
-
```tsx
|
|
317
|
-
function MyScreen() {
|
|
318
|
-
return (
|
|
319
|
-
<View style={{ padding: 16 }}>
|
|
320
|
-
<BannerAd
|
|
321
|
-
dataAdSlot="686149fac1fd09fff371e53c"
|
|
322
|
-
dataSlotType="banner"
|
|
323
|
-
isResponsive={true}
|
|
324
|
-
responsiveType="WIDE"
|
|
325
|
-
/>
|
|
326
|
-
</View>
|
|
327
|
-
);
|
|
328
|
-
}
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
**Responsive Square Ad:**
|
|
107
|
+
## Implement the Embedding of Ad Slots
|
|
332
108
|
|
|
333
|
-
|
|
334
|
-
function MyScreen() {
|
|
335
|
-
return (
|
|
336
|
-
<View style={{ width: 300, height: 300 }}>
|
|
337
|
-
<BannerAd
|
|
338
|
-
dataAdSlot="686149fac1fd09fff371e53c"
|
|
339
|
-
dataSlotType="banner"
|
|
340
|
-
isResponsive={true}
|
|
341
|
-
responsiveType="SQUARE"
|
|
342
|
-
/>
|
|
343
|
-
</View>
|
|
344
|
-
);
|
|
345
|
-
}
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
#### Responsive Types
|
|
349
|
-
|
|
350
|
-
| Type | Description | Best Use Case |
|
|
351
|
-
| ---------- | ---------------------------- | ----------------------------------------- |
|
|
352
|
-
| `SQUARE` | Equal width and height ratio | Social media style ads, product showcases |
|
|
353
|
-
| `VERTICAL` | Taller than wide (portrait) | Sidebar ads, mobile story format |
|
|
354
|
-
| `WIDE` | Wider than tall (landscape) | Header/footer banners, horizontal layouts |
|
|
355
|
-
|
|
356
|
-
#### Ad Slot Types
|
|
357
|
-
|
|
358
|
-
| Type | Description | Requirements |
|
|
359
|
-
| -------- | --------------------------- | --------------------------------------------- |
|
|
360
|
-
| `banner` | Static image advertisements | Standard image formats (JPG, PNG, WebP) |
|
|
361
|
-
| `video` | Video advertisements | Requires `react-native-video` peer dependency |
|
|
362
|
-
|
|
363
|
-
#### Layout Behavior
|
|
364
|
-
|
|
365
|
-
- **Fixed Layout** (`isResponsive: false`): Uses exact `width` and `height` values
|
|
366
|
-
- **Responsive Layout** (`isResponsive: true`): Adapts to parent container size based on `responsiveType`
|
|
367
|
-
|
|
368
|
-
#### Video Ad Requirements
|
|
369
|
-
|
|
370
|
-
For video ads (`dataSlotType: 'video'`), ensure you have installed the required peer dependency:
|
|
371
|
-
|
|
372
|
-
```bash
|
|
373
|
-
npm install react-native-video@^4.5.2
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
Video ads automatically loop and are muted by default for better user experience.
|
|
377
|
-
|
|
378
|
-
## 🏢 CDP Client API
|
|
379
|
-
|
|
380
|
-
The SDK includes a Customer Data Platform (CDP) client for easy data management:
|
|
381
|
-
|
|
382
|
-
```tsx
|
|
383
|
-
import {
|
|
384
|
-
setUserDetails,
|
|
385
|
-
logEvent,
|
|
386
|
-
getConsentStatus,
|
|
387
|
-
updateConsentStatus,
|
|
388
|
-
} from '@thealteroffice/react-native-adgeist';
|
|
389
|
-
```
|
|
390
|
-
|
|
391
|
-
### CDP Client Methods
|
|
392
|
-
|
|
393
|
-
#### `setUserDetails(userDetails: UserDetails)`
|
|
394
|
-
|
|
395
|
-
Sets user details for the current session.
|
|
396
|
-
|
|
397
|
-
```tsx
|
|
398
|
-
setUserDetails({
|
|
399
|
-
userId: '12345',
|
|
400
|
-
userName: 'John Doe',
|
|
401
|
-
email: 'user@example.com',
|
|
402
|
-
phone: '+1234567890',
|
|
403
|
-
});
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
#### `logEvent(event: Event)`
|
|
407
|
-
|
|
408
|
-
Logs an event with custom properties.
|
|
409
|
-
|
|
410
|
-
```tsx
|
|
411
|
-
logEvent({
|
|
412
|
-
eventType: 'purchase',
|
|
413
|
-
eventProperties: {
|
|
414
|
-
productId: '12345',
|
|
415
|
-
amount: 99.99,
|
|
416
|
-
currency: 'USD',
|
|
417
|
-
},
|
|
418
|
-
});
|
|
419
|
-
```
|
|
420
|
-
|
|
421
|
-
#### `getConsentStatus(): Promise<'ACCEPTED' | 'DENIED'>`
|
|
422
|
-
|
|
423
|
-
Returns the current consent status.
|
|
424
|
-
|
|
425
|
-
```tsx
|
|
426
|
-
const status = await getConsentStatus();
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
#### `updateConsentStatus(consent: boolean)`
|
|
430
|
-
|
|
431
|
-
Updates the user's consent status.
|
|
432
|
-
|
|
433
|
-
```tsx
|
|
434
|
-
updateConsentStatus(true); // User granted consent
|
|
435
|
-
updateConsentStatus(false); // User denied consent
|
|
436
|
-
```
|
|
437
|
-
|
|
438
|
-
## 🎨 Customization
|
|
439
|
-
|
|
440
|
-
### Custom Event Tracking
|
|
441
|
-
|
|
442
|
-
```tsx
|
|
443
|
-
import { logEvent } from '@thealteroffice/react-native-adgeist';
|
|
444
|
-
|
|
445
|
-
// Track user interactions
|
|
446
|
-
const trackButtonClick = (buttonName: string) => {
|
|
447
|
-
logEvent({
|
|
448
|
-
eventType: 'button_click',
|
|
449
|
-
eventProperties: {
|
|
450
|
-
buttonName,
|
|
451
|
-
timestamp: Date.now(),
|
|
452
|
-
screen: 'home',
|
|
453
|
-
},
|
|
454
|
-
});
|
|
455
|
-
};
|
|
456
|
-
|
|
457
|
-
// Track page views
|
|
458
|
-
const trackPageView = (pageName: string) => {
|
|
459
|
-
logEvent({
|
|
460
|
-
eventType: 'page_view',
|
|
461
|
-
eventProperties: {
|
|
462
|
-
pageName,
|
|
463
|
-
timestamp: Date.now(),
|
|
464
|
-
},
|
|
465
|
-
});
|
|
466
|
-
};
|
|
467
|
-
```
|
|
468
|
-
|
|
469
|
-
## 🚀 Advanced Features
|
|
470
|
-
|
|
471
|
-
### Debug Mode
|
|
472
|
-
|
|
473
|
-
Enable debug mode to see detailed logs:
|
|
474
|
-
|
|
475
|
-
```tsx
|
|
476
|
-
<AdgeistProvider
|
|
477
|
-
publisherId="your-publisher-id"
|
|
478
|
-
apiKey="your-api-key"
|
|
479
|
-
domain="your-domain"
|
|
480
|
-
isTestEnvironment={true} // Enable for debug logs
|
|
481
|
-
>
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
## 🔧 Troubleshooting
|
|
485
|
-
|
|
486
|
-
### Common Issues
|
|
487
|
-
|
|
488
|
-
#### Build Errors
|
|
489
|
-
|
|
490
|
-
- **iOS**: Run `cd ios && pod install` after installation
|
|
491
|
-
- **Android**: Clean and rebuild: `cd android && ./gradlew clean`
|
|
492
|
-
|
|
493
|
-
#### No Ads Showing
|
|
494
|
-
|
|
495
|
-
- Verify your `publisherId` and `apiKey` are correct
|
|
496
|
-
- Check if `isTestEnvironment` is set appropriately
|
|
497
|
-
- Ensure your ad slot ID (`dataAdSlot`) is valid
|
|
498
|
-
- Make sure `initializeSdk` is called before fetching ads
|
|
499
|
-
|
|
500
|
-
#### Video Not Working
|
|
501
|
-
|
|
502
|
-
- Make sure you installed `react-native-video` as described in the peer dependencies section
|
|
503
|
-
- For iOS: Run `cd ios && pod install` after installing `react-native-video`
|
|
504
|
-
|
|
505
|
-
#### SDK Not Initialized Error
|
|
506
|
-
|
|
507
|
-
- Ensure `AdgeistProvider` is wrapping your app
|
|
508
|
-
- Call `initializeSdk` before using native methods
|
|
509
|
-
- Check that the custom domain is correctly configured
|
|
510
|
-
|
|
511
|
-
### Debug Mode
|
|
512
|
-
|
|
513
|
-
Enable debug logging to troubleshoot issues:
|
|
109
|
+
Use the `HTML5AdView` component to display banner ads anywhere in your app. Place this component where you want the ads to appear and the SDK will automatically load and render the ad content.
|
|
514
110
|
|
|
515
111
|
```tsx
|
|
516
|
-
|
|
517
|
-
publisherId="your-publisher-id"
|
|
518
|
-
apiKey="your-api-key"
|
|
519
|
-
domain="your-domain"
|
|
520
|
-
isTestEnvironment={true}
|
|
521
|
-
>
|
|
522
|
-
```
|
|
523
|
-
|
|
524
|
-
## 📱 Migration Guide
|
|
525
|
-
|
|
526
|
-
### From v0.0.x to v0.1.x
|
|
527
|
-
|
|
528
|
-
1. Install required peer dependency: `npm install react-native-video@^4.5.2`
|
|
529
|
-
2. Update your `AdgeistProvider` configuration
|
|
530
|
-
3. Replace direct native module calls with CDP client calls:
|
|
531
|
-
|
|
532
|
-
```tsx
|
|
533
|
-
// Before
|
|
534
|
-
import Adgeist from '@thealteroffice/react-native-adgeist/src/NativeAdgeist';
|
|
535
|
-
await Adgeist.setUserDetails(userDetails);
|
|
536
|
-
|
|
537
|
-
// After
|
|
538
|
-
import { setUserDetails } from '@thealteroffice/react-native-adgeist/src/cdpclient';
|
|
539
|
-
setUserDetails(userDetails);
|
|
540
|
-
```
|
|
541
|
-
|
|
542
|
-
4. Run `cd ios && pod install` for iOS projects
|
|
543
|
-
|
|
544
|
-
## 🤝 Contributing
|
|
545
|
-
|
|
546
|
-
We welcome contributions! Please read our [Contributing Guide](CONTRIBUTING.md) for details on our code of conduct and the process for submitting pull requests.
|
|
547
|
-
|
|
548
|
-
### Development Setup
|
|
549
|
-
|
|
550
|
-
```bash
|
|
551
|
-
git clone https://github.com/the-alter-office/react-native-adgeist.git
|
|
552
|
-
cd react-native-adgeist
|
|
553
|
-
yarn install
|
|
554
|
-
```
|
|
112
|
+
import { HTML5AdView } from '@thealteroffice/react-native-adgeist';
|
|
555
113
|
|
|
556
|
-
|
|
114
|
+
<HTML5AdView
|
|
115
|
+
adUnitID="6932a4c022f6786424ce3b84"
|
|
116
|
+
adSize={{ width: 320, height: 480 }}
|
|
117
|
+
onAdLoaded={}
|
|
118
|
+
onAdFailedToLoad={}
|
|
119
|
+
onAdOpened={}
|
|
120
|
+
onAdClosed={}
|
|
121
|
+
onAdClicked={}
|
|
122
|
+
adType="display"
|
|
123
|
+
/>;
|
|
557
124
|
|
|
558
|
-
```bash
|
|
559
|
-
yarn example ios
|
|
560
|
-
# or
|
|
561
|
-
yarn example android
|
|
562
125
|
```
|
|
563
|
-
|
|
564
|
-
## 📄 License
|
|
565
|
-
|
|
566
|
-
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
567
|
-
|
|
568
|
-
## 🆘 Support
|
|
569
|
-
|
|
570
|
-
- **Documentation**: [GitHub Wiki](https://github.com/the-alter-office/react-native-adgeist/wiki)
|
|
571
|
-
- **Issues**: [GitHub Issues](https://github.com/the-alter-office/react-native-adgeist/issues)
|
|
572
|
-
- **Discussions**: [GitHub Discussions](https://github.com/the-alter-office/react-native-adgeist/discussions)
|
|
573
|
-
|
|
574
|
-
---
|
|
575
|
-
|
|
576
|
-
Made with ❤️ by [The Alter Office](https://github.com/the-alter-office)
|
package/android/build.gradle
CHANGED
|
@@ -82,8 +82,11 @@ android {
|
|
|
82
82
|
"src/newarch",
|
|
83
83
|
|
|
84
84
|
// This is needed to build Kotlin project with NewArch enabled
|
|
85
|
-
"${project.buildDir}/generated/source/codegen/java",
|
|
86
|
-
"${project.buildDir}/generated/source/codegen/jni"
|
|
85
|
+
// "${project.buildDir}/generated/source/codegen/java",
|
|
86
|
+
// "${project.buildDir}/generated/source/codegen/jni"
|
|
87
|
+
|
|
88
|
+
"generated/java",
|
|
89
|
+
"generated/jni"
|
|
87
90
|
]
|
|
88
91
|
}else{
|
|
89
92
|
java.srcDirs += ["src/oldarch"]
|
|
@@ -101,7 +104,7 @@ def kotlin_version = getExtOrDefault("kotlinVersion")
|
|
|
101
104
|
|
|
102
105
|
dependencies {
|
|
103
106
|
implementation "com.facebook.react:react-android"
|
|
104
|
-
implementation "ai.adgeist:adgeistkit:1.
|
|
107
|
+
implementation "ai.adgeist:adgeistkit:1.1.10-qa"
|
|
105
108
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
106
109
|
}
|
|
107
110
|
|