Upgrade to Pro — share decks privately, control downloads, hide ads and more …

モバイルアプリ行動ログ基盤を”大統一”した話

011714704c4a925e542d426d4cdaa4e3?s=47 giginet
December 10, 2020

 モバイルアプリ行動ログ基盤を”大統一”した話

Cookpad Tech Kitchen #25 日本最大レシピサービスのモバイルアプリ開発事情
https://cookpad.connpass.com/event/195190/

https://techlife.cookpad.com/entry/2020/11/05/110000

011714704c4a925e542d426d4cdaa4e3?s=128

giginet

December 10, 2020
Tweet

Transcript

  1. ϞόΠϧΞϓϦߦಈϩάج൫ Λେ౷Ұͨ͠࿩ @giginet 2020/12/10 Cookpad Tech Kitchen #25

  2. ୭ʁ • Twitter/GitHub : @giginet • ϞόΠϧج൫෦ iOSςοΫϦʔυ • ίϛολʔ΍ͬͯΔ

    • Carthage, fastlane, XcodeGen
  3. ࠓ೔࿩͢͜ͱ • ߴ଎ʹαʔϏε։ൃͰ͖Δߦಈϩάج൫ʢʮେ౷ҰϩΨʔʯʣͷ࿩ • ैདྷى͖͍ͯͨͷϩά࣮૷ͷ໰୊఺ • ʮେ౷ҰϩΨʔʯͷߏ଄ͱ࢓૊Έ • ղܾͰ͖ͨ໰୊

  4. https://techlife.cookpad.com/entry/ 2020/11/05/110000 υΩϡϝϯτϕʔεͷܕ҆શͳϞόΠϧΞϓϦ ߦಈϩάج൫ͷߏங

  5. ߦಈϩάͱ͸ • Ϣʔβʔ͕ߦಈΛىͨ͜͜͠ͱΛه࿥͢Δ࢓૊Έ • ಛఆͷϘλϯΛλοϓͨ͠ • ϨγϐΛݕࡧͨ͠

  6. Α͋͘Δߦಈϩάͷ࣮૷ʢFirebase Analyticsʣ Analytics.logEvent("select_content", parameters: [ "content_type": "image", "content_id": "P12453", "items":

    [["name": "Kittens"]] ]) Πϕϯτ໊ ϝλσʔλ
  7. ϞόΠϧΞϓϦͷ ߦಈϩάʹ͋Γ͕ͪͳ͜ͱ

  8. Α͋͘Δߦಈϩάͷ࣮૷ʢݱ࣮ʣ Analytics.logEvent("select_contnts", parameters: [ "content_type": “video", "content_id": nil, ]) UZQP

    DPOUFOU͕ਖ਼͍͠  ະఆٛͷ஋Ҭ OJM͕ૹΒΕͯ͠·͏ ϝλσʔλ͕଍Γͳ͍ JUFNT͕ඞཁ 
  9. ߦಈϩάʹ͋Γ͕ͪͳ͜ͱ • όʔδϣϯʹΑͬͯڍಈ͕มΘΔ • ࣮૷ϛεΛ͢Δ • ͍ͭͷ·ʹ͔ϩά͕ૹΒΕͳ͘ͳ͍ͬͯΔ

  10. dmemo • σʔλϕʔευΩϡϝϯτ؅ཧπʔϧʢWebΞϓϦʣ • σʔλϕʔεͷςʔϒϧ΍ΧϥϜʹυΩϡϝϯτΛఴ෇Ͱ͖Δ • https://github.com/hogelog/dmemo

  11. ϩάͷυΩϡϝϯςʔγϣϯ • ૹΓଛͳͬͯमਖ਼ͨ͠ͱ͖ʹυΩϡϝϯτΛॻ͚ΔΑ͏ʹͳ͕ͬͨɺ ΧϥϜຖʹແݶͷ஫ऍ͕ඞཁ • Ͳ͏͍͏ڍಈʁ • ఆٛҬ͸ʁ • ͲͷόʔδϣϯͰʁ

  12. ৽͍͠ߦಈϩάج൫ͷཁٻ • ڍಈ΍࢓༷ͳͲͷυΩϡϝϯςʔγϣϯΛ͠΍͍ͨ͘͢͠ • ϦϦʔεόʔδϣϯຖͷมԽΛ௥͍͍ͨ • ؒҧͬͨ஋͕ૹΒΕͳ͍Α͏ʹ͍ͨ͠ • ϩά࣮૷ͷϛεʹؾ͚ͮΔΑ͏ʹ͍ͨ͠

  13. ৽͍͠ϩάج൫ʮେ౷ҰϩΨʔʯ • ࣗવݴޠͰॻ͔ΕͨυΩϡϝϯτ͔Βܕ҆શͳϩΨʔͷ࣮૷Λੜ੒ • υΩϡϝϯτ͸ίʔυͱಉ͡ϦϙδτϦͰ؅ཧ͞ΕΔͷͰ௥͍΍͍͢ • ੜ੒ػ΍ίϯύΠϥͰϛεΛ๷͙࢓૊Έ

  14. None
  15. ϩάͷఆٛΛ.BSLEPXOͰهड़

  16. .BSLEPXOΛύʔε

  17. ιʔείʔυΛੜ੒

  18. ϩάόοΫΤϯυʹૹ৴

  19. ΧςΰϦ Πϕϯτ ΧϥϜͱܕ

  20. /// Ϩγϐݕࡧը໘ͷΠϕϯτͰ͢ public enum RecipeSearch: LogCategory { public static var

    categoryName: String { "recipe_search" } public var eventName: String { switch self { case .showRecipe: return "show_recipe" } } public func makePayload() -> [String: Any] { switch self { case let .showRecipe(recipeId): return [ "recipe_id": recipeId.dump(), ].compactMapValues { $0 } } } /// ݕࡧ݁Ռը໘͔ΒϨγϐৄࡉը໘ʹભҠ͢Δࡍʹૹ෇͞Ε·͢ case showRecipe(recipeId: Int64) }
  21. presentRecipeDetailViewController(recipeID: 42) logger.postLog(RecipeSearch.showRecipe(recipeId: 42)) ϩάΛૹΔ࣮૷

  22. υΩϡϝϯτϕʔεͷϩΨʔͷಛ௃ • ϩάఆٛ͸ϦϙδτϦ಺ʹ͋Δ • ಛఆͷόʔδϣϯͷίʔυͱඥ෇͘ • ϩάͷ࣮૷͕ܕ҆શʹͳΔ • ϛεͮ͠Β͍ •

    IDEͷิ׬͚ͩͰ࣮૷Ͱ͖Δ
  23. None
  24. ϩάͷૹ৴ϛεΛ๷͙࢓૊Έ࡞Γ

  25. ϩάͷഇࢭϚʔΧʔͱ੩తղੳ • ഇࢭͨ͠ϩάΛυΩϡϝϯτʹهड़Ͱ͖ΔΑ͏ʹͨ͠ • ഇࢭͨ͠ϩά͸ίʔυੜ੒͔Βআ֎͞ΕΔͨΊૹ৴Ͱ͖ͳ͘ͳΔ • ٯʹഇࢭ͞Ε͍ͯͳ͍ϩά͕ૹ෇͞Ε͍ͯͳ͍৔߹͸Կ͔͓͔͍͠ ͷͰؾ͚ͮΔΑ͏ʹͳΔ • ੩తղੳͰ࢖͍ͬͯͳ͍ϩάఆٛΛνΣοΫͯ͠ܯࠂ

  26. [obsolete]ࢦఆ ഇࢭϚʔΧʔ

  27. /// όφʔΛλοϓͨ͠ͱ͖ʹૹ෇͞Ε·͢ ///όʔδϣϯXX.X͔Βόφʔ͸දࣔ͞Εͳ͘ͳΓ·ͨ͠ @available(*, unavailable) case tapPromotionBanner()

  28. ϩά࣮૷ͷίϯύΠϧ࣌νΣοΫ • ֤ݴޠͷܕͷػೳΛ࢖ͬͯɺෆਖ਼ͳ஋͸ૹΕͳ͍Α͏ʹ • Optional • σϑΥϧτͰ͸nilΛૹΕͳ͍ɻૹΕΔΧϥϜ͚ͩࢦఆͰ͖Δ • ΧελϜܕ •

    ૹΕΔ஋ΛenumͳͲܕͰ੍໿
  29. OJMڐ༰ʢΦϓγϣφϧʣ ΧελϜܕ

  30. logger.postLog(RecipeSearch.search(keyword: "ܲͷ౜༲͛", excludeKeyword: nil, order: .popularity)) FNVNͰ੍໿͞ΕΔ OJM΋ૹΕΔ

  31. ߦಈϩάʹ͋Γ͕ͪͳ͜ͱ • ✅όʔδϣϯʹΑͬͯڍಈ͕มΘΔ • →ϦϙδτϦʹυΩϡϝϯτ͕࢒ΔΑ͏ʹͳͬͨ • ✅࣮૷ϛεΛ͢Δ • →ܕ҆શͳͷͰ࣮૷Λϛεͮ͠Β͍ •

    ✅͍ͭͷ·ʹ͔ϩά͕ૹΒΕͳ͘ͳ͍ͬͯΔ • →੩తղੳʹΑ͙ͬͯ͢ʹؾ͚ͮΔ
  32. େ౷Ұʁ • υΩϡϝϯτͷ؅ཧํ๏͕౷Ұ͞Εͨ • ϓϥοτϑΥʔϜؒͰ౷Ұ͞Εͨ • Swift, Kotlin, TypeScriptͷίʔυੜ੒ػ͕࣮ݱ •

    ੜ੒ͷ࢓૊Έ͕ڞ௨ͳ͚ͩͰɺϩάͷఆٛ͸ผ • ϩά෼ੳͷͨΊͷςʔϒϧ͕౷Ұ͞Εͨ • ৄ͘͠͸࣍ͷൃදͰʂ
  33. ·ͱΊ • υΩϡϝϯτͷ؅ཧ͕༰қʹͳͬͨ • υΩϡϝϯτΛॻ͚ͯ؆୯ʹӾཡͰ͖ΔΑ͏ʹ • ϦϦʔεόʔδϣϯͱυΩϡϝϯτ͕ඥ෇͘Α͏ʹ • ։ൃதʹ֬ೝ͠΍͍͢Α͏ʹ

  34. ·ͱΊ • ϩάͷૹΓؒҧ͍͕࢓૊ΈͰ๷͛ΔΑ͏ʹͳͬͨ • ఆٛ֎ͷ஋ΛૹΕͳ͍Α͏ʹͳͬͨ • ࣮૷͠๨ΕΛܯࠂͰ͖ΔΑ͏ʹͳͬͨ

  35. https://techlife.cookpad.com/entry/ 2020/11/05/110000 υΩϡϝϯτϕʔεͷܕ҆શͳϞόΠϧΞϓϦ ߦಈϩάج൫ͷߏங

  36. ͝ਗ਼ௌ ͋Γ͕ͱ͏ ͍͟͝·ͨ͠