https://github.com/perfectlysoft/perfect-googleanalytics-measurementprotocol
Server side Google Analytics, using Swift / Perfect
https://github.com/perfectlysoft/perfect-googleanalytics-measurementprotocol
analytics api google google-analytics perfect server-side-swift swift
Last synced: about 1 month ago
JSON representation
Server side Google Analytics, using Swift / Perfect
- Host: GitHub
- URL: https://github.com/perfectlysoft/perfect-googleanalytics-measurementprotocol
- Owner: PerfectlySoft
- Created: 2016-12-22T03:41:54.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-26T17:58:23.000Z (about 6 years ago)
- Last Synced: 2024-10-14T13:17:11.998Z (8 months ago)
- Topics: analytics, api, google, google-analytics, perfect, server-side-swift, swift
- Language: Swift
- Homepage: https://www.perfect.org
- Size: 18.6 KB
- Stars: 2
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Perfect Google Analytics Measurement Protocol
[](http://perfect.org/get-involved.html)
[](https://github.com/PerfectlySoft/Perfect)
[](https://gitter.im/PerfectlySoft/Perfect)
[](https://twitter.com/perfectlysoft)
[](http://perfect.ly)[](https://developer.apple.com/swift/)
[](https://developer.apple.com/swift/)
[](http://perfect.org/licensing.html)
[](http://twitter.com/PerfectlySoft)
[](https://gitter.im/PerfectlySoft/Perfect?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](http://perfect.ly) [](https://badge.fury.io/gh/PerfectlySoft%2FPerfect-CURL)Google Analytics Measurement Protocol support for Perfect
This project provides a Swift interface to the [Google Analytics Measurement Protocol](https://developers.google.com/analytics/devguides/collection/protocol/v1/).
This package builds with Swift Package Manager and is part of the [Perfect](https://github.com/PerfectlySoft/Perfect) project.
Ensure you have installed and activated the latest Swift 4 tool chain.
## Example usage:
```swift
PerfectGAMeasurementProtocol.propertyid = "UA-XXXXXXXX-X"
let gaex = PerfectGAEvent()
gaex.user.uid = "donkey"
gaex.user.cid = "kong"
gaex.session.ua = "aua"
gaex.traffic.ci = "ci"
gaex.system.fl = "x"
gaex.hit.ni = 2do {
let str = try gaex.generate()
print(str)
let resp = gaex.makeRequest(useragent: "TestingAPI1.0", body: str)
print(resp)
} catch {
print("\(error)")
}```
## API Documentation
For full API documentation please visit [https://www.perfect.org/docs/api-Perfect-GoogleAnalytics-MeasurementProtocol.html](https://www.perfect.org/docs/api-Perfect-GoogleAnalytics-MeasurementProtocol.html)
## Building
Add this project as a dependency in your Package.swift file.
``` swift
.Package(url: "https://github.com/PerfectlySoft/Perfect-GoogleAnalytics-MeasurementProtocol.git", majorVersion: 3)
```## Further Information
For more information on the Perfect project, please visit [perfect.org](http://perfect.org).