@thealteroffice/react-native-adgeist 0.0.12 → 0.0.14
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 +378 -127
- package/android/app/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeAdgeistSpec.java +63 -0
- package/android/app/build/generated/source/codegen/jni/CMakeLists.txt +36 -0
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec-generated.cpp +68 -0
- package/android/app/build/generated/source/codegen/jni/RNAdgeistSpec.h +31 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI-generated.cpp +82 -0
- package/android/app/build/generated/source/codegen/jni/react/renderer/components/RNAdgeistSpec/RNAdgeistSpecJSI.h +242 -0
- package/ios/Adgeist.mm +8 -2
- package/ios/AdgeistImpl.swift +25 -5
- package/lib/module/components/BannerAd.js +24 -11
- package/lib/module/components/BannerAd.js.map +1 -1
- package/lib/typescript/src/NativeAdgeist.d.ts +2 -2
- package/lib/typescript/src/NativeAdgeist.d.ts.map +1 -1
- package/lib/typescript/src/components/BannerAd.d.ts +4 -2
- package/lib/typescript/src/components/BannerAd.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/NativeAdgeist.ts +2 -2
- package/src/components/BannerAd.tsx +31 -13
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", '= 0.0.
|
|
19
|
+
s.dependency "AdgeistKit", '= 0.0.7'
|
|
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
|
@@ -15,6 +15,8 @@ A React Native SDK that enables publishers to seamlessly integrate their ad spac
|
|
|
15
15
|
- ✅ **Expo Compatible**: Config plugin for seamless Expo integration
|
|
16
16
|
- ✅ **Analytics**: Built-in impression and click tracking
|
|
17
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
|
|
18
20
|
|
|
19
21
|
## 📦 Installation
|
|
20
22
|
|
|
@@ -27,6 +29,7 @@ yarn add @thealteroffice/react-native-adgeist
|
|
|
27
29
|
```
|
|
28
30
|
|
|
29
31
|
For iOS, run pod install:
|
|
32
|
+
|
|
30
33
|
```bash
|
|
31
34
|
cd ios && pod install
|
|
32
35
|
```
|
|
@@ -38,6 +41,7 @@ npx expo install @thealteroffice/react-native-adgeist
|
|
|
38
41
|
```
|
|
39
42
|
|
|
40
43
|
Rebuild your app:
|
|
44
|
+
|
|
41
45
|
```bash
|
|
42
46
|
npx expo prebuild --clean
|
|
43
47
|
```
|
|
@@ -49,23 +53,28 @@ npx expo prebuild --clean
|
|
|
49
53
|
This package uses `react-native-video` internally for media rendering.
|
|
50
54
|
|
|
51
55
|
### Why Peer Dependency?
|
|
56
|
+
|
|
52
57
|
React Native native modules like `react-native-video` should not be bundled inside libraries to prevent native build conflicts.
|
|
53
58
|
|
|
54
59
|
We declare `react-native-video` as a peer dependency, so your app controls the version.
|
|
55
60
|
|
|
56
61
|
### What You Need to Do
|
|
62
|
+
|
|
57
63
|
- **If your app already uses `react-native-video`**: No action needed.
|
|
58
64
|
- **If your app does not have `react-native-video` installed**: Please install it manually:
|
|
59
65
|
|
|
60
66
|
```bash
|
|
61
67
|
npm install react-native-video@^4.5.2
|
|
62
68
|
```
|
|
69
|
+
|
|
63
70
|
or
|
|
71
|
+
|
|
64
72
|
```bash
|
|
65
73
|
yarn add react-native-video@^4.5.2
|
|
66
74
|
```
|
|
67
75
|
|
|
68
76
|
### What Happens If You Skip This?
|
|
77
|
+
|
|
69
78
|
If `react-native-video` is not installed, your app will crash at runtime with:
|
|
70
79
|
|
|
71
80
|
```javascript
|
|
@@ -73,6 +82,7 @@ Error: Cannot find module 'react-native-video'
|
|
|
73
82
|
```
|
|
74
83
|
|
|
75
84
|
### Why Not Include It in dependencies?
|
|
85
|
+
|
|
76
86
|
Adding `react-native-video` to dependencies directly in this library would:
|
|
77
87
|
|
|
78
88
|
- ❌ Cause duplicate native module linking
|
|
@@ -81,8 +91,8 @@ Adding `react-native-video` to dependencies directly in this library would:
|
|
|
81
91
|
|
|
82
92
|
### Dependency Summary
|
|
83
93
|
|
|
84
|
-
| Package
|
|
85
|
-
|
|
94
|
+
| Package | Install It? | Why? |
|
|
95
|
+
| -------------------- | --------------------- | ------------------------------------------------------------------ |
|
|
86
96
|
| `react-native-video` | ✅ **Yes (required)** | Your app must install this manually to satisfy the peer dependency |
|
|
87
97
|
|
|
88
98
|
## 🔧 Setup & Configuration
|
|
@@ -93,7 +103,10 @@ Wrap your app with `AdgeistProvider` to configure global settings:
|
|
|
93
103
|
|
|
94
104
|
```tsx
|
|
95
105
|
import React from 'react';
|
|
96
|
-
import {
|
|
106
|
+
import {
|
|
107
|
+
AdgeistProvider,
|
|
108
|
+
BannerAd,
|
|
109
|
+
} from '@thealteroffice/react-native-adgeist';
|
|
97
110
|
|
|
98
111
|
export default function App() {
|
|
99
112
|
return (
|
|
@@ -101,7 +114,7 @@ export default function App() {
|
|
|
101
114
|
publisherId="your-publisher-id"
|
|
102
115
|
apiKey="your-api-key"
|
|
103
116
|
domain="your-domain"
|
|
104
|
-
isTestEnvironment=
|
|
117
|
+
isTestEnvironment={false}
|
|
105
118
|
>
|
|
106
119
|
<YourAppContent />
|
|
107
120
|
</AdgeistProvider>
|
|
@@ -124,6 +137,96 @@ const isTestMode = __DEV__ || process.env.NODE_ENV === 'development';
|
|
|
124
137
|
>
|
|
125
138
|
```
|
|
126
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
|
+
|
|
127
230
|
## 📱 Components
|
|
128
231
|
|
|
129
232
|
### AdgeistProvider
|
|
@@ -132,13 +235,13 @@ The root provider component that configures the SDK globally.
|
|
|
132
235
|
|
|
133
236
|
#### Props
|
|
134
237
|
|
|
135
|
-
| Prop
|
|
136
|
-
|
|
137
|
-
| `children`
|
|
138
|
-
| `publisherId`
|
|
139
|
-
| `apiKey`
|
|
140
|
-
| `domain`
|
|
141
|
-
| `isTestEnvironment` | `boolean`
|
|
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 |
|
|
142
245
|
|
|
143
246
|
#### Example
|
|
144
247
|
|
|
@@ -155,17 +258,22 @@ The root provider component that configures the SDK globally.
|
|
|
155
258
|
|
|
156
259
|
### BannerAd
|
|
157
260
|
|
|
158
|
-
Display banner advertisements in your app.
|
|
261
|
+
Display banner or video advertisements in your app with responsive layout options.
|
|
159
262
|
|
|
160
263
|
#### Props
|
|
161
264
|
|
|
162
|
-
| Prop
|
|
163
|
-
|
|
164
|
-
| `dataAdSlot`
|
|
165
|
-
| `
|
|
166
|
-
| `
|
|
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) |
|
|
167
273
|
|
|
168
|
-
####
|
|
274
|
+
#### Examples
|
|
275
|
+
|
|
276
|
+
**Basic Banner Ad:**
|
|
169
277
|
|
|
170
278
|
```tsx
|
|
171
279
|
import { BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
@@ -173,153 +281,296 @@ import { BannerAd } from '@thealteroffice/react-native-adgeist';
|
|
|
173
281
|
function MyScreen() {
|
|
174
282
|
return (
|
|
175
283
|
<View>
|
|
176
|
-
<BannerAd
|
|
284
|
+
<BannerAd
|
|
177
285
|
dataAdSlot="686149fac1fd09fff371e53c"
|
|
286
|
+
dataSlotType="banner"
|
|
178
287
|
width={350}
|
|
179
288
|
height={250}
|
|
289
|
+
isResponsive={false}
|
|
180
290
|
/>
|
|
181
291
|
</View>
|
|
182
292
|
);
|
|
183
293
|
}
|
|
184
294
|
```
|
|
185
295
|
|
|
186
|
-
|
|
296
|
+
**Video Ad:**
|
|
187
297
|
|
|
188
|
-
|
|
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:**
|
|
189
315
|
|
|
190
316
|
```tsx
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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:**
|
|
332
|
+
|
|
333
|
+
```tsx
|
|
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
|
+
}
|
|
213
346
|
```
|
|
214
347
|
|
|
215
|
-
|
|
348
|
+
#### Responsive Types
|
|
216
349
|
|
|
217
|
-
|
|
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 |
|
|
218
355
|
|
|
219
|
-
|
|
356
|
+
#### Ad Slot Types
|
|
220
357
|
|
|
221
|
-
|
|
|
222
|
-
|
|
223
|
-
| `
|
|
224
|
-
| `
|
|
225
|
-
| `adSpaceId` | `string` | ✅ | Ad space identifier |
|
|
226
|
-
| `publisherId` | `string` | ✅ | Publisher identifier |
|
|
227
|
-
| `isTestEnvironment` | `boolean` | ✅ | Test mode flag |
|
|
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 |
|
|
228
362
|
|
|
229
|
-
|
|
363
|
+
#### Layout Behavior
|
|
230
364
|
|
|
231
|
-
|
|
365
|
+
- **Fixed Layout** (`isResponsive: false`): Uses exact `width` and `height` values
|
|
366
|
+
- **Responsive Layout** (`isResponsive: true`): Adapts to parent container size based on `responsiveType`
|
|
232
367
|
|
|
233
|
-
|
|
368
|
+
#### Video Ad Requirements
|
|
234
369
|
|
|
235
|
-
|
|
236
|
-
|-----------|------|----------|-------------|
|
|
237
|
-
| `campaignId` | `string` | ✅ | Campaign identifier |
|
|
238
|
-
| `adSpaceId` | `string` | ✅ | Ad space identifier |
|
|
239
|
-
| `publisherId` | `string` | ✅ | Publisher identifier |
|
|
240
|
-
| `eventType` | `string` | ✅ | Event type ('IMPRESSION' or 'CLICK') |
|
|
241
|
-
| `origin` | `string` | ✅ | App domain/origin |
|
|
242
|
-
| `apiKey` | `string` | ✅ | Your API key |
|
|
243
|
-
| `bidId` | `string` | ✅ | Bid identifier |
|
|
244
|
-
| `isTestEnvironment` | `boolean` | ✅ | Test mode flag |
|
|
370
|
+
For video ads (`dataSlotType: 'video'`), ensure you have installed the required peer dependency:
|
|
245
371
|
|
|
246
|
-
|
|
372
|
+
```bash
|
|
373
|
+
npm install react-native-video@^4.5.2
|
|
374
|
+
```
|
|
247
375
|
|
|
248
|
-
|
|
376
|
+
Video ads automatically loop and are muted by default for better user experience.
|
|
249
377
|
|
|
250
|
-
|
|
378
|
+
## 🏢 CDP Client API
|
|
379
|
+
|
|
380
|
+
The SDK includes a Customer Data Platform (CDP) client for easy data management:
|
|
251
381
|
|
|
252
382
|
```tsx
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
383
|
+
import {
|
|
384
|
+
setUserDetails,
|
|
385
|
+
logEvent,
|
|
386
|
+
getConsentStatus,
|
|
387
|
+
updateConsentStatus,
|
|
388
|
+
} from '@thealteroffice/react-native-adgeist';
|
|
389
|
+
```
|
|
259
390
|
|
|
260
|
-
|
|
261
|
-
bidId: string;
|
|
262
|
-
bid: Bid[];
|
|
263
|
-
}
|
|
391
|
+
### CDP Client Methods
|
|
264
392
|
|
|
265
|
-
|
|
266
|
-
id: string;
|
|
267
|
-
impId: string;
|
|
268
|
-
price: number;
|
|
269
|
-
ext: BidExtension;
|
|
270
|
-
}
|
|
393
|
+
#### `setUserDetails(userDetails: UserDetails)`
|
|
271
394
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
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
|
|
279
436
|
```
|
|
280
437
|
|
|
281
438
|
## 🎨 Customization
|
|
282
439
|
|
|
283
|
-
### Custom
|
|
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
|
+
```
|
|
284
468
|
|
|
285
|
-
|
|
469
|
+
## 🚀 Advanced Features
|
|
470
|
+
|
|
471
|
+
### Debug Mode
|
|
472
|
+
|
|
473
|
+
Enable debug mode to see detailed logs:
|
|
286
474
|
|
|
287
475
|
```tsx
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
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
|
+
```
|
|
291
483
|
|
|
292
|
-
|
|
293
|
-
const [adData, setAdData] = useState(null);
|
|
294
|
-
const [loading, setLoading] = useState(true);
|
|
295
|
-
const { publisherId, apiKey, domain, isTestEnvironment } = useAdgeistContext();
|
|
484
|
+
## 🔧 Troubleshooting
|
|
296
485
|
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
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:
|
|
514
|
+
|
|
515
|
+
```tsx
|
|
516
|
+
<AdgeistProvider
|
|
517
|
+
publisherId="your-publisher-id"
|
|
518
|
+
apiKey="your-api-key"
|
|
519
|
+
domain="your-domain"
|
|
520
|
+
isTestEnvironment={true}
|
|
521
|
+
>
|
|
323
522
|
```
|
|
324
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
|
+
```
|
|
555
|
+
|
|
556
|
+
### Running the Example
|
|
557
|
+
|
|
558
|
+
```bash
|
|
559
|
+
yarn example ios
|
|
560
|
+
# or
|
|
561
|
+
yarn example android
|
|
325
562
|
```
|
|
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)
|