Analytics Swift Destination Plugins
Analytics Swift uses its timeline/plugin architecture to support sending data to bundled SDKs when a Cloud Mode connection is not possible. Destination Plugins are similar to traditional Device Mode integrations available in Analytics-iOS in that Segment makes calls directly to the destination tool’s API from the device. However, Destination Plugins are more customizable, giving you the ability to control and enrich your data at a much more granular level on the device itself.
Device-mode Vs. Cloud-Mode
Analytics Swift allows you to choose how you send data to Segment and your connected destinations from your app. There are two ways to send data:
Cloud-mode: The sources send data directly to the Segment servers, which then translate it for each connected downstream destination, and send it on. Translation is done on the Segment servers, keeping your page size, method count, and load time small.
Device-mode: You include additional code on your app which allows Segment to use the data you collect on the device to make calls directly to the destination tool’s API, without sending it to the Segment servers first. (You still send your data to the Segment servers, but this occurs asynchronously.) This is also called wrapping or bundling, and it might be required when the source has to be loaded on the page to work, or loaded directly on the device to function correctly.
Supported Device-mode Plugins
Analytics Swift supports the following Device-mode Plugins:
Building your own destination
If Segment doesn’t support your Swift destination, you can build your own with the template Segment provides.
To build your own Swift destination using a plugin template:
- Go to the Swift Destination Plugin template.
- Click Use this template
- Enter a name for the repository
- Complete the
TODOsections in the sample code with the appropriate information for your destination. Segment recommends you to change the package name before you finalize your build.
- Commit your changes.
For more information about the Analytics Swift Plugin architecture and how it can help you customize your tracking implementation to suit your needs, refer to the Plugin Architecture Guide.
This page was last modified: 21 Apr 2023
Questions? Problems? Need more info? Contact Segment Support for assistance!