@bigcrunch/react-native-ads 0.3.0 → 0.4.0
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/README.md +272 -278
- package/android/src/main/java/com/bigcrunch/ads/react/BigCrunchAdsModule.kt +0 -23
- package/ios/BigCrunchAdsModule.swift +5 -13
- package/lib/types/config.d.ts +22 -9
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/events.d.ts +4 -4
- package/lib/types/events.d.ts.map +1 -1
- package/package.json +4 -3
- package/react-native-bigcrunch-ads.podspec +1 -2
- package/src/types/config.ts +23 -9
- package/src/types/events.ts +4 -4
package/README.md
CHANGED
|
@@ -4,12 +4,20 @@ Simplified in-app advertising for React Native apps with Prebid and Google Ad Ma
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
7
|
+
- **Simple Integration**: One SDK to handle Prebid, Google Ad Manager, and Amazon demand
|
|
8
|
+
- **Built-in Analytics**: Automatic tracking of screen views, impressions, clicks, and revenue
|
|
9
|
+
- **Revenue Optimization**: Server-side header bidding via Prebid Server
|
|
10
|
+
- **Configuration-Driven**: Manage placements and ad sizes from the BigCrunch dashboard
|
|
11
|
+
- **Cross-Platform**: Supports both iOS and Android
|
|
12
|
+
- **Ad Formats**: Banner, Interstitial, and Rewarded ads
|
|
13
|
+
|
|
14
|
+
## Requirements
|
|
15
|
+
|
|
16
|
+
- React Native 0.60+
|
|
17
|
+
- iOS 13.0+
|
|
18
|
+
- Android API 21+
|
|
19
|
+
- **Bare React Native** project (not Expo managed workflow)
|
|
20
|
+
- If using Expo, you must first run `expo prebuild` to generate native directories
|
|
13
21
|
|
|
14
22
|
## Installation
|
|
15
23
|
|
|
@@ -22,248 +30,318 @@ yarn add @bigcrunch/react-native-ads
|
|
|
22
30
|
### iOS Setup
|
|
23
31
|
|
|
24
32
|
```bash
|
|
25
|
-
cd ios && pod install
|
|
33
|
+
cd ios && pod install && cd ..
|
|
26
34
|
```
|
|
27
35
|
|
|
28
36
|
Add the following to your `Info.plist`:
|
|
29
37
|
|
|
30
38
|
```xml
|
|
31
39
|
<key>GADApplicationIdentifier</key>
|
|
32
|
-
<string>
|
|
33
|
-
|
|
34
|
-
<key>SKAdNetworkItems</key>
|
|
35
|
-
<array>
|
|
36
|
-
<!-- Add SKAdNetwork identifiers -->
|
|
37
|
-
</array>
|
|
40
|
+
<string>YOUR_GAM_APP_ID</string>
|
|
38
41
|
```
|
|
39
42
|
|
|
43
|
+
> For testing, you can use the Google test ID: `ca-app-pub-3940256099942544~1458002511`
|
|
44
|
+
|
|
40
45
|
### Android Setup
|
|
41
46
|
|
|
42
|
-
Add the following
|
|
47
|
+
Add the following inside the `<application>` tag in your `AndroidManifest.xml`:
|
|
43
48
|
|
|
44
49
|
```xml
|
|
45
50
|
<meta-data
|
|
46
51
|
android:name="com.google.android.gms.ads.APPLICATION_ID"
|
|
47
|
-
android:value="
|
|
52
|
+
android:value="YOUR_GAM_APP_ID"/>
|
|
48
53
|
```
|
|
49
54
|
|
|
55
|
+
> For testing, you can use: `ca-app-pub-3940256099942544~3347511713`
|
|
56
|
+
|
|
50
57
|
## Quick Start
|
|
51
58
|
|
|
52
59
|
### 1. Initialize the SDK
|
|
53
60
|
|
|
54
61
|
```typescript
|
|
62
|
+
import { useEffect } from 'react';
|
|
55
63
|
import { BigCrunchAds } from '@bigcrunch/react-native-ads';
|
|
56
64
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
);
|
|
64
|
-
console.log('BigCrunch Ads initialized successfully');
|
|
65
|
-
} catch (error) {
|
|
66
|
-
console.error('Failed to initialize BigCrunch Ads:', error);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
65
|
+
const PROPERTY_ID = 'YOUR_PROPERTY_ID';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
initializeBigCrunch();
|
|
70
|
+
}, []);
|
|
69
71
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
+
const initializeBigCrunch = async () => {
|
|
73
|
+
try {
|
|
74
|
+
await BigCrunchAds.initialize(PROPERTY_ID, 'production');
|
|
75
|
+
console.log('BigCrunch SDK initialized');
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error('BigCrunch initialization failed:', error);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
// Your app content
|
|
83
|
+
);
|
|
84
|
+
}
|
|
72
85
|
```
|
|
73
86
|
|
|
87
|
+
| Parameter | Description |
|
|
88
|
+
|-----------|-------------|
|
|
89
|
+
| `PROPERTY_ID` | Unique identifier for your app, provided by BigCrunch |
|
|
90
|
+
| `environment` | `'production'` for live apps, `'sandbox'` for testing |
|
|
91
|
+
|
|
74
92
|
### 2. Track Screen Views
|
|
75
93
|
|
|
76
94
|
```typescript
|
|
95
|
+
import { useEffect } from 'react';
|
|
77
96
|
import { BigCrunchAds } from '@bigcrunch/react-native-ads';
|
|
78
97
|
|
|
79
|
-
|
|
80
|
-
|
|
98
|
+
function HomeScreen() {
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
BigCrunchAds.trackScreenView('HomeScreen');
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
// Screen content
|
|
105
|
+
);
|
|
106
|
+
}
|
|
81
107
|
```
|
|
82
108
|
|
|
109
|
+
> For automatic tracking with React Navigation, see the [Tracking-Only Integration Guide](./docs/TRACKING_ONLY_INTEGRATION.md#option-b-automatic-tracking-with-react-navigation-recommended).
|
|
110
|
+
|
|
83
111
|
## Ad Formats
|
|
84
112
|
|
|
85
113
|
### Banner Ads
|
|
86
114
|
|
|
115
|
+
Ad sizes are configured per placement in the BigCrunch dashboard. You only need to pass the `placementId` — the SDK handles the rest.
|
|
116
|
+
|
|
87
117
|
```tsx
|
|
88
118
|
import { BigCrunchBannerView } from '@bigcrunch/react-native-ads';
|
|
89
119
|
|
|
90
|
-
function
|
|
120
|
+
function ArticleScreen() {
|
|
91
121
|
return (
|
|
92
|
-
<View>
|
|
93
|
-
|
|
122
|
+
<View style={{ flex: 1 }}>
|
|
123
|
+
<Text>Article content...</Text>
|
|
94
124
|
|
|
95
125
|
<BigCrunchBannerView
|
|
96
|
-
placementId="banner-
|
|
97
|
-
size="BANNER" // or "MEDIUM_RECTANGLE", "ADAPTIVE", etc.
|
|
98
|
-
style={{ alignSelf: 'center' }}
|
|
126
|
+
placementId="your-banner-placement"
|
|
99
127
|
onAdLoaded={() => console.log('Banner loaded')}
|
|
100
|
-
onAdFailedToLoad={(error) => console.error('Banner failed:', error)}
|
|
101
|
-
onAdRevenue={(revenue) => console.log('Revenue:', revenue)}
|
|
128
|
+
onAdFailedToLoad={(error) => console.error('Banner failed:', error.message)}
|
|
102
129
|
/>
|
|
103
130
|
</View>
|
|
104
131
|
);
|
|
105
132
|
}
|
|
106
133
|
```
|
|
107
134
|
|
|
135
|
+
#### Props
|
|
136
|
+
|
|
137
|
+
| Prop | Type | Default | Description |
|
|
138
|
+
|------|------|---------|-------------|
|
|
139
|
+
| `placementId` | `string` | *required* | Placement ID from the BigCrunch dashboard |
|
|
140
|
+
| `size` | `BannerSize \| { width, height }` | *from config* | Optional size override. If omitted, uses the size from placement config. |
|
|
141
|
+
| `autoLoad` | `boolean` | `true` | Automatically load ad on mount |
|
|
142
|
+
| `refreshInterval` | `number` | `0` | Auto-refresh interval in seconds (0 = disabled) |
|
|
143
|
+
| `customTargeting` | `Record<string, string>` | — | Custom key-value targeting |
|
|
144
|
+
| `style` | `ViewStyle` | — | Container style |
|
|
145
|
+
|
|
146
|
+
#### Callbacks
|
|
147
|
+
|
|
148
|
+
| Callback | Description |
|
|
149
|
+
|----------|-------------|
|
|
150
|
+
| `onAdLoaded` | Ad loaded successfully |
|
|
151
|
+
| `onAdFailedToLoad` | Ad failed to load. Receives `AdError` with `code` and `message`. |
|
|
152
|
+
| `onAdImpression` | Ad impression recorded |
|
|
153
|
+
| `onAdClicked` | User tapped the ad |
|
|
154
|
+
| `onAdOpened` | Ad opened an overlay |
|
|
155
|
+
| `onAdClosed` | Ad overlay closed |
|
|
156
|
+
| `onAdRevenue` | Revenue event received (ILRD). Receives `AdRevenue` with `valueMicros` and `currencyCode`. |
|
|
157
|
+
|
|
108
158
|
#### Available Banner Sizes
|
|
109
159
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
160
|
+
| Size | Dimensions | Description |
|
|
161
|
+
|------|-----------|-------------|
|
|
162
|
+
| `'BANNER'` | 320x50 | Standard banner |
|
|
163
|
+
| `'LARGE_BANNER'` | 320x100 | Large banner |
|
|
164
|
+
| `'MEDIUM_RECTANGLE'` | 300x250 | Medium rectangle (MREC) |
|
|
165
|
+
| `'FULL_BANNER'` | 468x60 | Full-size banner |
|
|
166
|
+
| `'LEADERBOARD'` | 728x90 | Leaderboard (tablets) |
|
|
167
|
+
| `'ADAPTIVE'` | Full width, auto height | Adaptive banner (recommended) |
|
|
118
168
|
|
|
119
169
|
### Interstitial Ads
|
|
120
170
|
|
|
171
|
+
Full-screen ads shown at natural transition points. Preload ahead of time, then show when ready.
|
|
172
|
+
|
|
121
173
|
```typescript
|
|
174
|
+
import { useEffect, useRef } from 'react';
|
|
122
175
|
import { BigCrunchInterstitial } from '@bigcrunch/react-native-ads';
|
|
176
|
+
import type { EventSubscription } from '@bigcrunch/react-native-ads';
|
|
177
|
+
|
|
178
|
+
const PLACEMENT_ID = 'interstitial-level-complete';
|
|
179
|
+
|
|
180
|
+
function GameScreen() {
|
|
181
|
+
const subscriptions = useRef<EventSubscription[]>([]);
|
|
182
|
+
|
|
183
|
+
useEffect(() => {
|
|
184
|
+
// Preload on mount
|
|
185
|
+
BigCrunchInterstitial.load({ placementId: PLACEMENT_ID });
|
|
186
|
+
|
|
187
|
+
// Set up listeners
|
|
188
|
+
subscriptions.current.push(
|
|
189
|
+
BigCrunchInterstitial.addEventListener(PLACEMENT_ID, 'adClosed', () => {
|
|
190
|
+
// Preload the next interstitial
|
|
191
|
+
BigCrunchInterstitial.load({ placementId: PLACEMENT_ID });
|
|
192
|
+
}),
|
|
193
|
+
BigCrunchInterstitial.addEventListener(PLACEMENT_ID, 'adFailedToLoad', (event) => {
|
|
194
|
+
console.error('Interstitial failed:', event.error.message);
|
|
195
|
+
})
|
|
196
|
+
);
|
|
123
197
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
});
|
|
130
|
-
console.log('Interstitial loaded');
|
|
131
|
-
} catch (error) {
|
|
132
|
-
console.error('Failed to load interstitial:', error);
|
|
133
|
-
}
|
|
134
|
-
}
|
|
198
|
+
return () => {
|
|
199
|
+
subscriptions.current.forEach((sub) => sub.remove());
|
|
200
|
+
BigCrunchInterstitial.destroy(PLACEMENT_ID);
|
|
201
|
+
};
|
|
202
|
+
}, []);
|
|
135
203
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
204
|
+
const handleLevelComplete = async () => {
|
|
205
|
+
if (await BigCrunchInterstitial.isLoaded(PLACEMENT_ID)) {
|
|
206
|
+
await BigCrunchInterstitial.show(PLACEMENT_ID);
|
|
207
|
+
}
|
|
208
|
+
};
|
|
139
209
|
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
210
|
+
return (
|
|
211
|
+
<Button title="Complete Level" onPress={handleLevelComplete} />
|
|
212
|
+
);
|
|
143
213
|
}
|
|
144
|
-
|
|
145
|
-
// Listen for events
|
|
146
|
-
BigCrunchInterstitial.addEventListener(
|
|
147
|
-
'interstitial-level-complete',
|
|
148
|
-
'adClosed',
|
|
149
|
-
() => {
|
|
150
|
-
console.log('Interstitial closed');
|
|
151
|
-
// Load next ad or continue game
|
|
152
|
-
}
|
|
153
|
-
);
|
|
154
214
|
```
|
|
155
215
|
|
|
216
|
+
#### Methods
|
|
217
|
+
|
|
218
|
+
| Method | Description |
|
|
219
|
+
|--------|-------------|
|
|
220
|
+
| `load(options)` | Load an interstitial ad |
|
|
221
|
+
| `show(placementId)` | Show a loaded interstitial |
|
|
222
|
+
| `isLoaded(placementId)` | Check if an ad is loaded |
|
|
223
|
+
| `destroy(placementId)` | Destroy an interstitial instance |
|
|
224
|
+
| `addEventListener(placementId, event, listener)` | Add an event listener |
|
|
225
|
+
|
|
226
|
+
#### Events
|
|
227
|
+
|
|
228
|
+
| Event | Description |
|
|
229
|
+
|-------|-------------|
|
|
230
|
+
| `'adLoaded'` | Ad loaded and ready to show |
|
|
231
|
+
| `'adFailedToLoad'` | Loading failed |
|
|
232
|
+
| `'adImpression'` | Impression recorded |
|
|
233
|
+
| `'adClicked'` | User tapped the ad |
|
|
234
|
+
| `'adOpened'` | Full-screen ad presented |
|
|
235
|
+
| `'adClosed'` | User dismissed the ad |
|
|
236
|
+
| `'adRevenue'` | Revenue event (ILRD) |
|
|
237
|
+
|
|
156
238
|
### Rewarded Ads
|
|
157
239
|
|
|
240
|
+
Full-screen ads that offer the user an in-app reward in exchange for watching. The API is identical to interstitials, with the addition of the `rewardEarned` event.
|
|
241
|
+
|
|
158
242
|
```typescript
|
|
243
|
+
import { useEffect, useRef, useState } from 'react';
|
|
244
|
+
import { Button, Alert } from 'react-native';
|
|
159
245
|
import { BigCrunchRewarded } from '@bigcrunch/react-native-ads';
|
|
246
|
+
import type { EventSubscription } from '@bigcrunch/react-native-ads';
|
|
247
|
+
|
|
248
|
+
const PLACEMENT_ID = 'rewarded-extra-life';
|
|
249
|
+
|
|
250
|
+
function GameOverScreen() {
|
|
251
|
+
const [adReady, setAdReady] = useState(false);
|
|
252
|
+
const subscriptions = useRef<EventSubscription[]>([]);
|
|
253
|
+
|
|
254
|
+
useEffect(() => {
|
|
255
|
+
BigCrunchRewarded.load({ placementId: PLACEMENT_ID });
|
|
256
|
+
|
|
257
|
+
subscriptions.current.push(
|
|
258
|
+
BigCrunchRewarded.addEventListener(PLACEMENT_ID, 'adLoaded', () => {
|
|
259
|
+
setAdReady(true);
|
|
260
|
+
}),
|
|
261
|
+
BigCrunchRewarded.addEventListener(PLACEMENT_ID, 'adClosed', () => {
|
|
262
|
+
setAdReady(false);
|
|
263
|
+
BigCrunchRewarded.load({ placementId: PLACEMENT_ID });
|
|
264
|
+
}),
|
|
265
|
+
BigCrunchRewarded.addEventListener(PLACEMENT_ID, 'rewardEarned', (event) => {
|
|
266
|
+
Alert.alert('Reward!', `You earned ${event.rewardAmount} ${event.rewardType}`);
|
|
267
|
+
})
|
|
268
|
+
);
|
|
160
269
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
}
|
|
270
|
+
return () => {
|
|
271
|
+
subscriptions.current.forEach((sub) => sub.remove());
|
|
272
|
+
BigCrunchRewarded.destroy(PLACEMENT_ID);
|
|
273
|
+
};
|
|
274
|
+
}, []);
|
|
275
|
+
|
|
276
|
+
const handleWatchAd = async () => {
|
|
277
|
+
if (await BigCrunchRewarded.isLoaded(PLACEMENT_ID)) {
|
|
278
|
+
await BigCrunchRewarded.show(PLACEMENT_ID);
|
|
279
|
+
}
|
|
280
|
+
};
|
|
172
281
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
'rewardEarned',
|
|
177
|
-
(event) => {
|
|
178
|
-
console.log(`User earned ${event.rewardAmount} ${event.rewardType}`);
|
|
179
|
-
// Grant reward to user
|
|
180
|
-
}
|
|
181
|
-
);
|
|
182
|
-
|
|
183
|
-
// Show the rewarded ad
|
|
184
|
-
async function showRewardedAd() {
|
|
185
|
-
const isLoaded = await BigCrunchRewarded.isLoaded('rewarded-extra-life');
|
|
186
|
-
|
|
187
|
-
if (isLoaded) {
|
|
188
|
-
await BigCrunchRewarded.show('rewarded-extra-life');
|
|
189
|
-
} else {
|
|
190
|
-
console.log('Rewarded ad not ready');
|
|
191
|
-
}
|
|
282
|
+
return (
|
|
283
|
+
<Button title="Watch Ad for Extra Life" onPress={handleWatchAd} disabled={!adReady} />
|
|
284
|
+
);
|
|
192
285
|
}
|
|
193
286
|
```
|
|
194
287
|
|
|
195
|
-
|
|
288
|
+
#### Additional Events
|
|
196
289
|
|
|
197
|
-
|
|
290
|
+
All interstitial events plus:
|
|
198
291
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
placementId="banner-home"
|
|
203
|
-
customTargeting={{
|
|
204
|
-
'user_level': '5',
|
|
205
|
-
'game_mode': 'survival'
|
|
206
|
-
}}
|
|
207
|
-
/>
|
|
208
|
-
|
|
209
|
-
// Interstitial with custom targeting
|
|
210
|
-
await BigCrunchInterstitial.load({
|
|
211
|
-
placementId: 'interstitial-level-complete',
|
|
212
|
-
customTargeting: {
|
|
213
|
-
'level': '10',
|
|
214
|
-
'score': 'high'
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
```
|
|
292
|
+
| Event | Description |
|
|
293
|
+
|-------|-------------|
|
|
294
|
+
| `'rewardEarned'` | User completed the ad and earned a reward. Includes `rewardType` (string) and `rewardAmount` (number). |
|
|
218
295
|
|
|
219
|
-
|
|
296
|
+
## Privacy & Compliance
|
|
220
297
|
|
|
221
298
|
```typescript
|
|
222
|
-
// GDPR
|
|
223
|
-
await BigCrunchAds.setGdprConsent('
|
|
299
|
+
// GDPR — pass IAB TCF consent string
|
|
300
|
+
await BigCrunchAds.setGdprConsent('consent-string-here');
|
|
224
301
|
|
|
225
|
-
// CCPA
|
|
302
|
+
// CCPA — pass IAB US Privacy string
|
|
226
303
|
await BigCrunchAds.setCcpaString('1YNN');
|
|
227
304
|
|
|
228
|
-
// COPPA
|
|
305
|
+
// COPPA — for apps directed at children
|
|
229
306
|
await BigCrunchAds.setCoppaCompliant(true);
|
|
230
307
|
```
|
|
231
308
|
|
|
232
|
-
|
|
309
|
+
## Verifying Your Integration
|
|
233
310
|
|
|
234
311
|
```typescript
|
|
235
|
-
//
|
|
312
|
+
// Check if SDK is initialized
|
|
313
|
+
const isReady = await BigCrunchAds.isInitialized();
|
|
314
|
+
console.log('SDK initialized:', isReady);
|
|
315
|
+
|
|
316
|
+
// Get session information
|
|
317
|
+
const session = await BigCrunchAds.getSessionInfo();
|
|
318
|
+
console.log('Session ID:', session.sessionId);
|
|
319
|
+
console.log('Screen views:', session.screenViewCount);
|
|
320
|
+
|
|
321
|
+
// Enable debug logging during development
|
|
236
322
|
await BigCrunchAds.setDebugMode(true);
|
|
237
323
|
|
|
238
|
-
//
|
|
324
|
+
// Register test devices to receive test ads
|
|
239
325
|
await BigCrunchAds.addTestDevice('YOUR_DEVICE_ID');
|
|
240
326
|
```
|
|
241
327
|
|
|
242
|
-
|
|
328
|
+
> **Finding your device ID:** Run your app with debug mode enabled, load an ad, and check the console output. The Google Mobile Ads SDK will log your device ID.
|
|
243
329
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
(event) => {
|
|
260
|
-
console.log('Revenue received:', event.revenue);
|
|
261
|
-
}
|
|
262
|
-
);
|
|
263
|
-
|
|
264
|
-
// Remove listener when done
|
|
265
|
-
subscription.remove();
|
|
266
|
-
```
|
|
330
|
+
## Error Codes
|
|
331
|
+
|
|
332
|
+
When an ad fails to load, the `AdError` object contains a `code` and `message`:
|
|
333
|
+
|
|
334
|
+
| Code | Description |
|
|
335
|
+
|------|-------------|
|
|
336
|
+
| `NETWORK_ERROR` | No network connectivity |
|
|
337
|
+
| `NO_FILL` | No ad available for this request |
|
|
338
|
+
| `INVALID_REQUEST` | Malformed ad request |
|
|
339
|
+
| `INTERNAL_ERROR` | Internal SDK error |
|
|
340
|
+
| `INVALID_PLACEMENT` | Placement ID not found in config |
|
|
341
|
+
| `NOT_INITIALIZED` | SDK not yet initialized |
|
|
342
|
+
| `ALREADY_LOADED` | An ad is already loaded for this placement |
|
|
343
|
+
| `NOT_LOADED` | Attempted to show an ad that isn't loaded |
|
|
344
|
+
| `TIMEOUT` | Ad request timed out |
|
|
267
345
|
|
|
268
346
|
## TypeScript Support
|
|
269
347
|
|
|
@@ -274,137 +352,53 @@ import type {
|
|
|
274
352
|
AdError,
|
|
275
353
|
AdRevenue,
|
|
276
354
|
BannerSize,
|
|
355
|
+
CustomSize,
|
|
277
356
|
PlacementConfig,
|
|
278
|
-
|
|
357
|
+
AppConfig,
|
|
358
|
+
SessionInfo,
|
|
359
|
+
EventSubscription,
|
|
360
|
+
AdErrorCode,
|
|
279
361
|
} from '@bigcrunch/react-native-ads';
|
|
280
362
|
```
|
|
281
363
|
|
|
282
|
-
##
|
|
283
|
-
|
|
284
|
-
### BigCrunchAds
|
|
285
|
-
|
|
286
|
-
| Method | Description |
|
|
287
|
-
|--------|-------------|
|
|
288
|
-
| `initialize(propertyId, environment)` | Initialize the SDK |
|
|
289
|
-
| `trackScreenView(screenName)` | Track a screen view |
|
|
290
|
-
| `getAppConfig()` | Get current app configuration |
|
|
291
|
-
| `getSessionInfo()` | Get current session information |
|
|
292
|
-
| `setGdprConsent(consent)` | Set GDPR consent string |
|
|
293
|
-
| `setCcpaString(ccpaString)` | Set CCPA compliance string |
|
|
294
|
-
| `setCoppaCompliant(isCompliant)` | Set COPPA compliance |
|
|
295
|
-
| `setDebugMode(enabled)` | Enable/disable debug mode |
|
|
296
|
-
|
|
297
|
-
### BigCrunchBannerView Props
|
|
298
|
-
|
|
299
|
-
| Prop | Type | Description |
|
|
300
|
-
|------|------|-------------|
|
|
301
|
-
| `placementId` | string | Required. Placement ID from dashboard |
|
|
302
|
-
| `size` | BannerSize \| CustomSize | Banner size (default: BANNER) |
|
|
303
|
-
| `autoLoad` | boolean | Auto-load ad on mount (default: true) |
|
|
304
|
-
| `refreshInterval` | number | Auto-refresh interval in seconds |
|
|
305
|
-
| `customTargeting` | object | Custom targeting parameters |
|
|
306
|
-
| `onAdLoaded` | function | Called when ad loads |
|
|
307
|
-
| `onAdFailedToLoad` | function | Called on load failure |
|
|
308
|
-
| `onAdImpression` | function | Called on impression |
|
|
309
|
-
| `onAdClicked` | function | Called on click |
|
|
310
|
-
| `onAdRevenue` | function | Called on revenue (ILRD) |
|
|
311
|
-
|
|
312
|
-
### BigCrunchInterstitial
|
|
313
|
-
|
|
314
|
-
| Method | Description |
|
|
315
|
-
|--------|-------------|
|
|
316
|
-
| `load(options)` | Load an interstitial ad |
|
|
317
|
-
| `show(placementId)` | Show a loaded interstitial |
|
|
318
|
-
| `isLoaded(placementId)` | Check if ad is loaded |
|
|
319
|
-
| `destroy(placementId)` | Destroy an interstitial instance |
|
|
320
|
-
| `addEventListener(placementId, event, listener)` | Add event listener |
|
|
321
|
-
|
|
322
|
-
### BigCrunchRewarded
|
|
323
|
-
|
|
324
|
-
| Method | Description |
|
|
325
|
-
|--------|-------------|
|
|
326
|
-
| `load(options)` | Load a rewarded ad |
|
|
327
|
-
| `show(placementId)` | Show a loaded rewarded ad |
|
|
328
|
-
| `isLoaded(placementId)` | Check if ad is loaded |
|
|
329
|
-
| `destroy(placementId)` | Destroy a rewarded instance |
|
|
330
|
-
| `addEventListener(placementId, event, listener)` | Add event listener |
|
|
331
|
-
| `onRewardEarned(placementId, listener)` | Listen for rewards |
|
|
332
|
-
|
|
333
|
-
## Error Handling
|
|
334
|
-
|
|
335
|
-
```typescript
|
|
336
|
-
import { AdErrorCode } from '@bigcrunch/react-native-ads';
|
|
337
|
-
|
|
338
|
-
// Handle banner errors
|
|
339
|
-
<BigCrunchBannerView
|
|
340
|
-
placementId="banner-home"
|
|
341
|
-
onAdFailedToLoad={(error) => {
|
|
342
|
-
switch (error.code) {
|
|
343
|
-
case AdErrorCode.NO_FILL:
|
|
344
|
-
console.log('No ads available');
|
|
345
|
-
break;
|
|
346
|
-
case AdErrorCode.NETWORK_ERROR:
|
|
347
|
-
console.log('Network error');
|
|
348
|
-
break;
|
|
349
|
-
case AdErrorCode.INVALID_PLACEMENT:
|
|
350
|
-
console.log('Invalid placement ID');
|
|
351
|
-
break;
|
|
352
|
-
default:
|
|
353
|
-
console.error('Ad error:', error.message);
|
|
354
|
-
}
|
|
355
|
-
}}
|
|
356
|
-
/>
|
|
357
|
-
```
|
|
364
|
+
## Full Documentation
|
|
358
365
|
|
|
359
|
-
|
|
366
|
+
- [Full Integration Guide (Tracking + Ads)](./docs/FULL_INTEGRATION.md)
|
|
367
|
+
- [Tracking-Only Integration Guide](./docs/TRACKING_ONLY_INTEGRATION.md)
|
|
368
|
+
- [Google Ad Manager Setup](./docs/GOOGLE_SETUP.md)
|
|
369
|
+
- [Testing Guide](./docs/TESTING_GUIDE.md)
|
|
370
|
+
- [Example App](./example)
|
|
360
371
|
|
|
361
|
-
|
|
372
|
+
## Troubleshooting
|
|
362
373
|
|
|
374
|
+
### iOS: Pod install fails
|
|
363
375
|
```bash
|
|
364
|
-
cd
|
|
365
|
-
|
|
366
|
-
|
|
376
|
+
cd ios
|
|
377
|
+
pod deintegrate
|
|
378
|
+
pod cache clean --all
|
|
379
|
+
pod install
|
|
367
380
|
```
|
|
368
381
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
1. **Manifest merger failed**: Check APPLICATION_ID in AndroidManifest.xml
|
|
380
|
-
2. **Build failures**: Sync project with Gradle files
|
|
381
|
-
3. **MultiDex issues**: Enable multidex in your app
|
|
382
|
-
|
|
383
|
-
### Common Issues
|
|
384
|
-
|
|
385
|
-
1. **Ads not loading**:
|
|
386
|
-
- Verify initialization is complete
|
|
387
|
-
- Check placement IDs match dashboard
|
|
388
|
-
- Ensure test mode is disabled in production
|
|
389
|
-
|
|
390
|
-
2. **Revenue not tracking**:
|
|
391
|
-
- Verify ILRD is enabled in Google Ad Manager
|
|
392
|
-
- Check revenue event listeners are set up
|
|
393
|
-
|
|
394
|
-
3. **TypeScript errors**:
|
|
395
|
-
- Update to latest version
|
|
396
|
-
- Rebuild TypeScript definitions: `npm run typescript`
|
|
397
|
-
|
|
398
|
-
## Requirements
|
|
399
|
-
|
|
400
|
-
- React Native 0.60+
|
|
401
|
-
- iOS 13.0+
|
|
402
|
-
- Android API 21+
|
|
403
|
-
- TypeScript 4.0+ (optional)
|
|
382
|
+
### Android: Build fails with duplicate classes
|
|
383
|
+
Add to `android/app/build.gradle`:
|
|
384
|
+
```gradle
|
|
385
|
+
android {
|
|
386
|
+
packagingOptions {
|
|
387
|
+
pickFirst 'META-INF/*'
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
```
|
|
404
391
|
|
|
405
|
-
|
|
392
|
+
### Ads not loading ("No Fill")
|
|
393
|
+
- Normal during testing — ad inventory varies by region and time
|
|
394
|
+
- Register your device as a test device to receive test ads
|
|
395
|
+
- Verify placement IDs match the BigCrunch dashboard
|
|
396
|
+
- Check the GAM App ID in `Info.plist` / `AndroidManifest.xml`
|
|
406
397
|
|
|
407
|
-
|
|
398
|
+
### Interstitial/Rewarded not showing
|
|
399
|
+
- Call `load()` before `show()`
|
|
400
|
+
- Check `isLoaded()` before calling `show()`
|
|
401
|
+
- Listen for `adFailedToLoad` events to diagnose issues
|
|
408
402
|
|
|
409
403
|
## Support
|
|
410
404
|
|
|
@@ -412,6 +406,6 @@ MIT
|
|
|
412
406
|
- Issues: https://github.com/bigcrunch/mobile-ads-sdk/issues
|
|
413
407
|
- Email: support@bigcrunch.com
|
|
414
408
|
|
|
415
|
-
##
|
|
409
|
+
## License
|
|
416
410
|
|
|
417
|
-
|
|
411
|
+
MIT
|
|
@@ -596,29 +596,6 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
596
596
|
map.putArray("sizes", sizesArray)
|
|
597
597
|
}
|
|
598
598
|
|
|
599
|
-
// Add bidders array if available
|
|
600
|
-
config.bidders?.let { bidders ->
|
|
601
|
-
val biddersArray = Arguments.createArray()
|
|
602
|
-
for (bidderConfig in bidders) {
|
|
603
|
-
val bidderMap = Arguments.createMap()
|
|
604
|
-
bidderMap.putString("bidder", bidderConfig.bidder)
|
|
605
|
-
bidderConfig.params?.let { params ->
|
|
606
|
-
val paramsMap = Arguments.createMap()
|
|
607
|
-
for ((key, value) in params) {
|
|
608
|
-
when (value) {
|
|
609
|
-
is String -> paramsMap.putString(key, value)
|
|
610
|
-
is Int -> paramsMap.putInt(key, value)
|
|
611
|
-
is Double -> paramsMap.putDouble(key, value)
|
|
612
|
-
is Boolean -> paramsMap.putBoolean(key, value)
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
bidderMap.putMap("params", paramsMap)
|
|
616
|
-
}
|
|
617
|
-
biddersArray.pushMap(bidderMap)
|
|
618
|
-
}
|
|
619
|
-
map.putArray("bidders", biddersArray)
|
|
620
|
-
}
|
|
621
|
-
|
|
622
599
|
// Add refresh config if available
|
|
623
600
|
config.refresh?.let { refresh ->
|
|
624
601
|
val refreshMap = Arguments.createMap()
|
|
@@ -257,9 +257,10 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
257
257
|
"appName": config.appName,
|
|
258
258
|
"environment": config.environment,
|
|
259
259
|
"gamNetworkCode": config.gamNetworkCode,
|
|
260
|
-
"
|
|
261
|
-
"
|
|
262
|
-
"
|
|
260
|
+
"s2s": [
|
|
261
|
+
"enabled": config.s2s.enabled,
|
|
262
|
+
"serverUrl": config.s2s.serverUrl,
|
|
263
|
+
"timeoutMs": config.s2s.timeoutMs
|
|
263
264
|
],
|
|
264
265
|
"placements": config.placements.map { placement in
|
|
265
266
|
var placementDict: [String: Any] = [
|
|
@@ -270,15 +271,6 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
270
271
|
if let sizes = placement.sizes {
|
|
271
272
|
placementDict["sizes"] = sizes.map { ["width": $0.width, "height": $0.height] }
|
|
272
273
|
}
|
|
273
|
-
if let bidders = placement.bidders {
|
|
274
|
-
placementDict["bidders"] = bidders.map { bidderConfig in
|
|
275
|
-
var bidderDict: [String: Any] = ["bidder": bidderConfig.bidder]
|
|
276
|
-
if let params = bidderConfig.params {
|
|
277
|
-
bidderDict["params"] = params.mapValues { $0.value }
|
|
278
|
-
}
|
|
279
|
-
return bidderDict
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
274
|
return placementDict
|
|
283
275
|
}
|
|
284
276
|
]
|
|
@@ -400,7 +392,7 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
400
392
|
return
|
|
401
393
|
}
|
|
402
394
|
|
|
403
|
-
// customTargeting can be used in future for custom
|
|
395
|
+
// customTargeting can be used in future for custom S2S targeting
|
|
404
396
|
// let customTargeting = options["customTargeting"] as? [String: String]
|
|
405
397
|
|
|
406
398
|
BigCrunchRewarded.preload(placementId: placementId) { [weak self] result in
|
package/lib/types/config.d.ts
CHANGED
|
@@ -10,6 +10,10 @@ export interface AppConfig {
|
|
|
10
10
|
propertyId: string;
|
|
11
11
|
/** Property name */
|
|
12
12
|
propertyName: string;
|
|
13
|
+
/** S2S auction configuration */
|
|
14
|
+
s2s?: S2SConfig;
|
|
15
|
+
/** Top-level bidder configurations (bidderName → BidderEntry) */
|
|
16
|
+
bidders?: Record<string, BidderEntry>;
|
|
13
17
|
/** List of configured placements */
|
|
14
18
|
placements: PlacementConfig[];
|
|
15
19
|
/** Global settings */
|
|
@@ -33,8 +37,6 @@ export interface PlacementConfig {
|
|
|
33
37
|
gamAdUnit: string;
|
|
34
38
|
/** Ad size configuration */
|
|
35
39
|
size?: AdSizeConfig;
|
|
36
|
-
/** Prebid bidder configurations */
|
|
37
|
-
bidders?: BidderConfig[];
|
|
38
40
|
/** Amazon APS configuration */
|
|
39
41
|
amazonConfig?: AmazonConfig;
|
|
40
42
|
/** Placement-specific settings */
|
|
@@ -54,16 +56,27 @@ export interface AdSizeConfig {
|
|
|
54
56
|
adaptive?: boolean;
|
|
55
57
|
}
|
|
56
58
|
/**
|
|
57
|
-
*
|
|
59
|
+
* S2S (server-to-server) configuration for bid requests
|
|
60
|
+
*/
|
|
61
|
+
export interface S2SConfig {
|
|
62
|
+
/** Whether S2S is enabled */
|
|
63
|
+
enabled: boolean;
|
|
64
|
+
/** S2S auction server URL */
|
|
65
|
+
serverUrl: string;
|
|
66
|
+
/** Timeout for S2S requests in milliseconds */
|
|
67
|
+
timeoutMs: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Configuration for a single bidder at the app level
|
|
58
71
|
*
|
|
59
|
-
* Contains
|
|
60
|
-
* to
|
|
72
|
+
* Contains shared bidder params and a map of placement-specific params.
|
|
73
|
+
* Bidder-to-placement mapping is resolved from this structure.
|
|
61
74
|
*/
|
|
62
|
-
export interface
|
|
63
|
-
/**
|
|
64
|
-
bidder: string;
|
|
65
|
-
/** Bidder-specific parameters */
|
|
75
|
+
export interface BidderEntry {
|
|
76
|
+
/** Shared bidder-level parameters */
|
|
66
77
|
params?: Record<string, any>;
|
|
78
|
+
/** Per-placement params: placementId → imp-level params */
|
|
79
|
+
placements?: Record<string, Record<string, any>>;
|
|
67
80
|
}
|
|
68
81
|
/**
|
|
69
82
|
* Amazon APS configuration
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,oBAAoB;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,oCAAoC;IACpC,UAA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AAC,EAAE,OAAO,CAAC;IACzB,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2BAA2B;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,0CAA0C;IAC1C,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,6BAA6B;IAC7B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,0BAA0B;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,6BAA6B;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,uBAAuB;IACvB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,iEAAiE;IACjE,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,iCAAiC;IACjC,OAAO,EAAE,OAAO,CAAC;IACjB,uCAAuC;IACvC,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,YAAY,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,sDAAsD;IACtD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,kCAAkC;IAClC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,uCAAuC;IACvC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,0CAA0C;IAC1C,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1C"}
|
package/lib/types/events.d.ts
CHANGED
|
@@ -44,7 +44,7 @@ export interface AdImpressionEvent extends BaseAdEvent {
|
|
|
44
44
|
gamAdUnit?: string;
|
|
45
45
|
/** Ad size (e.g., "320x50") */
|
|
46
46
|
adSize?: string;
|
|
47
|
-
/** Auction ID from
|
|
47
|
+
/** Auction ID from S2S bid request */
|
|
48
48
|
auctionId?: string;
|
|
49
49
|
/** Winning bidder name */
|
|
50
50
|
bidder?: string;
|
|
@@ -60,7 +60,7 @@ export interface AdImpressionEvent extends BaseAdEvent {
|
|
|
60
60
|
creativeId?: string;
|
|
61
61
|
/** Refresh count for this placement */
|
|
62
62
|
refreshCount?: number;
|
|
63
|
-
/** Demand channel (e.g., "
|
|
63
|
+
/** Demand channel (e.g., "S2S Header", "GAM Direct") */
|
|
64
64
|
demandChannel?: string;
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -219,7 +219,7 @@ export interface ImpressionEvent extends WebSchemaCommonFields {
|
|
|
219
219
|
gamAdUnit: string;
|
|
220
220
|
/** Ad format (banner, interstitial, rewarded) */
|
|
221
221
|
format: string;
|
|
222
|
-
/** Auction ID from
|
|
222
|
+
/** Auction ID from S2S bid request */
|
|
223
223
|
auctionId?: string;
|
|
224
224
|
/** Refresh count for this placement */
|
|
225
225
|
refreshCount?: number;
|
|
@@ -247,7 +247,7 @@ export interface ImpressionEvent extends WebSchemaCommonFields {
|
|
|
247
247
|
amznPrice?: string;
|
|
248
248
|
/** Demand type (banner, video, etc.) */
|
|
249
249
|
demandType?: string;
|
|
250
|
-
/** Demand channel (e.g., "
|
|
250
|
+
/** Demand channel (e.g., "S2S Header", "GAM Direct") */
|
|
251
251
|
demandChannel?: string;
|
|
252
252
|
}
|
|
253
253
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/types/events.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAEvD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,IAAI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AA2C;IAC3C,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,qBAAqB;IAC5D,uCAAuC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,kCAAkC;IAClC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigcrunch/react-native-ads",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with
|
|
3
|
+
"version": "0.4.0",
|
|
4
|
+
"description": "BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with S2S demand and Google Ad Manager",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
7
7
|
"react-native": "src/index.ts",
|
|
@@ -44,7 +44,8 @@
|
|
|
44
44
|
"ads",
|
|
45
45
|
"advertising",
|
|
46
46
|
"monetization",
|
|
47
|
-
"
|
|
47
|
+
"s2s",
|
|
48
|
+
"header-bidding",
|
|
48
49
|
"google-ad-manager",
|
|
49
50
|
"gam",
|
|
50
51
|
"banner",
|
|
@@ -7,7 +7,7 @@ Pod::Spec.new do |s|
|
|
|
7
7
|
s.version = package["version"]
|
|
8
8
|
s.summary = package["description"]
|
|
9
9
|
s.description = <<-DESC
|
|
10
|
-
BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with
|
|
10
|
+
BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with S2S demand and Google Ad Manager
|
|
11
11
|
DESC
|
|
12
12
|
s.homepage = "https://github.com/bigcrunch/mobile-ads-sdk"
|
|
13
13
|
s.license = "MIT"
|
|
@@ -21,7 +21,6 @@ Pod::Spec.new do |s|
|
|
|
21
21
|
s.dependency "React"
|
|
22
22
|
s.dependency "BigCrunchAds", "~> 0.1.0" # Reference to main iOS SDK
|
|
23
23
|
s.dependency "Google-Mobile-Ads-SDK", ">= 10.14.0"
|
|
24
|
-
s.dependency "PrebidMobile", "~> 2.3.1"
|
|
25
24
|
|
|
26
25
|
s.swift_version = "5.9"
|
|
27
26
|
end
|
package/src/types/config.ts
CHANGED
|
@@ -12,6 +12,10 @@ export interface AppConfig {
|
|
|
12
12
|
propertyId: string;
|
|
13
13
|
/** Property name */
|
|
14
14
|
propertyName: string;
|
|
15
|
+
/** S2S auction configuration */
|
|
16
|
+
s2s?: S2SConfig;
|
|
17
|
+
/** Top-level bidder configurations (bidderName → BidderEntry) */
|
|
18
|
+
bidders?: Record<string, BidderEntry>;
|
|
15
19
|
/** List of configured placements */
|
|
16
20
|
placements: PlacementConfig[];
|
|
17
21
|
/** Global settings */
|
|
@@ -36,8 +40,6 @@ export interface PlacementConfig {
|
|
|
36
40
|
gamAdUnit: string;
|
|
37
41
|
/** Ad size configuration */
|
|
38
42
|
size?: AdSizeConfig;
|
|
39
|
-
/** Prebid bidder configurations */
|
|
40
|
-
bidders?: BidderConfig[];
|
|
41
43
|
/** Amazon APS configuration */
|
|
42
44
|
amazonConfig?: AmazonConfig;
|
|
43
45
|
/** Placement-specific settings */
|
|
@@ -59,16 +61,28 @@ export interface AdSizeConfig {
|
|
|
59
61
|
}
|
|
60
62
|
|
|
61
63
|
/**
|
|
62
|
-
*
|
|
64
|
+
* S2S (server-to-server) configuration for bid requests
|
|
65
|
+
*/
|
|
66
|
+
export interface S2SConfig {
|
|
67
|
+
/** Whether S2S is enabled */
|
|
68
|
+
enabled: boolean;
|
|
69
|
+
/** S2S auction server URL */
|
|
70
|
+
serverUrl: string;
|
|
71
|
+
/** Timeout for S2S requests in milliseconds */
|
|
72
|
+
timeoutMs: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Configuration for a single bidder at the app level
|
|
63
77
|
*
|
|
64
|
-
* Contains
|
|
65
|
-
* to
|
|
78
|
+
* Contains shared bidder params and a map of placement-specific params.
|
|
79
|
+
* Bidder-to-placement mapping is resolved from this structure.
|
|
66
80
|
*/
|
|
67
|
-
export interface
|
|
68
|
-
/**
|
|
69
|
-
bidder: string;
|
|
70
|
-
/** Bidder-specific parameters */
|
|
81
|
+
export interface BidderEntry {
|
|
82
|
+
/** Shared bidder-level parameters */
|
|
71
83
|
params?: Record<string, any>;
|
|
84
|
+
/** Per-placement params: placementId → imp-level params */
|
|
85
|
+
placements?: Record<string, Record<string, any>>;
|
|
72
86
|
}
|
|
73
87
|
|
|
74
88
|
/**
|
package/src/types/events.ts
CHANGED
|
@@ -49,7 +49,7 @@ export interface AdImpressionEvent extends BaseAdEvent {
|
|
|
49
49
|
gamAdUnit?: string;
|
|
50
50
|
/** Ad size (e.g., "320x50") */
|
|
51
51
|
adSize?: string;
|
|
52
|
-
/** Auction ID from
|
|
52
|
+
/** Auction ID from S2S bid request */
|
|
53
53
|
auctionId?: string;
|
|
54
54
|
/** Winning bidder name */
|
|
55
55
|
bidder?: string;
|
|
@@ -65,7 +65,7 @@ export interface AdImpressionEvent extends BaseAdEvent {
|
|
|
65
65
|
creativeId?: string;
|
|
66
66
|
/** Refresh count for this placement */
|
|
67
67
|
refreshCount?: number;
|
|
68
|
-
/** Demand channel (e.g., "
|
|
68
|
+
/** Demand channel (e.g., "S2S Header", "GAM Direct") */
|
|
69
69
|
demandChannel?: string;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -246,7 +246,7 @@ export interface ImpressionEvent extends WebSchemaCommonFields {
|
|
|
246
246
|
gamAdUnit: string;
|
|
247
247
|
/** Ad format (banner, interstitial, rewarded) */
|
|
248
248
|
format: string;
|
|
249
|
-
/** Auction ID from
|
|
249
|
+
/** Auction ID from S2S bid request */
|
|
250
250
|
auctionId?: string;
|
|
251
251
|
/** Refresh count for this placement */
|
|
252
252
|
refreshCount?: number;
|
|
@@ -274,7 +274,7 @@ export interface ImpressionEvent extends WebSchemaCommonFields {
|
|
|
274
274
|
amznPrice?: string;
|
|
275
275
|
/** Demand type (banner, video, etc.) */
|
|
276
276
|
demandType?: string;
|
|
277
|
-
/** Demand channel (e.g., "
|
|
277
|
+
/** Demand channel (e.g., "S2S Header", "GAM Direct") */
|
|
278
278
|
demandChannel?: string;
|
|
279
279
|
}
|
|
280
280
|
|