A Vapor provider for Google Analytics - a pure Swift implementation of Google Analytics Measurement Protocol
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.
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
- PoissonBallon @poissonballon
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! 😀