プレースメントを追加する (レガシー)
始める前に始める前に への直接リンク
Rokt iOS SDKが、こちらに記載されている手順に従って、すでにアプリケーションに統合されていることを確認してください。
オーバーレイプレースメントオーバーレイプレースメント への直接リンク
ご希望のViewControllerでRokt iOS SDKを実行し、適切な顧客属性をすべて追加します。以下のコード例では、ViewDidLoadを使用してRoktオーバーレイプレースメントを表示します。
SDKは、ビューがロードおよびアンロードされるときのオプションのコールバックイベントを提供します。
- Swift
- Objective-C
- SwiftUI
import Rokt_Widget
class OrderConfirmationViewController: UIViewController {
// プレースメントを表示する必要があるときにこの関数を呼び出します
func showWidget() {
let attributes = ["email": "j.smith@example.com",
"firstname": "Jenny",
"lastname": "Smith",
"mobile": "(555)867-5309",
"postcode": "90210",
"country": "US"]
Rokt.execute(viewName: "RoktExperience", attributes: attributes, onLoad: {
// Roktプレースメントがロードされたときのオプションのコールバック
}, onUnLoad: {
// Roktプレースメントがアンロードされたときのオプションのコールバック
}, onShouldShowLoadingIndicator: {
// ローディングインジケーターを表示するためのオプションのコールバック
}, onShouldHideLoadingIndicator: {
// ローディングインジケーターを非表示にするためのオプションのコールバック
})
}
}
#import <Rokt_Widget/Rokt_Widget-Swift.h>
// 配置を表示する必要があるときにこの関数を呼び出します
- (void)showWidget {
NSDictionary *attributes = @{
@"email" : @"j.smith@example.com",
@"firstname": @"Jenny",
@"lastname": @"Smith",
@"mobile": @"(555)867-5309",
@"postcode": @"90210",
@"country": @"US"
};
[Rokt executeWithViewName:@"RoktExperience"
attributes:attributes
placements:nil
onLoad:^{
// Rokt配置がロードされたときのオプションのコールバック
} onUnLoad:^{
// Rokt配置がアンロードされたときのオプションのコールバック
} onShouldShowLoadingIndicator:^{
// ローディングインジケーターを表示するためのオプションのコールバック
} onShouldHideLoadingIndicator:^{
// ローディングインジケーターを隠すためのオプションのコールバック
} onEmbeddedSizeChange:^(NSString *selectedPlacement, CGFloat widgetHeight) {
// フルスクリーンオーバーレイには必要ありません
}];
}
import SwiftUI
import Rokt_Widget
class OrderConfirmationViewController: View {
func showPlacement() {
let attributes = ["email": "j.smith@example.com",
"firstname": "Jenny",
"lastname": "Smith",
"mobile": "(555)867-5309",
"postcode": "90210",
"country": "US"]
Rokt.execute(viewName: "RoktExperience",
attributes: attributes,
onLoad: {
// Rokt配置がロードされたときのオプションのコールバック
}, onUnLoad: {
// Rokt配置がアンロードされたときのオプションのコールバック
}, onShouldShowLoadingIndicator: {
// ローディングインジケーターを表示するためのオプションのコールバック
}, onShouldHideLoadingIndicator: {
// ローディングインジケーターを隠すためのオプションのコールバック
})
}
}
オプション機能オプション機能 への直接リンク
| 機能 | 目的 |
|---|---|
Rokt.close() | オーバーレイ配置を自動的に閉じるために使用されます。 |