Cordova plugin for Segment Analytics.
Supports Segment's iOS and Android SDKs.
Implements (mostly) the same API interface on window.analytics
as Analytics.js.
In config.xml, you can put the following preferences:
- <preference name="ios_segment_write_key" value="{Segment iOS write key}" />
- <preference name="ios_segment_debug_write_key" value="{Segment iOS write key}" />
- <preference name="android_segment_write_key" value="{Segment Android write key}" />
- <preference name="android_segment_debug_write_key" value="{Segment Android write key}" />
This plugin uses cordova-plugin-cocoapods-support to automatically bundle in the Segment iOS SDK through CocaoPods.
The only caveat is that you will need to run the project from AppName.xcworkspace instead of AppName.xcodeproj (this is a limitation introduced by CocoaPods itself).
Also for this reason, if you are using Ionic and its command line tools, ionic build
and ionic run
will cause the archive build to fail. You will need to manually run the project in Xcode from AppName.xcworkspace.
You might also want to consult official Segment documentation iOS Quickstart.
Use Gradle:
By default, the plugin builds with the analytics-core
SDK for Android.
To add more your custom integrations, create a build-extras.gradle
file in your Android platform root directory and add your segment integration dependencies. See the Android Custom Build Docs for examples.