Skip to content

maxmilhas-org/GAReporter

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GAReporter

Tutuorial of how I created GAReporter

Set Up

pod 'GAReporter', :git => 'https://github.com/ji3g4kami/GAReporter.git'

import GAReporter

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        GAReporter.configure("UA-ZZZZZZZZZZ", verbose: true)
        return true
    }
}

Events

You can track any event you wish to using the sendEvent() method on the GAReporter. Example:

func pruchaseBasketball() {
    GAReporter.sendEvent(category: "Sports", action: "Purchase", label: "basketball", value: nil)
}

Screenviews

In many cases you'll want to track what "screens" that the user navigates to. A natural place to do that is in your ViewControllers viewDidAppear.

import GAReporter

class ViewController: UIViewController {
    override func viewDidAppear(_ animated: Bool) {
        super.viewDidAppear(false)
        GAReporter.sendScreenView("ViewController")
    }
}

License

Copyright 2018 David Wu

Packages

No packages published

Languages

  • Objective-C 90.0%
  • Swift 6.9%
  • Ruby 3.1%