|
| 1 | +# segment_analytics_plugin_amplitude |
| 2 | + |
| 3 | +`DestinationPlugin` for [amplitude](https://amplitude.com/docs/sdks/sdk-quickstart). Wraps [`amplitude_analytics`](https://pub.dev/packages/amplitude_analytics). |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +Manually add this package to your `pubspec.yaml` file. |
| 8 | + |
| 9 | +```yaml |
| 10 | +dependencies: |
| 11 | + analytics_plugin_amplitude: |
| 12 | + git: |
| 13 | + url: https://github.com/segmentio/analytics_flutter |
| 14 | + ref: main |
| 15 | + path: packages/plugins/plugin_amplitude |
| 16 | +``` |
| 17 | +
|
| 18 | +## Usage |
| 19 | +
|
| 20 | +Follow the [instructions for adding plugins](https://github.com/segmentio/analytics_flutter_#adding-plugins) on the main Analytics client: |
| 21 | +
|
| 22 | +In your code where you initialize the analytics client call the `.add(plugin)` method with an `amplitudeDestination` instance. |
| 23 | + |
| 24 | +```dart |
| 25 | +import 'amplitude_options.dart'; |
| 26 | +import 'package:segment_analytics/client.dart'; |
| 27 | +import 'package:segment_analytics_plugin_amplitude/plugin_amplitude.dart' |
| 28 | + show amplitudeDestination; |
| 29 | +
|
| 30 | +const writeKey = 'SEGMENT_API_KEY'; |
| 31 | +
|
| 32 | +class _MyAppState extends State<MyApp> { |
| 33 | + final analytics = createClient(Configuration(writeKey)); |
| 34 | +
|
| 35 | + @override |
| 36 | + void initState() { |
| 37 | + // ... |
| 38 | +
|
| 39 | + analytics |
| 40 | + .addPlugin(amplitudeDestination()); |
| 41 | + } |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +## Support |
| 46 | + |
| 47 | +Please use Github issues, Pull Requests, or feel free to reach out to our [support team](https://segment.com/help/). |
| 48 | + |
| 49 | +## Integrating with Segment |
| 50 | + |
| 51 | +Interested in integrating your service with us? Check out our [Partners page](https://segment.com/partners/) for more details. |
| 52 | + |
| 53 | +## License |
| 54 | + |
| 55 | +``` |
| 56 | +MIT License |
| 57 | + |
| 58 | +Copyright (c) 2023 Segment |
| 59 | + |
| 60 | +Permission is hereby granted, free of charge, to any person obtaining a copy |
| 61 | +of this software and associated documentation files (the "Software"), to deal |
| 62 | +in the Software without restriction, including without limitation the rights |
| 63 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 64 | +copies of the Software, and to permit persons to whom the Software is |
| 65 | +furnished to do so, subject to the following conditions: |
| 66 | + |
| 67 | +The above copyright notice and this permission notice shall be included in all |
| 68 | +copies or substantial portions of the Software. |
| 69 | + |
| 70 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 71 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 72 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 73 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 74 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 75 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 76 | +SOFTWARE. |
| 77 | +``` |
0 commit comments