Skip to content

Integrate Google Analytics in your app without Pod or Google SDK!

Notifications You must be signed in to change notification settings

arashzjahangiri/SwiftyGA

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SwiftyGA

Integrate Google Analytics in your app without Pod or Google SDK! 😃

Getting Started

  1. Just add 'SwiftyGA.swift' in your project.

Usage

1.in AppDelegate copy and paste following code:

import SwiftyGA
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        // Override point for customization after application launch.
        SwiftyGA.shared.configure(trackingID: "REPLACE-YOUR-TRACKING-ID")
        return true
    }

2.screen visits(hits):

override func viewWillAppear(_ animated: Bool) {
        SwiftyGA.shared.screenView(Utility.screenName(obj: self))
    }

3.action and events in your ViewController:

@IBAction func tapMeAction(_ sender: Any) {
        SwiftyGA.shared.event(category: Track.Category.click, action: Track.Action.tap, label: Utility.screenName(obj: self), value: nil)
    }

Questions

If you have any questions about the project, please contact via email: arashzjahangiri@gmail.com

Pull requests are welcome!

Licence

MIT.

Releases

No releases published

Packages

No packages published