promize_sdk 0.1.1 promize_sdk: ^0.1.1 copied to clipboard
A data collection SDK provides an easy way to collect your users data and interests
Promize SDK #
Promize SDK is a data collection SDK provides an easy way to collect your users data and interests
Overview #
The App SDK provides methods to send transactional messages and trigger events.The other methods help you save information about people, most visited pages and events.
Getting Started #
First, register account on the promize console
Then add promize_sdk
as
a dependency in your pubspec.yaml file.
Prerequisites #
This Package Works on Dart >=2.18.4 make sure to upgrade Your Sdk
sdk: ">=2.18.4 <4.0.0"
also this SDK uses FCM you need to setup Firebase in your project please refer to documentation for more info
How To Use #
initialize #
you need first thing to initialize the sdk by calling initialize method
final _promizeSdkPlugin = PromizeSdk.instance;
@override
void initState() {
super.initState();
await _promizeSdkPlugin.initialize(
apiKey:
'your api key',
siteId: 'your site id',
baseUrl: 'your base url',
appVersion: 'your app version' //Optional,
);
}
Authentication #
you need to add user on sign in or on register
final user = User(name,email,userId,Map<String,dynamic> additionalUserData);
_promizeSdkPlugin.createUser(user:user);
Update user #
you can update user info as following
_promizeSdkPlugin.updateUser(user:user);
update device token #
for the use of firebase cloud messaging you need to add the updateDeviceToken method in your onTokenChangedCallback
messaging.onTokenRefresh.listen((newToken) {
_promizeSdkPlugin.updateDeviceToken(
deviceToken:
"AH2Ejtc88ZHJ-2aYBQWzHwvp6l0JsCHgxVt8s91A-ZUikaXNbcjsFm6gg9ExeVR-jzIyT-mJvA_ntvfRsDDOH2jnKMjdTtXIJvPt0NBUU45R7-gnjxkx-sI0ldcWvbDHsV0735yFDbWk",
);
});
Save Device Token #
you can save the device token without calling updateDeviceToken method by calling saveDeviceToken method
_promizeSdkPlugin.saveDeviceToken(
deviceToken:
"AH2Ejtc88ZHJ-2aYBQWzHwvp6l0JsCHgxVt8s91A-ZUikaXNbcjsFm6gg9ExeVR-jzIyT-mJvA_ntvfRsDDOH2jnKMjdTtXIJvPt0NBUU45R7-gnjxkx-sI0ldcWvbDHsV0735yFDbWk",
);
Add event #
after register user you can add event any where in you app just use the add event and pass all the params you need to watch
_promizeSdkPlugin.addEvent(
eventName: "test Event",
eventType: EventType.event,
eventData: {"first_collectd": "data"});
Note #
If you want to send Event data contains a DateTime it is required to use this
format (Y-m-d H:i:s ex: 2023-03-14 00:00:00)
Built With #
- Flutter - the framework built for
Contributing #
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
License #
This project is licensed under the MIT License - see the LICENSE.md file for details