@bigcrunch/react-native-ads 0.2.1 → 0.3.1
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/build.gradle +7 -3
- package/android/src/main/java/com/bigcrunch/ads/react/BigCrunchAdsModule.kt +21 -6
- package/android/src/main/java/com/bigcrunch/ads/react/BigCrunchBannerViewManager.kt +21 -5
- package/ios/BigCrunchAdsModule.swift +10 -6
- package/ios/BigCrunchBannerViewManager.swift +22 -27
- package/lib/BigCrunchAds.d.ts +1 -3
- package/lib/BigCrunchAds.d.ts.map +1 -1
- package/lib/BigCrunchAds.js +1 -4
- package/lib/types/config.d.ts +24 -29
- package/lib/types/config.d.ts.map +1 -1
- package/lib/types/index.d.ts +0 -2
- package/lib/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/react-native-bigcrunch-ads.podspec +1 -1
- package/src/BigCrunchAds.ts +0 -4
- package/src/types/config.ts +25 -30
- package/src/types/index.ts +0 -2
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
|
-
'production' // or 'sandbox'
|
|
64
|
-
);
|
|
65
|
-
console.log('BigCrunch Ads initialized successfully');
|
|
66
|
-
} catch (error) {
|
|
67
|
-
console.error('Failed to initialize BigCrunch Ads:', error);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
65
|
+
const PROPERTY_ID = 'YOUR_PROPERTY_ID';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
useEffect(() => {
|
|
69
|
+
initializeBigCrunch();
|
|
70
|
+
}, []);
|
|
70
71
|
|
|
71
|
-
|
|
72
|
-
|
|
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
|
+
}
|
|
73
85
|
```
|
|
74
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
|
+
|
|
75
92
|
### 2. Track Screen Views
|
|
76
93
|
|
|
77
94
|
```typescript
|
|
95
|
+
import { useEffect } from 'react';
|
|
78
96
|
import { BigCrunchAds } from '@bigcrunch/react-native-ads';
|
|
79
97
|
|
|
80
|
-
|
|
81
|
-
|
|
98
|
+
function HomeScreen() {
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
BigCrunchAds.trackScreenView('HomeScreen');
|
|
101
|
+
}, []);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
// Screen content
|
|
105
|
+
);
|
|
106
|
+
}
|
|
82
107
|
```
|
|
83
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
|
+
|
|
84
111
|
## Ad Formats
|
|
85
112
|
|
|
86
113
|
### Banner Ads
|
|
87
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
|
+
|
|
88
117
|
```tsx
|
|
89
118
|
import { BigCrunchBannerView } from '@bigcrunch/react-native-ads';
|
|
90
119
|
|
|
91
|
-
function
|
|
120
|
+
function ArticleScreen() {
|
|
92
121
|
return (
|
|
93
|
-
<View>
|
|
94
|
-
|
|
122
|
+
<View style={{ flex: 1 }}>
|
|
123
|
+
<Text>Article content...</Text>
|
|
95
124
|
|
|
96
125
|
<BigCrunchBannerView
|
|
97
|
-
placementId="banner-
|
|
98
|
-
size="BANNER" // or "MEDIUM_RECTANGLE", "ADAPTIVE", etc.
|
|
99
|
-
style={{ alignSelf: 'center' }}
|
|
126
|
+
placementId="your-banner-placement"
|
|
100
127
|
onAdLoaded={() => console.log('Banner loaded')}
|
|
101
|
-
onAdFailedToLoad={(error) => console.error('Banner failed:', error)}
|
|
102
|
-
onAdRevenue={(revenue) => console.log('Revenue:', revenue)}
|
|
128
|
+
onAdFailedToLoad={(error) => console.error('Banner failed:', error.message)}
|
|
103
129
|
/>
|
|
104
130
|
</View>
|
|
105
131
|
);
|
|
106
132
|
}
|
|
107
133
|
```
|
|
108
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
|
+
|
|
109
158
|
#### Available Banner Sizes
|
|
110
159
|
|
|
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, apiKey, 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
|
package/android/build.gradle
CHANGED
|
@@ -37,12 +37,12 @@ android {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
compileOptions {
|
|
40
|
-
sourceCompatibility JavaVersion.
|
|
41
|
-
targetCompatibility JavaVersion.
|
|
40
|
+
sourceCompatibility JavaVersion.VERSION_11
|
|
41
|
+
targetCompatibility JavaVersion.VERSION_11
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
kotlinOptions {
|
|
45
|
-
jvmTarget = '
|
|
45
|
+
jvmTarget = '11'
|
|
46
46
|
freeCompilerArgs += ['-Xskip-metadata-version-check']
|
|
47
47
|
}
|
|
48
48
|
}
|
|
@@ -64,6 +64,10 @@ dependencies {
|
|
|
64
64
|
// as transitive dependencies, eliminating the need for duplication
|
|
65
65
|
implementation project(':bigcrunch-ads')
|
|
66
66
|
|
|
67
|
+
// Google Ads SDK - needed at compile time for AdSize reference in BigCrunchBannerViewManager
|
|
68
|
+
// (main SDK uses 'implementation' so it's not transitively available)
|
|
69
|
+
compileOnly 'com.google.android.gms:play-services-ads:22.6.0'
|
|
70
|
+
|
|
67
71
|
// Coroutines - needed by React Native bridge code
|
|
68
72
|
// (Native SDK uses 'implementation' so not automatically transitive)
|
|
69
73
|
implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-android:1.6.4'
|
|
@@ -31,8 +31,6 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
31
31
|
try {
|
|
32
32
|
val propertyId = options.getString("propertyId")
|
|
33
33
|
?: throw IllegalArgumentException("propertyId is required")
|
|
34
|
-
val apiKey = options.getString("apiKey")
|
|
35
|
-
?: throw IllegalArgumentException("apiKey is required")
|
|
36
34
|
val environment = options.getString("environment") ?: "production"
|
|
37
35
|
val debug = if (options.hasKey("debug")) options.getBoolean("debug") else false
|
|
38
36
|
|
|
@@ -44,7 +42,6 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
44
42
|
BigCrunchAds.initialize(
|
|
45
43
|
context = context,
|
|
46
44
|
propertyId = propertyId,
|
|
47
|
-
apiKey = apiKey,
|
|
48
45
|
env = if (environment == "staging")
|
|
49
46
|
BigCrunchAds.Environment.Staging
|
|
50
47
|
else
|
|
@@ -599,9 +596,27 @@ class BigCrunchAdsModule(reactContext: ReactApplicationContext) :
|
|
|
599
596
|
map.putArray("sizes", sizesArray)
|
|
600
597
|
}
|
|
601
598
|
|
|
602
|
-
// Add
|
|
603
|
-
config.
|
|
604
|
-
|
|
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)
|
|
605
620
|
}
|
|
606
621
|
|
|
607
622
|
// Add refresh config if available
|
|
@@ -83,22 +83,38 @@ class BigCrunchBannerViewManager : SimpleViewManager<BigCrunchBannerView>() {
|
|
|
83
83
|
"MEDIUM_RECTANGLE" -> AdSize(300, 250)
|
|
84
84
|
"FULL_BANNER" -> AdSize(468, 60)
|
|
85
85
|
"LEADERBOARD" -> AdSize(728, 90)
|
|
86
|
-
"ADAPTIVE" -> AdSize(
|
|
87
|
-
"SMART" -> AdSize(
|
|
86
|
+
"ADAPTIVE" -> AdSize.adaptive(0)
|
|
87
|
+
"SMART" -> AdSize.adaptive(0) // Deprecated, use ADAPTIVE
|
|
88
88
|
else -> AdSize(320, 50)
|
|
89
89
|
}
|
|
90
90
|
view.setAdSize(adSize)
|
|
91
91
|
|
|
92
|
+
// For adaptive sizes, resolve concrete dimensions for layout
|
|
93
|
+
val layoutWidth: Int
|
|
94
|
+
val layoutHeight: Int
|
|
95
|
+
if (adSize.isAdaptive) {
|
|
96
|
+
val displayMetrics = view.resources.displayMetrics
|
|
97
|
+
val widthDp = (displayMetrics.widthPixels / displayMetrics.density).toInt()
|
|
98
|
+
val googleAdSize = com.google.android.gms.ads.AdSize
|
|
99
|
+
.getCurrentOrientationAnchoredAdaptiveBannerAdSize(view.context, widthDp)
|
|
100
|
+
layoutWidth = googleAdSize.width
|
|
101
|
+
layoutHeight = googleAdSize.height
|
|
102
|
+
} else {
|
|
103
|
+
layoutWidth = adSize.width
|
|
104
|
+
layoutHeight = adSize.height
|
|
105
|
+
}
|
|
106
|
+
|
|
92
107
|
// Set minimum height based on ad size to ensure visibility
|
|
93
108
|
val density = view.resources.displayMetrics.density
|
|
94
|
-
val minHeightPx = (
|
|
95
|
-
val minWidthPx = (
|
|
109
|
+
val minHeightPx = (layoutHeight * density).toInt()
|
|
110
|
+
val minWidthPx = (layoutWidth * density).toInt()
|
|
96
111
|
view.minimumHeight = minHeightPx
|
|
97
112
|
view.minimumWidth = minWidthPx
|
|
98
113
|
|
|
99
114
|
android.util.Log.d("BigCrunchBannerViewManager", """
|
|
100
115
|
=== SIZE SET ===
|
|
101
|
-
Ad size: ${adSize.width}x${adSize.height} dp
|
|
116
|
+
Ad size: ${adSize.width}x${adSize.height} dp (adaptive=${adSize.isAdaptive})
|
|
117
|
+
Layout size: ${layoutWidth}x${layoutHeight} dp
|
|
102
118
|
Density: $density
|
|
103
119
|
Minimum pixels: ${minWidthPx}x${minHeightPx}
|
|
104
120
|
View parent: ${view.parent?.javaClass?.simpleName}
|
|
@@ -196,9 +196,8 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
196
196
|
func initialize(options: NSDictionary,
|
|
197
197
|
resolver: @escaping RCTPromiseResolveBlock,
|
|
198
198
|
rejecter: @escaping RCTPromiseRejectBlock) {
|
|
199
|
-
guard let propertyId = options["propertyId"] as? String
|
|
200
|
-
|
|
201
|
-
rejecter("INIT_ERROR", "propertyId and apiKey are required", nil)
|
|
199
|
+
guard let propertyId = options["propertyId"] as? String else {
|
|
200
|
+
rejecter("INIT_ERROR", "propertyId is required", nil)
|
|
202
201
|
return
|
|
203
202
|
}
|
|
204
203
|
|
|
@@ -212,7 +211,6 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
212
211
|
|
|
213
212
|
BigCrunchAds.initialize(
|
|
214
213
|
propertyId: propertyId,
|
|
215
|
-
apiKey: apiKey,
|
|
216
214
|
env: env,
|
|
217
215
|
useMockConfig: useMockConfig
|
|
218
216
|
)
|
|
@@ -272,8 +270,14 @@ class BigCrunchAdsModule: RCTEventEmitter {
|
|
|
272
270
|
if let sizes = placement.sizes {
|
|
273
271
|
placementDict["sizes"] = sizes.map { ["width": $0.width, "height": $0.height] }
|
|
274
272
|
}
|
|
275
|
-
if let
|
|
276
|
-
placementDict["
|
|
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
|
+
}
|
|
277
281
|
}
|
|
278
282
|
return placementDict
|
|
279
283
|
}
|
|
@@ -152,50 +152,45 @@ class BigCrunchBannerViewWrapper: UIView {
|
|
|
152
152
|
func updateAdSize() {
|
|
153
153
|
guard let bannerView = bannerView else { return }
|
|
154
154
|
|
|
155
|
-
var
|
|
156
|
-
var
|
|
155
|
+
var googleAdSize: GoogleMobileAds.AdSize
|
|
156
|
+
var bcAdSize: BCAdSize
|
|
157
157
|
|
|
158
158
|
if let width = _customWidth, let height = _customHeight {
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
bcAdSize = BCAdSize(width: Int(width), height: Int(height))
|
|
160
|
+
googleAdSize = GoogleMobileAds.adSizeFor(cgSize: CGSize(width: width, height: height))
|
|
161
161
|
} else {
|
|
162
162
|
switch sizeString {
|
|
163
163
|
case "BANNER":
|
|
164
|
-
|
|
165
|
-
|
|
164
|
+
bcAdSize = BCAdSize(width: 320, height: 50)
|
|
165
|
+
googleAdSize = GoogleMobileAds.AdSizeBanner
|
|
166
166
|
case "LARGE_BANNER":
|
|
167
|
-
|
|
168
|
-
|
|
167
|
+
bcAdSize = BCAdSize(width: 320, height: 100)
|
|
168
|
+
googleAdSize = GoogleMobileAds.AdSizeLargeBanner
|
|
169
169
|
case "MEDIUM_RECTANGLE":
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
bcAdSize = BCAdSize(width: 300, height: 250)
|
|
171
|
+
googleAdSize = GoogleMobileAds.AdSizeMediumRectangle
|
|
172
172
|
case "FULL_BANNER":
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
bcAdSize = BCAdSize(width: 468, height: 60)
|
|
174
|
+
googleAdSize = GoogleMobileAds.AdSizeFullBanner
|
|
175
175
|
case "LEADERBOARD":
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
case "ADAPTIVE":
|
|
176
|
+
bcAdSize = BCAdSize(width: 728, height: 90)
|
|
177
|
+
googleAdSize = GoogleMobileAds.AdSizeLeaderboard
|
|
178
|
+
case "ADAPTIVE", "SMART":
|
|
179
179
|
let frame = self.frame.width > 0 ? self.frame : UIScreen.main.bounds
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
case "SMART":
|
|
183
|
-
// Smart banner is deprecated, use adaptive
|
|
184
|
-
let frame = self.frame.width > 0 ? self.frame : UIScreen.main.bounds
|
|
185
|
-
adSize = GoogleMobileAds.currentOrientationAnchoredAdaptiveBanner(width: frame.width)
|
|
186
|
-
sizeOverride = adSize.size
|
|
180
|
+
bcAdSize = BCAdSize.adaptive(width: Int(frame.width))
|
|
181
|
+
googleAdSize = GoogleMobileAds.currentOrientationAnchoredAdaptiveBanner(width: frame.width)
|
|
187
182
|
default:
|
|
188
|
-
|
|
189
|
-
|
|
183
|
+
bcAdSize = BCAdSize(width: 320, height: 50)
|
|
184
|
+
googleAdSize = GoogleMobileAds.AdSizeBanner
|
|
190
185
|
}
|
|
191
186
|
}
|
|
192
187
|
|
|
193
188
|
// Set the size override on the native banner view
|
|
194
|
-
bannerView.adSizeOverride =
|
|
189
|
+
bannerView.adSizeOverride = bcAdSize
|
|
195
190
|
|
|
196
|
-
// Update frame constraints
|
|
191
|
+
// Update frame constraints using resolved Google size for layout
|
|
197
192
|
if _customWidth == nil && _customHeight == nil {
|
|
198
|
-
self.frame.size =
|
|
193
|
+
self.frame.size = googleAdSize.size
|
|
199
194
|
}
|
|
200
195
|
}
|
|
201
196
|
|
package/lib/BigCrunchAds.d.ts
CHANGED
|
@@ -14,7 +14,6 @@ export declare class BigCrunchAds {
|
|
|
14
14
|
* Must be called before using any other SDK features
|
|
15
15
|
*
|
|
16
16
|
* @param propertyId - Your BigCrunch property ID
|
|
17
|
-
* @param apiKey - Your API key for authentication
|
|
18
17
|
* @param environment - Environment to use (default: 'production')
|
|
19
18
|
* @param options - Additional initialization options
|
|
20
19
|
*
|
|
@@ -22,12 +21,11 @@ export declare class BigCrunchAds {
|
|
|
22
21
|
* ```typescript
|
|
23
22
|
* await BigCrunchAds.initialize(
|
|
24
23
|
* 'your-property-id',
|
|
25
|
-
* 'your-api-key',
|
|
26
24
|
* 'production'
|
|
27
25
|
* );
|
|
28
26
|
* ```
|
|
29
27
|
*/
|
|
30
|
-
static initialize(propertyId: string,
|
|
28
|
+
static initialize(propertyId: string, environment?: Environment, options?: Partial<InitializationOptions>): Promise<void>;
|
|
31
29
|
/**
|
|
32
30
|
* Check if the SDK is initialized
|
|
33
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BigCrunchAds.d.ts","sourceRoot":"","sources":["../src/BigCrunchAds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAS;IACzC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAA8B;IAElE
|
|
1
|
+
{"version":3,"file":"BigCrunchAds.d.ts","sourceRoot":"","sources":["../src/BigCrunchAds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH,OAAO,KAAK,EACV,qBAAqB,EACrB,WAAW,EACX,WAAW,EACX,aAAa,EACb,SAAS,EACT,iBAAiB,EAClB,MAAM,SAAS,CAAC;AAEjB;;GAEG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAS;IACzC,OAAO,CAAC,MAAM,CAAC,qBAAqB,CAA8B;IAElE;;;;;;;;;;;;;;;OAeG;WACU,UAAU,CACrB,UAAU,EAAE,MAAM,EAClB,WAAW,GAAE,WAA0B,EACvC,OAAO,CAAC,EAAE,OAAO,CAAC,qBAAqB,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC;IA0BhB;;OAEG;WACU,aAAa,IAAI,OAAO,CAAC,OAAO,CAAC;IAO9C;;;;;;;;;O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AI,OAAO,CAAC,IAAI,CAAC;IAIhD;;;;;;OAMG;IACH,MAAM,CAAC,gBAAgB,CACrB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,IAAI,GAC7B,iBAAiB;IAOpB;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,IAAI,GAAG,iBAAiB;IAIhF;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,GAAG,iBAAiB;IAI1E;;OAEG;IACH,MAAM,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,GAAG,iBAAiB;IAIpF;;OAEG;IACH,MAAM,CAAC,cAAc,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,WAAW,KAAK,IAAI,GAAG,iBAAiB;IAIlF;;;OAGG;IACH,OAAO,CAAC,MAAM,CAAC,iBAAiB;CAOjC;AAGD,eAAe,YAAY,CAAC"}
|
package/lib/BigCrunchAds.js
CHANGED
|
@@ -14,7 +14,6 @@ export class BigCrunchAds {
|
|
|
14
14
|
* Must be called before using any other SDK features
|
|
15
15
|
*
|
|
16
16
|
* @param propertyId - Your BigCrunch property ID
|
|
17
|
-
* @param apiKey - Your API key for authentication
|
|
18
17
|
* @param environment - Environment to use (default: 'production')
|
|
19
18
|
* @param options - Additional initialization options
|
|
20
19
|
*
|
|
@@ -22,19 +21,17 @@ export class BigCrunchAds {
|
|
|
22
21
|
* ```typescript
|
|
23
22
|
* await BigCrunchAds.initialize(
|
|
24
23
|
* 'your-property-id',
|
|
25
|
-
* 'your-api-key',
|
|
26
24
|
* 'production'
|
|
27
25
|
* );
|
|
28
26
|
* ```
|
|
29
27
|
*/
|
|
30
|
-
static async initialize(propertyId,
|
|
28
|
+
static async initialize(propertyId, environment = 'production', options) {
|
|
31
29
|
if (this.isInitializedFlag) {
|
|
32
30
|
console.warn('BigCrunchAds: SDK is already initialized');
|
|
33
31
|
return this.initializationPromise;
|
|
34
32
|
}
|
|
35
33
|
const initOptions = {
|
|
36
34
|
propertyId,
|
|
37
|
-
apiKey,
|
|
38
35
|
environment,
|
|
39
36
|
...options,
|
|
40
37
|
};
|
package/lib/types/config.d.ts
CHANGED
|
@@ -33,8 +33,8 @@ export interface PlacementConfig {
|
|
|
33
33
|
gamAdUnit: string;
|
|
34
34
|
/** Ad size configuration */
|
|
35
35
|
size?: AdSizeConfig;
|
|
36
|
-
/** Prebid
|
|
37
|
-
|
|
36
|
+
/** Prebid bidder configurations */
|
|
37
|
+
bidders?: BidderConfig[];
|
|
38
38
|
/** Amazon APS configuration */
|
|
39
39
|
amazonConfig?: AmazonConfig;
|
|
40
40
|
/** Placement-specific settings */
|
|
@@ -54,34 +54,16 @@ export interface AdSizeConfig {
|
|
|
54
54
|
adaptive?: boolean;
|
|
55
55
|
}
|
|
56
56
|
/**
|
|
57
|
-
* Prebid
|
|
57
|
+
* Configuration for a single Prebid bidder
|
|
58
|
+
*
|
|
59
|
+
* Contains the bidder name and its params, which get passed inline
|
|
60
|
+
* to the S2S endpoint in the bid request.
|
|
58
61
|
*/
|
|
59
|
-
export interface
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
|
|
64
|
-
/** Timeout for prebid requests in milliseconds */
|
|
65
|
-
timeout?: number;
|
|
66
|
-
/** Enable debug mode for prebid */
|
|
67
|
-
debug?: boolean;
|
|
68
|
-
/** Custom targeting parameters */
|
|
69
|
-
customTargeting?: Record<string, string>;
|
|
70
|
-
/** Price granularity */
|
|
71
|
-
priceGranularity?: 'low' | 'medium' | 'high' | 'auto' | 'dense' | 'custom';
|
|
72
|
-
/** Custom price granularity buckets */
|
|
73
|
-
customPriceGranularity?: PriceGranularityBucket[];
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* Price granularity bucket configuration
|
|
77
|
-
*/
|
|
78
|
-
export interface PriceGranularityBucket {
|
|
79
|
-
/** Minimum price */
|
|
80
|
-
min: number;
|
|
81
|
-
/** Maximum price */
|
|
82
|
-
max: number;
|
|
83
|
-
/** Increment */
|
|
84
|
-
increment: number;
|
|
62
|
+
export interface BidderConfig {
|
|
63
|
+
/** Bidder name (e.g., "appnexus", "rubicon") */
|
|
64
|
+
bidder: string;
|
|
65
|
+
/** Bidder-specific parameters */
|
|
66
|
+
params?: Record<string, any>;
|
|
85
67
|
}
|
|
86
68
|
/**
|
|
87
69
|
* Amazon APS configuration
|
|
@@ -118,6 +100,19 @@ export interface GlobalSettings {
|
|
|
118
100
|
ccpaString?: string;
|
|
119
101
|
/** COPPA compliance */
|
|
120
102
|
coppaCompliant?: boolean;
|
|
103
|
+
/** Global refresh config (defaults for all banner placements) */
|
|
104
|
+
refresh?: RefreshConfig;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Refresh configuration for banner ads
|
|
108
|
+
*/
|
|
109
|
+
export interface RefreshConfig {
|
|
110
|
+
/** Whether refresh is enabled */
|
|
111
|
+
enabled: boolean;
|
|
112
|
+
/** Refresh interval in milliseconds */
|
|
113
|
+
intervalMs: number;
|
|
114
|
+
/** Maximum number of refreshes */
|
|
115
|
+
maxRefreshes: number;
|
|
121
116
|
}
|
|
122
117
|
/**
|
|
123
118
|
* Placement-specific settings
|
|
@@ -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,UAAU,EAAE,eAAe,EAAE,CAAC;IAC9B,sBAAsB;IACtB,QAAQ,CAAC,EAA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AC;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/index.d.ts
CHANGED
|
@@ -30,8 +30,6 @@ export interface CustomSize {
|
|
|
30
30
|
export interface InitializationOptions {
|
|
31
31
|
/** Your BigCrunch property ID */
|
|
32
32
|
propertyId: string;
|
|
33
|
-
/** Your API key for authentication */
|
|
34
|
-
apiKey: string;
|
|
35
33
|
/** Environment to use */
|
|
36
34
|
environment?: Environment;
|
|
37
35
|
/** Enable debug logging */
|
package/lib/types/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,OAAO,CAAC;AAEtB;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;AAEnD;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,cAAc,GAAG,UAAU,CAAC;AAE9D;;GAEG;AACH,MAAM,MAAM,UAAU,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AAC;IAClB,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bigcrunch/react-native-ads",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "BigCrunch Mobile Ads SDK for React Native - Simplified in-app advertising with Prebid and Google Ad Manager",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -21,7 +21,7 @@ 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.1
|
|
24
|
+
s.dependency "PrebidMobile", "~> 2.3.1"
|
|
25
25
|
|
|
26
26
|
s.swift_version = "5.9"
|
|
27
27
|
end
|
package/src/BigCrunchAds.ts
CHANGED
|
@@ -29,7 +29,6 @@ export class BigCrunchAds {
|
|
|
29
29
|
* Must be called before using any other SDK features
|
|
30
30
|
*
|
|
31
31
|
* @param propertyId - Your BigCrunch property ID
|
|
32
|
-
* @param apiKey - Your API key for authentication
|
|
33
32
|
* @param environment - Environment to use (default: 'production')
|
|
34
33
|
* @param options - Additional initialization options
|
|
35
34
|
*
|
|
@@ -37,14 +36,12 @@ export class BigCrunchAds {
|
|
|
37
36
|
* ```typescript
|
|
38
37
|
* await BigCrunchAds.initialize(
|
|
39
38
|
* 'your-property-id',
|
|
40
|
-
* 'your-api-key',
|
|
41
39
|
* 'production'
|
|
42
40
|
* );
|
|
43
41
|
* ```
|
|
44
42
|
*/
|
|
45
43
|
static async initialize(
|
|
46
44
|
propertyId: string,
|
|
47
|
-
apiKey: string,
|
|
48
45
|
environment: Environment = 'production',
|
|
49
46
|
options?: Partial<InitializationOptions>
|
|
50
47
|
): Promise<void> {
|
|
@@ -55,7 +52,6 @@ export class BigCrunchAds {
|
|
|
55
52
|
|
|
56
53
|
const initOptions: InitializationOptions = {
|
|
57
54
|
propertyId,
|
|
58
|
-
apiKey,
|
|
59
55
|
environment,
|
|
60
56
|
...options,
|
|
61
57
|
};
|
package/src/types/config.ts
CHANGED
|
@@ -36,8 +36,8 @@ export interface PlacementConfig {
|
|
|
36
36
|
gamAdUnit: string;
|
|
37
37
|
/** Ad size configuration */
|
|
38
38
|
size?: AdSizeConfig;
|
|
39
|
-
/** Prebid
|
|
40
|
-
|
|
39
|
+
/** Prebid bidder configurations */
|
|
40
|
+
bidders?: BidderConfig[];
|
|
41
41
|
/** Amazon APS configuration */
|
|
42
42
|
amazonConfig?: AmazonConfig;
|
|
43
43
|
/** Placement-specific settings */
|
|
@@ -59,35 +59,16 @@ export interface AdSizeConfig {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
62
|
-
* Prebid
|
|
62
|
+
* Configuration for a single Prebid bidder
|
|
63
|
+
*
|
|
64
|
+
* Contains the bidder name and its params, which get passed inline
|
|
65
|
+
* to the S2S endpoint in the bid request.
|
|
63
66
|
*/
|
|
64
|
-
export interface
|
|
65
|
-
/**
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
/** Timeout for prebid requests in milliseconds */
|
|
70
|
-
timeout?: number;
|
|
71
|
-
/** Enable debug mode for prebid */
|
|
72
|
-
debug?: boolean;
|
|
73
|
-
/** Custom targeting parameters */
|
|
74
|
-
customTargeting?: Record<string, string>;
|
|
75
|
-
/** Price granularity */
|
|
76
|
-
priceGranularity?: 'low' | 'medium' | 'high' | 'auto' | 'dense' | 'custom';
|
|
77
|
-
/** Custom price granularity buckets */
|
|
78
|
-
customPriceGranularity?: PriceGranularityBucket[];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Price granularity bucket configuration
|
|
83
|
-
*/
|
|
84
|
-
export interface PriceGranularityBucket {
|
|
85
|
-
/** Minimum price */
|
|
86
|
-
min: number;
|
|
87
|
-
/** Maximum price */
|
|
88
|
-
max: number;
|
|
89
|
-
/** Increment */
|
|
90
|
-
increment: number;
|
|
67
|
+
export interface BidderConfig {
|
|
68
|
+
/** Bidder name (e.g., "appnexus", "rubicon") */
|
|
69
|
+
bidder: string;
|
|
70
|
+
/** Bidder-specific parameters */
|
|
71
|
+
params?: Record<string, any>;
|
|
91
72
|
}
|
|
92
73
|
|
|
93
74
|
/**
|
|
@@ -126,6 +107,20 @@ export interface GlobalSettings {
|
|
|
126
107
|
ccpaString?: string;
|
|
127
108
|
/** COPPA compliance */
|
|
128
109
|
coppaCompliant?: boolean;
|
|
110
|
+
/** Global refresh config (defaults for all banner placements) */
|
|
111
|
+
refresh?: RefreshConfig;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Refresh configuration for banner ads
|
|
116
|
+
*/
|
|
117
|
+
export interface RefreshConfig {
|
|
118
|
+
/** Whether refresh is enabled */
|
|
119
|
+
enabled: boolean;
|
|
120
|
+
/** Refresh interval in milliseconds */
|
|
121
|
+
intervalMs: number;
|
|
122
|
+
/** Maximum number of refreshes */
|
|
123
|
+
maxRefreshes: number;
|
|
129
124
|
}
|
|
130
125
|
|
|
131
126
|
/**
|
package/src/types/index.ts
CHANGED
|
@@ -43,8 +43,6 @@ export interface CustomSize {
|
|
|
43
43
|
export interface InitializationOptions {
|
|
44
44
|
/** Your BigCrunch property ID */
|
|
45
45
|
propertyId: string;
|
|
46
|
-
/** Your API key for authentication */
|
|
47
|
-
apiKey: string;
|
|
48
46
|
/** Environment to use */
|
|
49
47
|
environment?: Environment;
|
|
50
48
|
/** Enable debug logging */
|