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

Introducing Firebase Analytics to an Existing Project

Introducing Firebase Analytics to an Existing Project

関西モバイルアプリ研究会 #15での発表資料です #関モバ

7ddcca09c00a2744b983974225447d19?s=128

Sho Ikeda

June 22, 2016
Tweet

Transcript

  1. Introducing Firebase Analytics to an Existing Project @ikesyo ؔ੢ϞόΠϧΞϓϦݚڀձ #15,

    2016-06-22 Wed #ؔϞό
  2. @ikesyo • ͍͚͠ΐʔʗ஑ా ᠳ • ͸ͯͳ@ژ౎ • https://twitter.com/ikesyo • https://github.com/ikesyo

  3. ✨ Contributions ✨ • ReactiveCocoa • Carthage (Commandant, ReactiveTask) •

    Result • Himotoki • 2.1.0 is released today with Swift 2.3/Xcode 8 compatibility ✨ • APIKit
  4. Firebase

  5. Products • Analytics • Auth • Database • Hosting •

    Remote Config • Test Lab • Crash • Notifications • Dynamic Links • AdMob • ...
  6. Firebase Analytics with Google TagManager

  7. Getting Started • Get Started with Firebase Analytics for iOS

    | Firebase • Tag Manager + Firebase: Getting Started | Google Tag Manager for iOS | Google Developers
  8. Firebase Analytics • GoogleTagManager v5͸ FirebaseAnalytics ʹґଘ͢ΔΑ ͏ʹ import FirebaseAnalytics

    ... // Previously: // TAGManager.instance().dataLayer.push(["event": "eventName", "foo": "bar"]) // This sends the event to Google TagManager too. FIRAnalytics.logEventWithName("eventName", parameters: ["foor": "bar"])
  9. Google TagManagerͷηοτΞοϓ

  10. Google TagManagerͷηοτΞοϓ • ৽͍͠ίϯςφͷ༻ҙ • طଘͷίϯςφʢैདྷ൛ʣ͸FirebaseͰ͸࢖͑ͳ͍ • λάɺτϦΨʔɺม਺Λ࠶౓௥Ճ • ैདྷ൛ίϯςφͰΤΫεϙʔτͨ͠JSONϑΝΠϧ͸Firebase൛ίϯςφͰΠϯϙʔτ

    Ͱ͖ͳ͍ • ઃఆϑΝΠϧͷஔ͖׵͑ • όΠφϦ͔ΒJSONʹϑΥʔϚοτ͕มߋ • λʔήοτʹcontainerͱ͍͏folder referenceΛ௥Ճ͠ɺͦͷϑΥϧμ௚ԼʹJSON ϑΝΠϧΛઃஔ
  11. Firebase AnalyticsͷηοτΞοϓ

  12. Firebase AnalyticsͷηοτΞοϓ • https://console.firebase.google.com ͔Β • “৽نϓϩδΣΫτΛ࡞੒” • “GoogleϓϩδΣΫτΛΠϯϙʔτ” •

    Google Sign-InΛར༻͍ͯ͠ΔϓϩδΣΫτͰ͋Ε͹ޙऀΛબͿ • طଘͷOAuth 2.0 ΫϥΠΞϯτIDΛҾ͖ܧ͛Δ • ΫϥΠΞϯτIDʹొ࿥ࡁΈͷόϯυϧIDͰFirebaseϓϩδΣΫτʹࣗಈతʹϞόΠϧΞϓϦ͕௥Ճ͞Ε Δ • ಉҰΞϓϦͷAndroid൛͕͋Ε͹ɺ༧ΊΫϥΠΞϯτIDΛҠ؅ͯ͠GoogleϓϩδΣΫτΛ1ͭʹ·ͱΊ͓ͯ ͘ͷΛ͓͢͢Ί • Firebaseίϯιʔϧͷ֘౰ϞόΠϧΞϓϦ͔ΒGoogleService-Info.plistΛμ΢ϯϩʔυ͠ɺϓϩδΣΫτ ʹ௥ՃʢطଘϑΝΠϧͷஔ͖׵͑ʣ
  13. Firebase AnalyticsͷηοτΞοϓ // AppDelegate.swift import UIKit import FirebaseAnalytics class AppDelegate:

    UIResponder, UIApplicationDelegate { func application(application: UIApplication, didFinishLaunchingWithOptions... { // No more TAGContainerOpener.openContainerWithId( // _:tagManager:openType:timeout:notifier: // ) FIRApp.configure() return true } }
  14. Within App Extensions • ॳظԽϙΠϯτ: ΤϯτϦʔϙΠϯτͷVCͷviewDidLoad() • ෳ਺ճͷExtensionͷىಈͰಉҰϓϩηε͕࢖༻͞Ε͏ΔͨΊ FIRApp.configure()Λෳ਺ճݺ͹ͳ͍Α͏ʹ஫ҙ͢Δ •

    Today Extension: ϝϞϦෆ଍ͰFIRApp.configure()ΛݺͿ͚ͩͰΫϥογϡ͢Δ ! func viewDidLoad() { super.viewDidLoad() if FIRApp.defaultApp() == nil { FIRApp.configure() } }
  15. !" Happy Firebase!! "!

  16. Thank you❗"