The purpose of this manual is to provide all the necessary information for installation and use of the tool in applications developed for the Flutter platform.
This Plugin collects data from the device and sends it to ClearSale. All collected information is related only to the device, without any relation to the integrated application.
This Plugin collects data (information and location) from the device and sends it to ClearSale. All collected information is related only to the device, without any relation to the integrated application.
The geolocation information depends on the permission granted by the user of the device,
The Plugin respects Apple and Google's privacy policies for capturing device data and the permission level assigned by the user (device user).
Since Flutter does not have native support for integrity verification, the checksum must be done on each SDK individually.
Platform | Documentation |
---|---|
Android | click here |
iOS | click here |
The plugin is available on a public repository and to use it, follow the example below:
dependencies:
behavior_analytics_flutter_sdk: ^0.3.3
dependencies:
behavior_analytics_flutter_sdk: ^0.3.7
dependencies:
behavior_analytics_flutter_sdk:
git:
url: https://dev.azure.com/CS-PublicPackages/Behavior/_git/BehaviorAnalytics.SDK.Flutter
ref: main
version: 0.5.10
dependencies:
behavior_analytics_flutter_sdk:
git:
url: https://dev.azure.com/CS-PublicPackages/Behavior/_git/BehaviorAnalytics.SDK.Flutter
ref: main
version: 0.5.16
In the pubspec.yaml file, insert the package reference in the dependencies section
If your project is using Proguard, you will need to insert the following configurations:
-keep class sale.clear.behavior.android.** { *; }
-keepattributes Exceptions
Below is a recommended base configuration for the release.
buildTypes {
release {
shrinkResources true
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android.txt'),
'proguard-rules.pro'
signingConfig signingConfigs.debug
}
}
You must use the following dependencies in your project: play-services-location, play-services-ads-identifier. To do this, add the following information to your project's Gradle file, in the dependencies section.
You must use the following dependency in your project: play-services-ads-identifier. To do this, add the following information to your project's Gradle file, in the dependencies section.
dependencies {
// Other dependencies of your project.
//...
// Required dependencies:
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'sale.clear.behavior:sdk-behavior:5.6.7'
api 'com.google.android.gms:play-services-location:21.0.1'
}
dependencies {
// Other dependencies of your project.
//...
// Required dependencies:
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'sale.clear.behavior:sdk-behavior:6.0.8'
api 'com.google.android.gms:play-services-location:21.0.1'
}
dependencies {
// Other dependencies of your project.
//...
// Required dependencies:
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'sale.clear.behavior:sdk-behavior:6.0.10-rc.1'
}
The dependency 'com.google.android.gms:play-services-ads-identifier:18.0.1' is used to obtain information about the device's advertising identifier.
On the other hand, the dependency 'com.google.android.gms:play-services-location:21.0.1' should be used whenever it is necessary to collect geolocation information from the device.
To use the SDK is necessary to request some Permissions in the manifest file, they are:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
For applications that use Android version 26 or above as Target, and wishes to capture geolocation information, it's necessary, in addition to adding the ACCESS_FINE_LOCATION and ACCESS_COARSE_LOCATION permissions to the manifest, to request permission from the user to collect geolocation data, following this Android recommendation.
Note: For applications that uses version 33 (Android 13) or above as Target be able to capture information regarding advertisingID, it will be necessary to include the permission below:
<uses-permission android:name="com.google.android.gms.permission.AD_ID"/>
Add the ClearSale's native iOS library in your project pod:
source 'https://dev.azure.com/CS-PublicPackages/Behavior/_git/BehaviorAnalytics.SDK.IOS.Specs'
target 'PROJECT_NAME' do
pod 'CSBehavior', '3.0.1'
end
source 'https://dev.azure.com/CS-PublicPackages/Behavior/_git/BehaviorAnalytics.SDK.IOS.Specs'
target 'PROJECT_NAME' do
...
Inside the project folder, access the folder ios and execute the command pod install:
pod install
Case the error Error: EMFILE: too many open files - React Native CLI is shown, install the watchman.
Execute the following commands on the command prompt:
brew update
$ brew install watchman
Add the following option on your plist and after in the xcode Menu Build -> Clean and Build Folder.
<dict>
<key>NSAllowsArbitraryLoads</key>
<true />
<key>NSExceptionDomains</key>
<dict>
<key>clearsale.com.br</key>
<dict>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.2</string>
</dict>
</dict>
</dict>
Data | Description |
---|---|
SessionID | Unique ID per session of the device collection, must be sent to ClearSale along with the order. |
AppKey | Value provided by ClearSale, it helps to identify the device collection origin. |
import 'package:behavior_analytics_flutter_sdk/behavior_analytics_flutter_sdk.dart';
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State {
@override
void initState() {
super.initState();
BehaviorAnalyticsFlutterSdk.start("appkey_provided_by_clearsale");
}
}
void _handleButtonPress() {
BehaviorAnalyticsFlutterSdk.generateSessionID().then((sessionID) {
BehaviorAnalyticsFlutterSdk.collectDeviceInformation(sessionID);
print(sessionID);
setState(() {
_sessionID = sessionID;
});
});
}
@override
Widget build(BuildContext context) {
print('build');
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('BehaviorAnalytics Plugin Example'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('SessionID: $_sessionID\n'),
ElevatedButton(
onPressed: _handleButtonPress,
child: Text('Collect'),
),
],
),
),
),
);
}
It's possible to visualize the SDK implementation in a example project clicking here.
Click here to access our FAQ
All information collected by ClearSale's SDK are exclusively for the purpose of fraud prevention and user protection, adherent to the security and privacy policies of Google and Apple platfoms and the LGPD. Therefore, this information must be in the application privacy policy.
ClearSale's SDK collects the following device information:
All information collected by ClearSale's SDK are exclusively for the purpose of fraud prevention and user protection, adherent to the security and privacy policies of Google and Apple platfoms and the LGPD. Therefore, this information must be in the application privacy policy.
ClearSale's SDK collects the following device information:
By downloading and using our SDK you are agreeing to the following license.
Copyright © 2024 ClearSale
All rights are reserved, permission is granted to use the software as is, and no modification or copying for any purpose is permitted. The Software is licensed in its current configuration “as is” and without warranty of any kind, either express or implied, including, but not limited to, warranties of merchantability, fitness for a particular purpose and non-infringement of patented rights. Under no circumstances may the Copyright holders be held liable for damages, losses, causes of action, whether in contract or tort, or other tortious action arising from the use of the Software or other actions related to this Software without the prior written authorization of the Copyright holder.