heap_io_flutter 1.0.0
heap_io_flutter: ^1.0.0 copied to clipboard
Heap.io plugin for tracking custom events
Heap.io plugin #
A Flutter plugin for Heap.io analytics
Getting Started #
Android Setup #
For Adroid you must manually add and apply the Heap.io sdk.
First, in the build.gradle at the root level of your project, modify the build script as follows:
// At the top of the buildscript block, add a property for the SDK version.
ext.heapVersion = '1.10.1'
// ...
dependencies {
// Within buildscript.dependencies, add the classpath dependency below.
// Note the double quotes, which are required to interpolate the version.
classpath "com.heapanalytics.android:heap-android-gradle:$heapVersion"
}
}```
Next, modify the app’s `build.gradle`:
```apply plugin: 'com.android.application'
// Insert line below to apply our plugin
apply plugin: 'com.heapanalytics.android'```
Lastly, add the client library as a dependency:
```dependencies {
// Insert line below to include our client library as a dependency. Note the
// double quotes, which are required to interpolate the version.
implementation "com.heapanalytics.android:heap-android-client:$heapVersion"
// If you are on an older version of the Gradle build plugin (pre-3.1) you should
// use the commented line below instead of the one above. The "compile" directive
// is deprecated as of 3.1.
// compile "com.heapanalytics.android:heap-android-client:$heapVersion"
// ...
}```
## Usage
Note automatic tracking is disabled as it doesn't work properly with Flutter. This plugin allows the usage of tacking custom events.
Initializing the plugin
```dart
await HeapIO.initialize('YOUR_APP_iD');
Setting the use identity
await HeapIO.indentify('SOME_USER_ID');
Tracking custom events
await HeapIO.track('test_event', {'property 1': '1', 'property 2': '2'});