Overview
Tags in iOS applications help categorize users based on their preferences or behaviors. Developers can use tags to segment users and deliver tailored messages, boosting engagement and personalization.
Use Case
Purpose:
Label users with specific attributes (e.g., "Newsletter Subscriber," "Gaming Enthusiast").
Enable dynamic segmentation for personalized notifications.
Benefits:
Improve user targeting for push notifications.
Simplify user management and reporting.
Implementation Details
Add Tags: Assign one or more tags to a user device.
For Objective-C:
[[Appoxee shared] addTagsToDevice:@[@"NewsletterSubscriber", @"FrequentBuyer"] withCompletionHandler:^(NSError * _Nullable error, id data) { if (!error) { NSLog(@"Tags added successfully"); } }];For Swift:
Appoxee.shared()?.addTags(toDevice: ["NewsletterSubscriber", "FrequentBuyer"], withCompletionHandler: { (error, data) in if error == nil { print("Tags added successfully") } })Remove Tags: Remove one or more tags from a user's device.
For Objective-C:
[[Appoxee shared] removeTagsFromDevice:@[@"NewsletterSubscriber"] withCompletionHandler:^(NSError * _Nullable error, id data) { if (!error) { NSLog(@"Tags removed successfully"); } }];For Swift:
Appoxee.shared()?.removeTags(fromDevice: ["NewsletterSubscriber"], withCompletionHandler: { (error, data) in if error == nil { print("Tags removed successfully") } })Fetch Device Tags: Retrieve all tags associated with a user device.
For Objective-C:
[[Appoxee shared] fetchApplicationTags:^(NSError * _Nullable error, id data) { if (!error && [data isKindOfClass:[NSArray class]]) { NSArray *tags = (NSArray *)data; NSLog(@"Fetched Tags: %@", tags); } }];For Swift:
Appoxee.shared()?.fetchDeviceTags({ (error, data) in if error == nil { print("Fetched Tags: \(data ?? [])") } })Clear Tags Cache: Clear cached tags on the device.
For Objective-C:
[[Appoxee shared] clearTagsCacheWithCompletionhandler:^(NSError * _Nullable error, id data) { if (!error) { NSLog(@"Tags cache cleared successfully"); } }];For Swift:
Appoxee.shared()?.clearTagsCache(completionhandler: { (error, data) in if error == nil { print("Tags cache cleared successfully") } })
Keep in mind:
Tags are app-specific, allowing multiple tags per user device.
Use consistent and descriptive tag names for better campaign organization.
Ensure robust testing for tag addition, removal, and retrieval processes.