{"id":21838409,"url":"https://github.com/aptabase/aptabase-swift","last_synced_at":"2025-04-14T10:24:18.844Z","repository":{"id":150458459,"uuid":"623008257","full_name":"aptabase/aptabase-swift","owner":"aptabase","description":"Swift SDK for Aptabase: Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps","archived":false,"fork":false,"pushed_at":"2024-10-06T05:29:32.000Z","size":11807,"stargazers_count":23,"open_issues_count":3,"forks_count":8,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-11-01T09:45:05.457Z","etag":null,"topics":["analytics","ios","privacy","privacy-first","swift"],"latest_commit_sha":null,"homepage":"https://aptabase.com","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/aptabase.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-04-03T14:05:14.000Z","updated_at":"2024-10-27T05:07:49.000Z","dependencies_parsed_at":"2024-02-08T20:46:48.011Z","dependency_job_id":"d762a1c0-de00-417c-8a76-a223c0dce09d","html_url":"https://github.com/aptabase/aptabase-swift","commit_stats":null,"previous_names":[],"tags_count":22,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-swift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-swift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-swift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aptabase%2Faptabase-swift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aptabase","download_url":"https://codeload.github.com/aptabase/aptabase-swift/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860781,"owners_count":21173506,"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","ios","privacy","privacy-first","swift"],"created_at":"2024-11-27T21:10:57.019Z","updated_at":"2025-04-14T10:24:18.817Z","avatar_url":"https://github.com/aptabase.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Aptabase](https://aptabase.com/og.png)\n\n# Swift SDK for Aptabase\n\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Faptabase%2Faptabase-swift%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/aptabase/aptabase-swift)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Faptabase%2Faptabase-swift%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/aptabase/aptabase-swift)\n\n\nInstrument your apps with Aptabase, an Open Source, Privacy-First and Simple Analytics for Mobile, Desktop and Web Apps.\n\n## Install\n\n#### Option 1: Swift Package Manager\n\nAdd the following lines to your `Package.swift` file:\n\n```swift\nlet package = Package(\n    ...\n    dependencies: [\n        ...\n        .package(name: \"Aptabase\", url: \"https://github.com/aptabase/aptabase-swift.git\", from: \"0.3.4\"),\n    ],\n    targets: [\n        .target(\n            name: \"MyApp\",\n            dependencies: [\"Aptabase\"] // Add as a dependency\n        )\n    ]\n)\n```\n\n#### Option 2: Adding package dependencies with Xcode\n\nUse this [guide](https://developer.apple.com/documentation/xcode/adding-package-dependencies-to-your-app) to add `aptabase-swift` to your project. Use https://github.com/aptabase/aptabase-swift for the URL when Xcode asks.\n\n#### Option 3: CocoaPods\n\nAptabase is also available through CocoaPods. To install it, simply add the following line to your Podfile:\n\n```ruby\npod 'Aptabase', :git =\u003e 'https://github.com/aptabase/aptabase-swift.git', :tag =\u003e '0.3.4'\n```\n\n\n## Usage\n\n\u003e If you're targeting macOS, you must first enable the `Outgoing Connections (Client)` checkbox under the `App Sandbox` section.\n\nFirst, you need to get your `App Key` from Aptabase, you can find it in the `Instructions` menu on the left side menu.\n\nInitialized the SDK as early as possible in your app, for example:\n\n```swift\nimport SwiftUI\nimport Aptabase\n\n@main\nstruct ExampleApp: App {\n    init() {\n        Aptabase.shared.initialize(appKey: \"\u003cYOUR_APP_KEY\u003e\") // 👈 this is where you enter your App Key\n    }\n    \n    var body: some Scene {\n        WindowGroup {\n            MainView()\n        }\n    }\n}\n```\n\nAfterward, you can start tracking events with `trackEvent`:\n\n```swift\nimport Aptabase\n\nAptabase.shared.trackEvent(\"app_started\") // An event with no properties\nAptabase.shared.trackEvent(\"screen_view\", with: [\"name\": \"Settings\"]) // An event with a custom property\n```\n\nA few important notes:\n\n1. The SDK will automatically enhance the event with some useful information, like the OS, the app version, and other things.\n2. You're in control of what gets sent to Aptabase. This SDK does not automatically track any events, you need to call `trackEvent` manually.\n   - Because of this, it's generally recommended to at least track an event at startup\n3. The `trackEvent` function is a non-blocking operation as it runs in the background.\n4. Only strings and numbers values are allowed on custom properties\n\n## Preparing for Submission to Apple App Store\n\nWhen submitting your app to the Apple App Store, you'll need to fill out the `App Privacy` form. You can find all the answers on our [How to fill out the Apple App Privacy when using Aptabase](https://aptabase.com/docs/apple-app-privacy) guide.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faptabase%2Faptabase-swift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faptabase%2Faptabase-swift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faptabase%2Faptabase-swift/lists"}