Swiftpack.co - Package - PoissonBallon/google-analytics-provider



Google Analytics Provider


Swift 4.1 Vapor 3

A Vapor provider for Google Analytics - a pure Swift implementation of Google Analytics Measurement Protocol

Getting Started

In your Package.swift file, add the following

.package(url: "https://github.com/PoissonBallon/google-analytics-provider.git", from: "0.0.1")

Register the config and the provider to your Application

let config = GoogleAnalyticsConfig(trackingID: "UA-12XXXXX-Y")
services.register(config)
try services.register(GoogleAnalyticsProvider())

And you are all set. Interacting with the API is quite easy.

let gac = try req.make(GoogleAnalyticsClient.self)
gac.send(hit: .event(category: "API", action: "create TODO"))

And you can always check the documentation to see the required parameters for specific API calls.

Whats Implemented

Common Hit Types

  • [x] Page Tracking
  • [x] Event Tracking
  • [ ] Ecommerce Tracking
  • [ ] Social Tracking
  • [ ] Exception Tracking
  • [ ] User Timing Tracking
  • [ ] App / Screen Tracking

Error and Quotas

  • [x] Too big hits
  • [x] Malformed Hits

Author

License

Google Analytics Provider is available under the MIT license. See the LICENSE file for more info.

Want to help?

Feel free to submit a pull request whether it's a clean up, a new approach to handling things, adding a new part of the API, or even if it's just a typo. All help is welcomed! 😀

Github

link
Stars: 1
Help us keep the lights on

Dependencies

Used By

Total: