Advanced
GDPR Compliance
Smartech believes privacy is a fundamental human right, which is why Smartech SDK has methods to opt-out from tracking user's events, displaying in-app messages, and receiving push notifications sent from the panel.
Opt-Out From Tracking Events, displaying In-App Messaging and receiving Push Notification
To opt-out for tracking of events, display of in-app, and receiving push notifications developer needs to implement the following methods and pass NO/false in the argument.
//Used for tracking
[[Smartech sharedInstance] optTracking:NO];
//Used for In-App
[[Smartech sharedInstance] optInAppMessage:NO];
//Used for Push Notification
[[Smartech sharedInstance] optPushNotification:NO];
//Used for tracking
Smartech.sharedInstance().optTracking(false)
//Used for In-App
Smartech.sharedInstance().opt(inAppMessage: false)
//Used for Push Notification
Smartech.sharedInstance().optPushNotification(false)
To enable tracking of events, display of in-app, and receiving push notifications developer needs to pass YES/true.
//Used for tracking
[[Smartech sharedInstance] optTracking:YES];
//Used for In-App
[[Smartech sharedInstance] optInAppMessage:YES];
//Used for Push Notification
[[Smartech sharedInstance] optPushNotification:YES];
//Used for tracking
Smartech.sharedInstance().optTracking(true)
//Used for In-App
Smartech.sharedInstance().opt(inAppMessage: true)
//Used for Push Notification
Smartech.sharedInstance().optPushNotification(true)
Get the values set for GDPR Compliance
//Check Event Tracking Opt status
BOOL trackingOptStatus = [[Smartech sharedInstance] hasOptedTracking];
//Check Push Notification Opt status
BOOL notificationOptStatus = [[Smartech sharedInstance] hasOptedPushNotification];
//Check In-App Opt status
BOOL inAppOptStatus = [[Smartech sharedInstance] hasOptedInAppMessage];
//Check Event Tracking Opt status
let trackingOptStatus = Smartech.sharedInstance().hasOptedTracking()
//Check Push Notification Opt status
let notificationOptStatus = Smartech.sharedInstance().hasOptedPushNotification()
//Check In-App Opt status
let inAppOptStatus = Smartech.sharedInstance().hasOptedInAppMessage()
Get GUID or Device token
If you need any additional information like device token or device GUID you can implement the following methods
[[Smartech sharedInstance] getDevicePushToken];
[[Smartech sharedInstance] getDeviceGuid];
Smartech.sharedInstance().getDevicePushToken()
Smartech.sharedInstance().getDeviceGuid()
Set Location for events
If you have set the value of key SmartechAutoFetchLocation with NO in your apps Info.plist under SmartechKeys dictionary and you want to handle the location which will be sent with every Smartech SDK events then you can use a method named setUserLocation
by passing an object of CLLocationCoordinate2D in the parameter. The location will only be sent the same until and unless this method gets the new location, if the location is not updated then for every event the same location will be sent and it will only reset after the app launch. If SmartechAutoFetchLocation is YES then the value will be updated for every event.
CLLocationCoordinate2D location = CLLocationCoordinate2DMake(latitude, longitude);
[[Smartech sharedInstance] setUserLocation:location];
let location = CLLocationCoordinate2DMake(latitude, longitude)
Smartech.sharedInstance().setUserLocation(location)
Process Events Manually
If you want to sync all the events which are tracked by Smartech SDK and are in the database when the user was offline then you call processEventsManually method which will start the sync of all stored methods from database which were stored when the user was offline.
[[Smartech sharedInstance] processEventsManually];
Smartech.sharedInstance().processEventsManually()
Updated over 4 years ago