Update README.md (#107)
- Update README.md
Add instructions on how to install TelemetryDeck in Xcode.
- Update README.md
Add link to setup guide in the docs
Co-authored-by: Daniel Jilg daniel@telemetrydeck.com
版权所有:中国计算机学会技术支持:开源发展技术委员会
京ICP备13000930号-9
京公网安备 11010802032778号
TelemetryClient
This package allows you to send signals to TelemetryDeck from your Swift code. Sign up for a free account at telemetrydeck.com
Installation
The easiest way to install TelemetryDeck is using Swift Package Manager, Apple’s solution which is built into Xcode. In Xcode, press File > Add Packages…, then in the resulting window enter
https://github.com/TelemetryDeck/SwiftClientinto the search field. Set the Dependency Rule field to Up to Next Major Version, then press the Add Package button. Xcode will download it, then you can choose which target of your app to add it to.See our detailed setup guide for more information.
Initialization
Init the Telemetry Manager at app startup, so it knows your App ID (you can retrieve the App ID from your TelemetryDeck Dashboard under Set Up App)
For example, if you’re building a scene based app, in the
init()function for yourApp:Then send signals like so:
Debug -> Test Mode
If your app’s build configuration is set to “Debug”, all signals sent will be marked as testing signals. In the Telemetry Viewer app, activate Test Mode to see those.
If you want to manually control whether test mode is active, you can set the
configuration.testModeproperty.User Identifiers
Telemetry Manager will create a user identifier for you user that is specific to app installation and device. If you have a better user identifier available, such as an email address or a username, you can use that instead, by passing it on to the
TelemetryManagerConfiguration(the identifier will be hashed before sending it).You can update the configuration after TelemetryManager is already initialized.
Payload
You can also send additional payload data with each signal:
Telemetry Manager will automatically send a base payload with these keys:
Sessions
With each Signal, the client sends a hash of your user ID as well as a session ID. This gets automatically generated when the client is initialized, so if you do nothing, you’ll get a new session each time your app is started from cold storage.
On iOS, tvOS, and watchOS, the session identifier will automatically update whenever your app returns from background, or if it is launched from cold storage. On other platforms, a new identifier will be generated each time your app launches. If you’d like more fine-grained session support, write a new random session identifier into the
TelemetryManagerConfiguration‘ssessionIDproperty each time a new session begins.Custom Salt
By default, user identifiers are hashed by the TelemetryDeck SDK, and then sent to the Ingestion API, where we’ll add a salt to the received identifier and hash it again.
This is enough for most use cases, but if you want to extra privacy conscious, you can add in you own salt on the client side. The TelemetryDeck SDK will append the salt to all user identifers before hashing them and sending them to us.
If you’d like to use a custom salt, you can do so by passing it on to the
TelemetryManagerConfigurationCustom Server
A very small subset of our customers will want to use a custom signal ingestion server or a custom proxy server. To do so, you can pass the URL of the custom server to the
TelemetryManagerConfiguration:Custom Logging Strategy
By default, some logs helpful for monitoring TelemetryDeck are printed out to the console. This behaviour can be customised by overriding
configuration.logHandler. This struct accepts a minimum allows log level (any log with the same or higher log level will be accepted) and a closure.This allows for compatibility with other logging solutions, such as swift-log, by providing your own closure.
Developing this SDK
Your PRs on TelemetryDeck’s Swift Client are very much welcome. Check out the SwiftClientTester project, which provides a harness you can use to work on the library and try out new things.
When making a new release, run
./tag-release.sh MAJOR.MINOR.PATCHto bump the version string in the SDK, create a new commit and tag that commit accordingly all in one step.