Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
FirebaseNotification,RemoteConfigでユーザセグメントご...
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
yu mitsuhori
May 28, 2019
Programming
1.6k
8
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
FirebaseNotification,RemoteConfigでユーザセグメントごとにプッシュ通知を実装する
FirebaseMeetup#13にて発表させていただいた資料です
yu mitsuhori
May 28, 2019
More Decks by yu mitsuhori
See All by yu mitsuhori
【DroidKaigi版】ReactNativeとKotlinで叶える夢のリアルタイム音声配信
youmitsu
1
3.3k
ReactNativeとKotlinで叶える夢のリアルタイム音声配信
youmitsu
1
940
stand.fm(Android)におけるreact-native-track-playerの改善
youmitsu
1
2.3k
TargetSdkVersion29で BottomNavigationが点滅する件
youmitsu
1
1.7k
リリース前のリグレッションテストをUIテストで自動化、1年間運用した話
youmitsu
2
440
New features in RemoteConfig, Analytics at Google I/O 2019
youmitsu
1
790
Report from Google I/O 2019
youmitsu
1
120
OSSにコントリビュートした話
youmitsu
1
120
初めて自作ViewのAARライブラリを公開した話
youmitsu
1
450
Other Decks in Programming
See All in Programming
最近”作らせてる” ローカルAIアプリの話
akit37
0
520
S3 TablesのIcebergデータに、AIエージェントからアクセスしてみた / 20261016developersio2026joetsu-accessing-iceberg-in-s3tables-via-agent
kasacchiful
PRO
0
250
Groovy as a human and AI friendly programming language
paulk
0
150
Augmenting AI with the Power of Jakarta EE
ivargrimstad
0
520
sbt 2.0: takeoff
eed3si9n
0
180
Zero-Tap Sign-In対応、結局何をすればいいの?
mitohato14
0
1.1k
No More NoSuchMethodError
exoego
1
120
Vue.jsで作る空間解析アプリとCapacitorプラグインのData Bridge
hal_spidernight
1
140
動画プレイヤーはなぜカクつくのか 〜Flutterのレンダリングとネイティブの境界を解剖する〜
naruogram
0
310
そのデザイントークン、Flutterでも同じ見た目になりますか?
nakamizu
0
140
Compiling a real-world CLI tool to native with Static Hermes
tmikov2023
0
140
當我們開始不讀 Code - AI Agent 時代,Code Review 與 Clean Code 還剩下什麼?
jame2408
1
350
Featured
See All Featured
GraphQLの誤解/rethinking-graphql
sonatard
75
12k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
We Have a Design System, Now What?
morganepeng
55
8.4k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
360
31k
Six Lessons from altMBA
skipperchong
29
4.5k
Skip the Path - Find Your Career Trail
mkilby
1
270
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
62k
Ethics towards AI in product and experience design
skipperchong
2
450
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.5k
Paper Plane (Part 1)
katiecoart
PRO
2
12k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.6k
WENDY [Excerpt]
tessaabrams
14
40k
Transcript
FirebaseNotification,RemoteConfigで ユーザセグメントごとにプッシュ通知を実装 する Firebase Meetup at DeNA @1013Youmeee
アジェンダ 1. 自己紹介 2. この発表で紹介すること 3. TL;DR 4. 背景 5.
手法の解説 6. 実装方法 7. メリット、デメリット 8. まとめ 2 2
自己紹介 - 三堀 裕(みつほり ゆう) - 養命酒(youmeee, youmitsu) - メインはAndroid
- 新宿の隣でヘルスケア系アプリを開発しています。 - Github: youmitsu - Twitter: @1013Youmeee 3 3
この発表で紹介すること - RemoteConfigで分割されたユーザセグメントに対して、各セグメントごとにインター バル通知をFirebaseNotificationで送信する方法と背景について ※実装の話などAndroidの話が多めになると思いますが、iOSでも実装が可能なの で参考程度に聞いていただければと思います 4 4
今回使用するサービス 5 5 Notification (FCM) Remote Config User Property (Analytics)
TL;DR 1. RemoteConfigの値をUserPropertyに登録する 2. NotificationComposerからUserPropertyを指定してプッシュ配信する ※iOSでも同様の手順で実装可能 6
背景 7
実装するきっかけ - アクティブユーザー約80万(Android)のアプリ - アクティブ率向上施策として、FirebaseNotificationによるリモートプッシュ通知を導 入することになる - プッシュ通知を全ユーザに対し、同時に送信してしまう - アプリを起動した際にAPIコールが走る
=> 膨大なリクエスト。。 - サーバサイド側で準備ができておらず、一時間ほどアクセスできない状態になって しまった。 8 8 サーバ負荷を抑えるための対応をする必要がある
考えられた対応策 - サーバのインスタンス数を増やす - 通知開封時に通信を走らせない - ユーザを分割し、回数を分けて送信する - サーバのインスタンス数を増やす必要がない(コストがかからない) -
アプリチームだけで対応が可能 - 実装工数が少なくできる 9 9
Firebaseでユーザ分割とプッシュ送信を 実現するには 分割 - RemoteConfigでユーザを均等に分割可能 送信 - CloudMessagingからフィルターとして指定可能なのは、 右記の通り -
RemoteConfig× UserProperty◯ アプリで取得したRemoteConfigをUserPropertyとして 登録することで、紐付けをする 10 10
実現方法の解説 11
改善前の方法(プッシュ送信) 12 12 送信担当者 Notification Composer アプリ 通知情報の作成 (フィルターなし) 通知送信
通知の表示 フィルタリングしていないた め全ユーザに 一斉送信されてしまってい た
改善後の方法 (Config値をUserPropertyにセット) 13 13 アプリ Firebase RemoteConfig Firebase Analytics Config値(user_group)
取得 user_groupをUserPropertyに登録 UserPropertyにuser_group の値を登録 user_group(1~N)返却 user_groupを定 義しておく (1~Nのどれか) ※Nは分割数
{ AppID: 12345, user_group: 3 } 14 14 1 2
3 or user_group一覧 3 3 RemoteConfig App AppID(12345) UserProperty (Analytics) イメージ図:Config値をUserPropertyにセット 取得 登録
改善後の方法(プッシュ送信) 15 15 Notification Composer アプリ user_group=1 通知情報の作成 (user_group=1) 通知情報の作成
(user_group=2) 通知情報の作成 (user_group=N) アプリ user_group=2 アプリ user_group=N スケジューリング 通知送信 (user_group=1) 通知送信 (user_group=2) 通知送信 (user_group=N) 通知 表示 通知 表示 通知 表示 送信担当者
16 App user_group: 1 FCM イメージ図:プッシュ送信 Notification 【通知情報】 user_group: 1
【通知情報】 user_group: 2 【通知情報】 user_group: 3 App user_group: 2 App user_group: 3 UserProperty user_groupがxの appidリストを返す
実装 17
ユーザ分割用のRemoteConfigを設定 (条件作成) - 全ユーザを3分割するとする。 - user_groupを均等に3つに分類 - 各条件ごとに33%ずつ割り振る 18 RemoteConfigの条件一覧画面
RemoteConfigの条件作成画面 ユーザ(ランダム%)を選択
ユーザ分割用のRemoteConfigを設定 (パラメータ定義) - パラメータキーはuser_groupに設定 - 各条件ごとにConfig値を設定する 19 RemoteConfigのパラメータ設定画面
Firebase関連のdependenciesを定義 ※Androidの場合 dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) implementation
'com.android.support:appcompat-v7:28.0.0' … implementation "com.google.firebase:firebase-core:16.0.9" implementation "com.google.firebase:firebase-config:17.0.0" implementation "com.google.firebase:firebase-messaging:18.0.0" } 20 app配下のbuild.gradleにFirebase関連のdependenciesを定義
実装(RemoteConfingの値を取得 &UserPropertyの設定)※Androidの場合 val config = FirebaseRemoteConfigSettings.Builder() .setMinimumFetchIntervalInSeconds((if (BuildConfig.DEBUG) 0 else
60 * 60 * 12)) .build() val remoteConfig = FirebaseRemoteConfig.getInstance() remoteConfig.apply { setConfigSettingsAsync(config) setDefaults(R.xml.remote_config_default_value) fetch().addOnCompleteListener { fetchedTask -> if (fetchedTask.isSuccessful) activate() val userGroup = getString("user_group") mFirebaseAnalytics.setUserProperty("user_group", userGroup) } } 21 21 ApplicationクラスのonCreate()内に以下を記述 Debugビルド時 毎回Config値を取得する ようにする Releaseビルド時 Config有効時間をデフォ ルト(12時間)に設定 FetchしたConfigのキャッ シュ有効時間の設定 ローカル内の デフォルト値を設定 Configの取得後の コールバックを定義 RemoteConfigの値を 取得 user_groupの値を取得し、 UserPropertyにセット
NotificationComposerから通知送信 - ターゲットの部分で、user_groupを指定する(例:3) - 配信予定日時を指定して、「下書き保存」する 22 22
各user_groupごとにスケジューリングしておく - 各user_groupをターゲットにした通知を時間を分けてスケジューリングする - プッシュ送信間隔は、運用チームと相談して決める 23
通知の受信 24
メリット・デメリット 25
メリット - 工数が少なくすむ - コストも抑えられる - Notification, RemoteConfig, Analyticsは無料 -
別チームのリソースを借りずに済む - バッチを書いたり、サーバサイドの開発をする必要がない 26 26
デメリット - 長期的な運用に向いていない - Notification Composer上でやることが多い - ヒューマンエラーが起こりやすい - UserPropertyの設定はラグが多少あるため、UserGroupのフィルターに引っかから
ないユーザが出てくる(通知が送られない) - おそらく使い方間違ってる - UserPropertyは分析用のもの。通知の負荷分散のために使うものではない 27 27
まとめ - Firebase Notificationで通知を送信するとき、RemoteConfigの値でフィルタリングが 可能。インターバル通知を送信することもできる。 - あまり推奨される方法ではないが、手っ取り早く実装することができる - User Propertyへの反映はラグが多少あるので、送信されないユーザが出てきてし
まう点は要注意 - 以下にサンプルをあげています - https://github.com/youmitsu/FirebaseAnalyticsSample 28 28
Qiitaも書きました https://qiita.com/youmeee/items/7fe6d80e1d451bf9ed53 29 29