https://github.com/poissonballon/google-analytics-provider
Google Analytics for Vapor
https://github.com/poissonballon/google-analytics-provider
google-analytics provider swift swift-server vapor
Last synced: 4 months ago
JSON representation
Google Analytics for Vapor
- Host: GitHub
- URL: https://github.com/poissonballon/google-analytics-provider
- Owner: PoissonBallon
- License: mit
- Created: 2018-07-25T11:56:38.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-09-03T11:57:07.000Z (almost 8 years ago)
- Last Synced: 2026-01-21T15:36:58.905Z (5 months ago)
- Topics: google-analytics, provider, swift, swift-server, vapor
- Language: Swift
- Size: 312 KB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Google Analytics Provider
------
[](https://developer.apple.com/swift/)
[](https://github.com/vapor/vapor)
A Vapor provider for __Google Analytics__ - a pure Swift implementation of [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/)
## Getting Started
In your `Package.swift` file, add the following
~~~~swift
.package(url: "https://github.com/PoissonBallon/google-analytics-provider.git", from: "0.0.1")
~~~~
Register the config and the provider to your Application
~~~~swift
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.
~~~~swift
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
* PoissonBallon [@poissonballon](https://twitter.com/poissonballon)
## License
Google Analytics Provider is available under the MIT license. See the [LICENSE](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! 😀