Last updated:
0 purchases
flutter connecttracker
Connect Tracker SDK for Flutter #
Getting started with Mobile App Tracking - Flutter #
Install ConnecTracker SDK #
Integrate Mobile App Tracking into your app #
import 'package:flutter_connecttracker/connecttracker.dart';
import 'package:flutter_connecttracker/connecttracker_options.dart';
...
var options = ConnectTrackerOptions("android_app_key", "ios_app_key");
final initialized = await ConnectTracker.instance.init(options) ?? false;
copied to clipboard
Initialze with more options #
import 'package:flutter_connecttracker/connecttracker.dart';
import 'package:flutter_connecttracker/connecttracker_options.dart';
...
var options = ConnectTrackerOptions("android_app_key", "ios_app_key");
// Disable or enable ad Id tracking on both platform
options.isAdIdTrackingDisabled = true;
// Request App Tracking Permission on iOS
options.requestAppTrackingPermission = true;
// Enable location services callbacks on both platforms.
options.useLocation = true;
// Set up push notification
options.usePushNotifications = true;
// Set up Sandbox for both platforms
options.isSandbox = true;
final initialized = await ConnectTracker.instance.init(options) ?? false;
copied to clipboard
Run the app in the iOS simulator or Android emulator and check the app_open events are being sent to the Connected Interactive dashboard.
Deeplink Methods #
// Notifies the SDK that the app has been opened using a deeplink
ConnectTracker.instance.appWillOpenUrl("schema://deeplink");
// Resolves a deeplink generated by an email client and passes the deeplink to the SDK
ConnectTracker.instance.resolveDeeplink("schema://deeplink", ["prefix1", "prefix2"]);
Tracking management methods
// Turn off tracking
ConnectTracker.instance.turnOffTracking();
// Turn on tracking
ConnectTracker.instance.turnOnTracking();
// Check if the SDK is initialized
ConnectTracker.instance.isInitialized();
// Check if tracking is on
ConnectTracker.instance.isTrackingOn();
// Delete user data from the SDK
ConnectTracker.instance.deleteUserData();
copied to clipboard
Location and Permission methods #
// Request location permission
ConnectTracker.instance.onWillRequestLocationPermission();
// Location permission denied
ConnectTracker.instance.onLocationPermissionDenied();
// Location permission granted
ConnectTracker.instance.onLocationPermissionGranted();
copied to clipboard
Application lifecycle methods
// Application is paused
ConnectTracker.instance.onApplicationPaused();
copied to clipboard
Add a custom event #
Setup Custom Event Tracking #
To track custom events place the following code to your project:
ConnectTracker.instance.trackEvent("YOUR_EVENT_NAME", null)
copied to clipboard
If you want to track events that have a value such as a monetary value, you could call the following code:
ConnectTracker.instance.trackEvent("YOUR_EVENT_NAME", "YOUR_VALUE")
copied to clipboard
To enable event callbacks, set the property callbacks in your ConnectTrackerOptions before calling ConnectTracker.instance.trackEvent.
var options = ConnectTrackerOptions("android_app_key", "ios_app_key");
var callbacks = ConnectTrackerCallbacks();
options.callbacks = callbacks;
copied to clipboard
Implement the Callback functions. #
callbacks.onSessionStartSuccess = (value) {
// Handle the value as a dictionary to get session start details
print(value['trackingId']);
};
callbacks.onSessionStartFailed = (value) {
// Handle the value as a dictionary to get session start details
print(value['trackingId']);
};
callbacks.onEventTracked = (value) {
// Handle the value as a dictionary to get session start details
print(value['trackingId']);
};
callbacks.onEventTrackedFailed = (value) {
// Handle the value as a dictionary to get session start details
print(value['trackingId']);
};
callbacks.onAppTrackingPermissionDenied = (value) {
// value matches the iOS ATTrackingManagerAuthorizationStatusAuthorized constant (3)
print(value);
};
callbacks.onAppTrackingPermissionDenied = (value) {
// value matches any of these permission status
// ATTrackingManagerAuthorizationStatusNotDetermined(0), ATTrackingManagerAuthorizationStatusRestricted(1), ATTrackingManagerAuthorizationStatusDenied(3)
};
callbacks.onAttributionChanged = (value) {
print(value['trackingId']);
};
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.