swift - Google analytics not working on iOS 10 -
i'm had implemented google analysis , run app on 1 of ios devices. however, real time reporting still showing everything 0. had setup google analysis below. appreciated if suggestion given.
appdelegate.swift didfinishlaunchingwithoptions method : -
guard let gai = gai.sharedinstance() else { assert(false, "google analytics not confiugured correctly.") } gai.tracker(withtrackingid: "ua-10317xxxx-1") // optional: automatically report uncaught exceptions. gai.trackuncaughtexceptions = true
loginvc.swift viewwillappear method : -
override func viewwillappear(_ animated: bool) { super.viewwillappear(animated) setuptracker() }
loginvc.swift setuptracker() method : -
private func setuptracker() { let name = "login vc" guard let tracker = gai.sharedinstance().defaulttracker else { return } tracker.set(kgaiscreenname, value: name) guard let builder = gaidictionarybuilder.createscreenview() else { return } tracker.send(builder.build() [nsobject : anyobject]) }
need set default tracker of gai
in app delegate below.
gai.sharedinstance().defaulttracker = gai.tracker(withtrackingid: "<<trakcing key goes here>>")
also understand happening in background can check logs setting gai logger level kgailoglevelverbose
real-time count , ga features not real time me. might need give time see hits in ga dashboard. typically 10-15 mins
Comments
Post a Comment