Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Firestoreを使って純広告配信機能を作った話
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
mahiguch
March 27, 2019
Programming
4
2.4k
Firestoreを使って純広告配信機能を作った話
potatotips #60 (iOS/Android開発Tips共有会)のLT資料です。
https://potatotips.connpass.com/event/123002/
mahiguch
March 27, 2019
Tweet
Share
More Decks by mahiguch
See All by mahiguch
爆速で成長する おでかけ情報サービスの成長を支えるデザインと開発の取り組みについて
mahiguch
0
63
WebView認証連携
mahiguch
0
79
メディアアプリLIMIAにおけるプッシュ通知配信システム
mahiguch
0
110
公式部活動技術書典部の活動紹介
mahiguch
0
120
エンジニア以外の方が自らSQLを使ってセグメント分析を行うカルチャーをどのように作っていったか
mahiguch
1
1.1k
PHPからgoへの移行で分かったこと
mahiguch
2
4.3k
BigQueryを使った機械学習プロジェクトの分析とオフライン検証
mahiguch
2
1.2k
gRPCを使ったメディアサービス2
mahiguch
0
240
LIMIAでのBigQuery活用事例
mahiguch
0
220
Other Decks in Programming
See All in Programming
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
200
今更考える「単一責任原則」 / Thinking about the Single Responsibility Principle
tooppoo
3
1.6k
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
480
2026年は Rust 置き換えが流行る! / 20260220-niigata-5min-tech
girigiribauer
0
230
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
500
20260315 AWSなんもわからん🥲
chiilog
1
130
Ruby x Terminal
a_matsuda
7
590
エンジニアの「手元の自動化」を加速するn8n 2026.02.27
symy2co
0
140
メタプログラミングで実現する「コードを仕様にする」仕組み/nikkei-tech-talk43
nikkei_engineer_recruiting
0
180
Codex の「自走力」を高める
yorifuji
0
1.2k
SourceGeneratorのマーカー属性問題について
htkym
0
190
CSC307 Lecture 15
javiergs
PRO
0
240
Featured
See All Featured
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
470
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
410
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
First, design no harm
axbom
PRO
2
1.1k
Prompt Engineering for Job Search
mfonobong
0
180
Building a Modern Day E-commerce SEO Strategy
aleyda
45
8.8k
Technical Leadership for Architectural Decision Making
baasie
3
290
The Illustrated Children's Guide to Kubernetes
chrisshort
51
52k
Lightning talk: Run Django tests with GitHub Actions
sabderemane
0
140
Building the Perfect Custom Keyboard
takai
2
710
Navigating the moral maze — ethical principles for Al-driven product design
skipperchong
2
280
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
630
Transcript
Firestoreを使って純広告配信機能 を作った話
Masahiro Higuchi / 樋口雅拓 • グリーグループのリミア株式会社で、LIMIA という住まい領域のメディアを 作っています。ゲーム会社ですが、最近はメディアに力を入れています。 • 機械学習のエンジニアですが、iOS,
Android,JSなどもやっている何でも屋 です。4歳の娘のパパ。twitter: @mahiguch1 • https://limia.jp/ • https://arine.jp/ • https://aumo.jp/ • https://moguna.com/ • https://www.mine-3m.com/mine/
Firestoreの説明
Firestoreとは? • FirestoreはFirebaseの機能の一つ。Document Databaseと呼ばれるも の。2019年1月31日にGAになった。 • SDKがあり、iOS/Androidから直接アクセス可能。 • データの入力はFirebase管理画面から可能。 —>
つまり、アプリ実装のみで、ClientServer型のシステムを構築できる!
Firestoreのモデル • Document DatabaseとはNoSQLの一種。 • OracleやMySQLといったRDBでは事前にSchemaを定義しておくが、Document Databaseで は後から自由に変更できる。 jsonをそのまま格納できるイメージ。 •
データはDocumentという場所に格納され、それが Collectionでまとめられている。 • 分かりやすくMySQLで例えると、Collectionがテーブル、Documentがレコード。 —> 正直分かりづらいと思うので、画面とコードを見ながら説明していきます!
Firestoreへのデータ入力方法 • 左: コレクション • 中: ドキュメント • 右: ドキュメントの中身
管理画面があるので、ここから 入力できる。
Firestoreからのデータ取得方法 Collectionと Documentを指 定することで取得 可能。
Firestoreから複数データ取得方法 SQLのように whereで絞り込み が可能
自作した純広告配信機能の説明
純広告 is 何? • 自社で販売している広告商品 • AdNet経由で流れてくる広告と区別するためにこう呼んでいる • 表示回数やクリック数を保証しているので、それを達成する必要がある。 •
関東在住40代男性のような絞り込みをかける必要がある
ターゲティングはUserPropertyxRemoteConfig • ユーザの所在地、年齢、性別の推定情報などを UserPropertyに設定する。 • それを使ってRemoteConfigで細かく制御 • 条件に一致していた場合true、それ以外の場合falseを返すようにする。
その情報を取得する documentSnapshotsには、掲載枠で絞り込んだ全案件が入っています。 それをObjectにして、配信比率で絞り込み、制約条件でも絞り込みます。 残った候補の中からランダムに 1つを掲載します。 制約条件に一致しているかどうかは、 RemoteConfigから取得した値で判定しています。
罠: バージョンアップでnullableになる バージョンアップすると、取得したドキュメントがnullableになっていった。GAに なったので、もう無いと思いますが。。。
まとめ • Firestoreを使うと、アプリだけでClientServerシステムができる。 • UserProperty x RemoteConfigと組み合わせると、色々できそう。 • Firestoreはバージョンアップするとnullableなものが増えている可能性が あるので注意
ご静聴、ありがとうございました!