matomo-org / matomo-sdk-ios

Matomo iOS, tvOS and macOS SDK: a Matomo tracker written in Swift
MIT License
388 stars 164 forks source link

iOS App Implementation #264

Closed avadhbambhroliya closed 6 years ago

avadhbambhroliya commented 6 years ago

is there any easy way to implement in iOS App other than typing this line matomoTracker.track(view: [“path”,“to”,“your”,“page”]) in every controller?

ghost commented 6 years ago

I also have same question..

brototyp commented 6 years ago

Sure, what do you have in mind? You could create a custom ViewController, add some implementation there and let all your ViewControllers inherit from this one.


class MatomoTrackedViewController: UIViewController {

  var path: [String]? = nil

  func viewDidAppear(animated: Boolean) {
    super.viewDidAppear(animated: animated)
    matomoTracker.track(view: path)
  }
}

I wouldn't reccomend that, because you lose quite some flexibility.

avadhbambhroliya commented 6 years ago

Thank you @brototyp

brototyp commented 6 years ago

Absolutely. You are welcome!