{"id":24840392,"url":"https://github.com/swiftylab/swiftanalyticskit","last_synced_at":"2025-03-26T05:21:01.093Z","repository":{"id":64930801,"uuid":"543539385","full_name":"SwiftyLab/SwiftAnalyticsKit","owner":"SwiftyLab","description":"A Composable Analytics API for Swift","archived":false,"fork":false,"pushed_at":"2023-01-08T07:13:59.000Z","size":1846,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-01T06:05:07.280Z","etag":null,"topics":["analytics","analytics-backend","cocoapods","logging","swift","swift-package-manager"],"latest_commit_sha":null,"homepage":"https://swiftylab.github.io/SwiftAnalyticsKit/documentation/analytics/","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SwiftyLab.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["soumyamahunt"],"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"lfx_crowdfunding":null,"custom":null}},"created_at":"2022-09-30T10:07:24.000Z","updated_at":"2023-10-06T05:16:40.000Z","dependencies_parsed_at":"2023-02-08T05:17:02.280Z","dependency_job_id":null,"html_url":"https://github.com/SwiftyLab/SwiftAnalyticsKit","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyLab%2FSwiftAnalyticsKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyLab%2FSwiftAnalyticsKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyLab%2FSwiftAnalyticsKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SwiftyLab%2FSwiftAnalyticsKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SwiftyLab","download_url":"https://codeload.github.com/SwiftyLab/SwiftAnalyticsKit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245592653,"owners_count":20640879,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["analytics","analytics-backend","cocoapods","logging","swift","swift-package-manager"],"created_at":"2025-01-31T06:56:08.731Z","updated_at":"2025-03-26T05:21:01.063Z","avatar_url":"https://github.com/SwiftyLab.png","language":"Swift","funding_links":["https://github.com/sponsors/soumyamahunt"],"categories":[],"sub_categories":[],"readme":"# SwiftAnalyticsKit\n\n[![API Docs](http://img.shields.io/badge/Read_the-docs-2196f3.svg)](https://swiftylab.github.io/SwiftAnalyticsKit/documentation/analytics/)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/SwiftAnalyticsKit.svg?label=CocoaPods\u0026color=C90005)](https://badge.fury.io/co/SwiftAnalyticsKit)\n[![Swift Package Manager Compatible](https://img.shields.io/github/v/tag/SwiftyLab/SwiftAnalyticsKit?label=SPM\u0026color=orange)](https://badge.fury.io/gh/SwiftyLab%2FSwiftAnalyticsKit)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg)](https://github.com/Carthage/Carthage)\n[![Swift](https://img.shields.io/badge/Swift-5+-orange)](https://img.shields.io/badge/Swift-5-DE5D43)\n[![Platforms](https://img.shields.io/badge/Platforms-all-sucess)](https://img.shields.io/badge/Platforms-all-sucess)\n[![CI/CD](https://github.com/SwiftyLab/SwiftAnalyticsKit/actions/workflows/main.yml/badge.svg?event=push)](https://github.com/SwiftyLab/SwiftAnalyticsKit/actions/workflows/main.yml)\n[![CodeFactor](https://www.codefactor.io/repository/github/swiftylab/swiftanalyticskit/badge)](https://www.codefactor.io/repository/github/swiftylab/swiftanalyticskit)\n[![codecov](https://codecov.io/gh/SwiftyLab/SwiftAnalyticsKit/branch/main/graph/badge.svg?token=YSryFeUvVW)](https://codecov.io/gh/SwiftyLab/SwiftAnalyticsKit)\n\n**SwiftAnalyticsKit** is an API package which tries to establish a common analytics API the ecosystem can use. You can implement ``AnalyticsHandler`` to create compatible analytics backends. You can also create custom encoders with ``AnalyticsEncoder`` to serialize metadata for your backend if default encoders doesn't work for your case.\n\nImplement ``AnalyticsEvent`` to create compatible events or implement ``GlobalAnalyticsMetadata`` to create compatible metadata objects without specific event types:\n\n```swift\nenum LoginEvent: String, AnalyticsEvent {\n    case loginAttempted\n    case loginSucceeded\n    case loginFailed\n\n    struct Metadata: AnalyticsMetadata {\n        let user: String\n    }\n}\n\nlet handler = MultiplexAnalyticsHandler\u003cString\u003e()\nLoginEvents.loginAttempted.fire(on: handler, data: .init(user: \"user\"))\n```\n\n## Requirements\n\n| Platform | Minimum Swift Version | Installation | Status |\n| --- | --- | --- | --- |\n| iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+ | 5.1 | [CocoaPods](#cocoapods), [Carthage](#carthage), [Swift Package Manager](#swift-package-manager), [Manual](#manually) | Fully Tested |\n| Linux | 5.1 | [Swift Package Manager](#swift-package-manager) | Fully Tested |\n| Windows | 5.3 | [Swift Package Manager](#swift-package-manager) | Fully Tested |\n\n## Installation\n\n### CocoaPods\n\n[CocoaPods](https://cocoapods.org) is a dependency manager for Cocoa projects. For usage and installation instructions, visit their website. To integrate `SwiftAnalyticsKit` into your Xcode project using CocoaPods, specify it in your `Podfile`:\n\n```ruby\npod 'SwiftAnalyticsKit'\n```\n\nOptionally, you can also use the pre-built XCFramework from the GitHub releases page by replacing `{version}` with the required version you want to use:\n\n```ruby\npod 'SwiftAnalyticsKit', :http =\u003e 'https://github.com/SwiftyLab/SwiftAnalyticsKit/releases/download/v{version}/SwiftAnalyticsKit-{version}.xcframework.zip'\n```\n\nTo use default mocks provided for test cases, add the `Mock` subspec to your test target:\n\n```ruby\npod 'SwiftAnalyticsKit/Mock'\n```\n\n### Carthage\n\n[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate `SwiftAnalyticsKit` into your Xcode project using Carthage, specify it in your `Cartfile`:\n\n```ogdl\ngithub \"SwiftyLab/SwiftAnalyticsKit\"\n```\n\n### Swift Package Manager\n\nThe [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.\n\nOnce you have your Swift package set up, adding `SwiftAnalyticsKit` as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.\n\n```swift\n.package(url: \"https://github.com/SwiftyLab/SwiftAnalyticsKit.git\", from: \"1.0.0\"),\n```\n\nand add products as dependency to your targets:\n\n```swift\n.product(name: \"Analytics\", package: \"SwiftAnalyticsKit\")\n.product(name: \"AnalyticsMock\", package: \"SwiftAnalyticsKit\") // To use mocks, i.e. in test targets\n```\n\nOptionally, you can also use the pre-built XCFramework from the GitHub releases page by replacing `{version}` and `{checksum}` with the required version and checksum of artifact you want to use:\n\n```swift\n.binaryTarget(name: \"Analytics\", url: \"https://github.com/SwiftyLab/SwiftAnalyticsKit/releases/download/v{version}/SwiftAnalyticsKit-{version}.xcframework.zip\", checksum: \"{checksum}\"),\n```\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate `SwiftAnalyticsKit` into your project manually.\n\n#### Git Submodule\n\n- Open up Terminal, `cd` into your top-level project directory, and run the following command \"if\" your project is not initialized as a git repository:\n\n  ```bash\n  $ git init\n  ```\n\n- Add `SwiftAnalyticsKit` as a git [submodule](https://git-scm.com/docs/git-submodule) by running the following command:\n\n  ```bash\n  $ git submodule add https://github.com/SwiftyLab/SwiftAnalyticsKit.git\n  ```\n\n- Open the new `SwiftAnalyticsKit` folder, and drag the `SwiftAnalyticsKit.xcodeproj` into the Project Navigator of your application's Xcode project or existing workspace.\n\n    \u003e It should appear nested underneath your application's blue project icon. Whether it is above or below all the other Xcode groups does not matter.\n\n- Select the `SwiftAnalyticsKit.xcodeproj` in the Project Navigator and verify the deployment target satisfies that of your application target (should be less or equal).\n- Next, select your application project in the Project Navigator (blue project icon) to navigate to the target configuration window and select the application target under the `Targets` heading in the sidebar.\n- In the tab bar at the top of that window, open the \"General\" panel.\n- Click on the `+` button under the `Frameworks and Libraries` section.\n- You will see `SwiftAnalyticsKit.xcodeproj` folder with `Analytics.framework` and `AnalyticsMock.framework` nested inside.\n- Select the `Analytics.framework` and that's it!\n\n  \u003e The `Analytics.framework` is automagically added as a target dependency, linked framework and embedded framework in build phase which is all you need to build on the simulator and a device.\n\n- To use default mocks provided for test cases, select the `AnalyticsMock.framework` when adding to your test target.\n\n#### XCFramework\n\nYou can also directly download the pre-built artifact from the GitHub releases page:\n\n- Download the artifact from the GitHub releases page of the format `SwiftAnalyticsKit-{version}.xcframework.zip` where `{version}` is the version you want to use.\n- Extract the XCFrameworks from the archive, and drag the `Analytics.xcframework` into the Project Navigator of your application's target folder in your Xcode project.\n- Select `Copy items if needed` and that's it!\n\n  \u003e The `Analytics.xcframework` is automagically added in the embedded `Frameworks and Libraries` section, an in turn the linked framework in build phase.\n\n- To use default mocks provided for test cases, use `AnalyticsMock.xcframework` from previously extracted XCFrameworks.\n\n## Usage\n\nSee the full [documentation](https://swiftylab.github.io/SwiftAnalyticsKit/documentation/analytics/) for API details and articles on sample scenarios.\n\n## Contributing\n\nIf you wish to contribute a change, suggest any improvements,\nplease review our [contribution guide](CONTRIBUTING.md),\ncheck for open [issues](https://github.com/SwiftyLab/SwiftAnalyticsKit/issues), if it is already being worked upon\nor open a [pull request](https://github.com/SwiftyLab/SwiftAnalyticsKit/pulls).\n\n## License\n\n`SwiftAnalyticsKit` is released under the MIT license. [See LICENSE](LICENSE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftylab%2Fswiftanalyticskit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswiftylab%2Fswiftanalyticskit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswiftylab%2Fswiftanalyticskit/lists"}