important:
This page references our older Objective-C SDK. Check out our new Swift SDK to integrate our latest Swift-first library.
カスタム App Store レビュープロンプト
note:
このプロンプトを実装すると、Braze はインプレッションの自動追跡を停止し、独自の分析を記録する必要があります。
アプリ内メッセージの一般的な用途として、ユーザーに App Store でのレビューを依頼するキャンペーンの作成があります。
まず、アプリでアプリ内メッセージのデリゲートを設定します。次に、次のデリゲートメソッドを実装して、デフォルトの App Store レビューメッセージを無効にします。
1
2
3
4
5
6
7
8
- (ABKInAppMessageDisplayChoice)beforeInAppMessageDisplayed:(ABKInAppMessage *)inAppMessage {
if (inAppMessage.extras != nil && inAppMessage.extras[@"Appstore Review"] != nil) {
[[UIApplication sharedApplication] openURL:inAppMessage.uri options:@{} completionHandler:nil];
return ABKDiscardInAppMessage;
} else {
return ABKDisplayInAppMessageNow;
}
}
1
2
3
4
5
6
7
8
func before(inAppMessageDisplayed inAppMessage: ABKInAppMessage) -> ABKInAppMessageDisplayChoice {
if inAppMessage.extras?["Appstore Review"] != nil && inAppMessage.uri != nil {
UIApplication.shared.open(inAppMessage.uri!, options: [:], completionHandler: nil)
return ABKInAppMessageDisplayChoice.discardInAppMessage
} else {
return ABKInAppMessageDisplayChoice.displayInAppMessageNow
}
}
ディープリンク処理コードで、次のコードを追加して {YOUR-APP-SCHEME}:appstore-review
ディープリンクを処理します。SKStoreReviewController
を使用するには StoreKit
をインポートする必要があることに注意してください。
1
2
3
4
5
6
7
8
- (BOOL)application:(UIApplication *)app openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options {
NSString *urlString = url.absoluteString.stringByRemovingPercentEncoding;
if ([urlString isEqualToString:@"{YOUR-APP-SCHEME}:appstore-review"]) {
[SKStoreReviewController requestReview];
return YES;
}
// Other deep link handling code…
}
1
2
3
4
5
6
7
8
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let urlString = url.absoluteString.removingPercentEncoding
if (urlString == "{YOUR-APP-SCHEME}:appstore-review") {
SKStoreReviewController.requestReview()
return true;
}
// Other deep link handling code…
}
次に、以下を使用してアプリ内メッセージングキャンペーンを作成します。
- キーと値のペア
"Appstore Review" : "true"
- ディープリンク
{YOUR-APP-SCHEME}:appstore-review
を使用してクリック時の動作は、「アプリへのディープリンク」に設定します。
tip:
Appleは、App Storeのレビュープロンプトをユーザーごとに年間最大3回に制限しているため、キャンペーンのレートはユーザーごとに年間3回に制限する必要があります。
ユーザーは、App Store のレビュープロンプトをオフにできます。そのため、カスタムレビュープロンプトでは、App Store のネイティブレビュープロンプトが表示されることを約束したり、直接のレビューを求めたりしないでください。