# VWO Insights Flutter SDK
## Deeply understand user experiences on Flutter apps

VWO Insights helps you analyze user behavior in your application based on interactions such as application launch, taps, scrolls, and flings. By attributing these actions to critical business events like purchases and sign-ups (which are considered conversions), VWO Insights enables you to identify why users might not be converting. This tool is essential in the research stage of experience optimization, providing insights into what users are (or are not) doing in your application and helping to determine why.

Understanding user behavior through VWO Insights is the foundation of an effective optimization program, guiding you towards data-backed ideation and testing without relying on assumptions.

## How it benefits you?
- **Rapid Issue Identification:** Use session replays to quickly discover and resolve issues, reducing the time between problem identification and solution implementation.
- **Analyzing User Drop-Offs:** Understand at which points users are leaving your app and the possible reasons behind their decisions, helping refine the user journey.
- **Enhancing Feature Adoption:** Track how new features are used by actual users, and use insights to improve feature integration and user interface design.
- **Detecting UX Friction:** Identify friction points in critical user journeys like onboarding or purchasing processes to streamline actions and reduce user frustration.
- **Generating A/B Testing Ideas:** Analyze user behavior to come up with informed hypotheses for A/B testing, ensuring that tests are focused on areas with maximum impact potential.

## Features
- **Session Recordings:** Capture every user interaction within your Flutter app to visually identify where users succeed or struggle, providing the context needed for precise enhancements.
- **Heatmaps:** Gain visual insights into where users are most engaged on your app screens, helping identify popular areas and elements that don't receive intended interactions.
- **Conversion Funnels:** Track the user journey from entry to conversion, pinpointing where potential customers drop off and understanding what drives conversions.

## How to use

### Android
```kotlin
package com.vwo.demo.insights_flutter_demo
 
import android.util.Log
import com.vwo.insights.VWOInsights
import com.vwo.insights.exposed.IVwoInitCallback
import com.vwo.insights.exposed.models.ClientConfiguration
import io.flutter.app.FlutterApplication
 
class MyApp : FlutterApplication() {
    override fun onCreate() {
        super.onCreate()
 
        val configuration = ClientConfiguration(accountNo, key);
        VWOInsights.init(this, object : IVwoInitCallback {
            override fun vwoInitSuccess(s: String) {
                Log.e("VWO", "FLUTTER_DEBUG: SUCCESS -> $s")
                VWOInsights.startSessionRecording()
            }
 
            override fun vwoInitFailed(s: String) {
                Log.e("VWO", "FLUTTER_DEBUG: FAILURE -> $s")
            }
        }, configuration)
    }
}
```
Update the manifest file to
```xml
android:name=".MyApp"
```

### iOS
Initialize SDK
```swift
import UIKit
import VWO_Insights_ios_flutter_sdk
 
 
@main
class AppDelegate: UIResponder, UIApplicationDelegate {
     
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
         
        VWO.configure(accountId:"" , sdkKey: "", userId: ""){
           VWO.startSessionRecording()
        }
        return true
    }
}
```
Add the following key to your plist after integration
```xml
<key>NSPrincipalClass</key>

<string>VWOPrincipleClass</string>
```
### Common for iOS and Android
Set navigator observer in MaterialApp
```dart
return MaterialApp(
      title: 'Flutter Demo',
      routes: {
        "/": (context) => const DemoScreen(),
        '/Screen1': (context) => Screen1(),
        '/Screen2': (context) => Screen2(),
      },
      navigatorObservers: [
        VwoNavigatorObserver(),
        YourNavigatorObserverIfNeeded(),
      ],
    );
```
For more detailed usage instructions, please refer to our [Developer Documentation](https://developers.vwo.com/reference/mobile-insights-introduction).

## Support
For any support queries or technical assistance, please contact our support team at [support@vwo.com](mailto:support@vwo.com)

## License
[Apache License, Version 2.0](https://github.com/wingify/vwo-insights-ios-flutter-sdk/blob/main/LICENSE) Copyright 2024 Wingify Software Pvt. Ltd.