-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #696 from IABTechLab/dsc/prebid-ios-documentation
Add iOS to Prebid mobile documentation
- Loading branch information
Showing
4 changed files
with
26 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import Tabs from '@theme/Tabs'; | ||
import TabItem from '@theme/TabItem'; | ||
|
||
This section is for participants who want to integrate with UID2 and use the [Prebid Mobile SDK](https://prebid.org/product-suite/prebid-mobile/) for header bidding in Android <!-- and iOS -->applications. | ||
This section is for participants who want to integrate with UID2 and use the [Prebid Mobile SDK](https://prebid.org/product-suite/prebid-mobile/) for header bidding in Android and iOS applications. | ||
|
||
The UID2 Prebid integration monitors the state of the `UID2Identity`. Whenever the state changes, the Prebid integration automatically updates Prebid’s external user IDs. This includes when an identity is refreshed, resulting in a new advertising token. | ||
|
||
|
@@ -13,92 +13,20 @@ This integration requires a Prebid Server setup. | |
|
||
To configure your UID2 Prebid for Mobile integration, follow the steps below. | ||
|
||
1. Set up Prebid's Mobile SDK for Android, following the steps in [Prebid SDK Integration for Android](https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html). | ||
1. Set up Prebid's Mobile SDK, following the steps in [Prebid SDK Integration for Android](https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html) or [Prebid SDK Integration for iOS](https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html). | ||
|
||
2. Add the UID2 Mobile SDK to your app, following the steps in [Add the UID2 Mobile SDK to Your Mobile App](#add-the-uid2-mobile-sdk-to-your-mobile-app). | ||
|
||
3. The UID2 Prebid integration is distributed as a separate module, so you must add it as a dependency in your project. Follow the installation instructions that apply to your integration, out of the following options: | ||
|
||
- **Gradle**: Include the following in your Gradle configuration: | ||
```js | ||
implementation("com.uid2:uid2-android-sdk-prebid:1.4.0") | ||
``` | ||
|
||
- **Maven**: To install with Maven, add the SDK as a dependency in the `pom.xml` file: | ||
```xml | ||
<dependency> | ||
<groupId>com.uid2</groupId> | ||
<artifactId>uid2-android-sdk-prebid</artifactId> | ||
<version>1.4.0</version> | ||
</dependency> | ||
``` | ||
|
||
4. After adding the dependency, you'll need to configure the integration. First initialize the `UID2Manager`, and then Prebid, as shown in the following examples. | ||
|
||
<Tabs groupId="language-selection"> | ||
<TabItem value='android' label='Android Kotlin'> | ||
```js | ||
UID2Manager.init(context = this) | ||
|
||
PrebidMobile.initializeSdk(this) { Log.i(TAG, "Prebid: $it") } | ||
prebid = UID2Prebid().apply { | ||
initialize() | ||
} | ||
``` | ||
</TabItem> | ||
<TabItem value='android-java' label='Android Java'> | ||
```js | ||
UID2Manager.init(this); | ||
|
||
PrebidMobile.initializeSdk(this, status -> Log.i(TAG, "Prebid: " + status)); | ||
|
||
prebid = new UID2Prebid(); | ||
prebid.initialize(); | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
5. Configure a callback that's passed in during initialization. | ||
|
||
The UID2 Prebid integration periodically updates Prebid by setting the relevant external IDs when a new identity is generated or an existing token is refreshed. | ||
|
||
This process is destructive, which means that if your application uses external IDs from another source, you'll need to provide those to the UID2 Prebid integration so that all external IDs are retained while the UID2 token is updated. | ||
|
||
This is done via the callback, which must be passed in during initialization, as shown in the following examples. | ||
|
||
<Tabs groupId="language-selection"> | ||
<TabItem value='android' label='Android Kotlin'> | ||
```js | ||
prebid = UID2Prebid( | ||
externalUserIdFactory = ::getExternalIds, | ||
).apply { | ||
initialize() | ||
} | ||
``` | ||
</TabItem> | ||
<TabItem value='android-java' label='Android Java'> | ||
```js | ||
prebid = new UID2Prebid(UID2Manager.getInstance(), () -> getExternalIds()); | ||
prebid.initialize(); | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
||
<!-- | ||
1. Set up Prebid's Mobile SDK for Android, following the steps in [Prebid SDK Integration for Android](https://docs.prebid.org/prebid-mobile/pbm-api/android/code-integration-android.html). | ||
|
||
2. Add the UID2 Mobile SDK to your app, following the steps in [Add the UID2 Mobile SDK to Your Mobile App](#add-the-uid2-mobile-sdk-to-your-mobile-app). | ||
|
||
3. The UID2 Prebid integration is distributed as a separate module, so you must add it as a dependency in your project. Follow the installation instructions that apply to your integration, out of the following options. | ||
|
||
<Tabs groupId="language-selection"> | ||
<TabItem value='android' label='Android'> | ||
#### Installing with Gradle | ||
<Tabs groupId="dependency-selection"> | ||
<TabItem value='gradle' label='Gradle (Android)'> | ||
Include the following in your Gradle configuration: | ||
```js | ||
implementation("com.uid2:uid2-android-sdk-prebid:1.4.0") | ||
``` | ||
#### Installing with Maven | ||
</TabItem> | ||
<TabItem value='maven' label='Maven (Android)'> | ||
To install with Maven, add the SDK as a dependency in the `pom.xml` file: | ||
```xml | ||
<dependency> | ||
|
@@ -108,28 +36,17 @@ To configure your UID2 Prebid for Mobile integration, follow the steps below. | |
</dependency> | ||
``` | ||
</TabItem> | ||
<TabItem value='ios' label='iOS'> | ||
#### Installing with Package.swift | ||
Add the following dependency to Package.swift: | ||
<TabItem value='cocoapods' label='CocoaPods (iOS)'> | ||
Add the following entry in your `Podfile`: | ||
```js | ||
dependencies: [ | ||
.package(url: "https://github.com/IABTechLab/uid2-ios-sdk.git", from: "1.2.0"), // TODO change | ||
] | ||
``` | ||
#### Installing with Xcode | ||
In the XCode user interface, under Package Dependencies, add the following entry for your apps: | ||
| Name | Location | Dependency Rule | | ||
| :----------- | :------------------------------------------- |:----------------------------------------| | ||
| uid2-ios-sdk | `[email protected]:IABTechLab/uid2-ios-sdk.git` | Up to next major version: 1.2.0 < 2.0.0 | | ||
|
||
#### Installing with CocoaPods | ||
|
||
Add the following entry in your `Podfile`: | ||
|
||
``` | ||
pod 'UID2', '~> 1.2' // TODO change | ||
pod 'UID2Prebid', '~> 1.5' | ||
``` | ||
</TabItem> | ||
<TabItem value='spm' label='SPM (iOS)'> | ||
:::warning | ||
Integration via Swift Package Manager is not supported until it is supported by the Prebid Mobile SDK itself. For details, see [Prebid's Mobile SDK documentation](https://docs.prebid.org/prebid-mobile/pbm-api/ios/code-integration-ios.html#swift-pm). | ||
::: | ||
</TabItem> | ||
</Tabs> | ||
|
||
4. After adding the dependency, you'll need to configure the integration. First initialize the `UID2Manager`, and then Prebid, as shown in the following examples. | ||
|
@@ -155,9 +72,10 @@ To configure your UID2 Prebid for Mobile integration, follow the steps below. | |
prebid.initialize(); | ||
``` | ||
</TabItem> | ||
<TabItem value='ios' label='iOS'> | ||
<TabItem value='ios' label='iOS Swift'> | ||
Initialize an instance of UID2Prebid and hold a strong reference to it. UID2Prebid only observes the UID2Manager while the instance is retained. | ||
```js | ||
// TODO | ||
self.prebid = UID2Prebid() | ||
``` | ||
</TabItem> | ||
</Tabs> | ||
|
@@ -186,9 +104,11 @@ To configure your UID2 Prebid for Mobile integration, follow the steps below. | |
prebid.initialize(); | ||
``` | ||
</TabItem> | ||
<TabItem value='ios' label='iOS'> | ||
<TabItem value='ios' label='iOS Swift'> | ||
```js | ||
// TODO | ||
self.prebid = UID2Prebid(thirdPartyUserIDs: { | ||
// return externalUserIDs | ||
}) | ||
``` | ||
</TabItem> | ||
</Tabs> --> | ||
</Tabs> |