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

Introducing Firebase Analytics to an Existing P...

Introducing Firebase Analytics to an Existing Project

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

Sho Ikeda

June 22, 2016
Tweet

More Decks by Sho Ikeda

Other Decks in Programming

Transcript

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

    Result • Himotoki • 2.1.0 is released today with Swift 2.3/Xcode 8 compatibility ✨ • APIKit
  2. Products • Analytics • Auth • Database • Hosting •

    Remote Config • Test Lab • Crash • Notifications • Dynamic Links • AdMob • ...
  3. Getting Started • Get Started with Firebase Analytics for iOS

    | Firebase • Tag Manager + Firebase: Getting Started | Google Tag Manager for iOS | Google Developers
  4. 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"])
  5. Google TagManagerͷηοτΞοϓ • ৽͍͠ίϯςφͷ༻ҙ • طଘͷίϯςφʢैདྷ൛ʣ͸FirebaseͰ͸࢖͑ͳ͍ • λάɺτϦΨʔɺม਺Λ࠶౓௥Ճ • ैདྷ൛ίϯςφͰΤΫεϙʔτͨ͠JSONϑΝΠϧ͸Firebase൛ίϯςφͰΠϯϙʔτ

    Ͱ͖ͳ͍ • ઃఆϑΝΠϧͷஔ͖׵͑ • όΠφϦ͔ΒJSONʹϑΥʔϚοτ͕มߋ • λʔήοτʹcontainerͱ͍͏folder referenceΛ௥Ճ͠ɺͦͷϑΥϧμ௚ԼʹJSON ϑΝΠϧΛઃஔ
  6. 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Λμ΢ϯϩʔυ͠ɺϓϩδΣΫτ ʹ௥ՃʢطଘϑΝΠϧͷஔ͖׵͑ʣ
  7. 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 } }
  8. Within App Extensions • ॳظԽϙΠϯτ: ΤϯτϦʔϙΠϯτͷVCͷviewDidLoad() • ෳ਺ճͷExtensionͷىಈͰಉҰϓϩηε͕࢖༻͞Ε͏ΔͨΊ FIRApp.configure()Λෳ਺ճݺ͹ͳ͍Α͏ʹ஫ҙ͢Δ •

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