Advanced Settings

Retargeting

Your app can send information to indigitall's servers to identify the actions and events that happen in it. This allows you to automate retargeting actions.

To register these events, call the sendCustomEvent method, passing a descriptive ID as a parameter (you can invent the one you like the most) and set data you need.

Indigitall.sendCustomEvent("YOUR_CUSTOM_EVENT", customData: []) {
   // Do something in success function
} onError: { (error) in
    //ERRROR DO SOMETHING
}
[Indigitall sendCustomEvent:@"" customData:@[] onSuccess:^{
// Do something in success function
} onError:^(INError * _Nonnull error) {
//ERROR DO SOMETHING
}];

Topics

Our SDK allows you to classify users into different customizable groups. This is very useful for:

  • Implement a preferences screen so that the user can choose the topics for which they want to receive notifications.
  • Label according to the navigation or actions that the user performs.
  • Segment communications according to whether the user has identified or is anonymous.
  • Segment based on language, culture, customer category, or based on any other criteria you need.

Remember that you must first define the groups you want to work with in the indigitall console
(Tools> Topics).

List groups
Use the topicsList method to get the list of groups that are configured in your indigitall project. The callback of this method receives as a parameter an array of INTopics, which contains the information of all the available groups, as well as a flag that indicates whether the user is included in any of them.

Indigitall.topicsListWith(onSuccess: { (topics) in
        print("TOPICS: \(topics)")
    }) { (error) in
        print("Error: \(error.message)")   
    }
[Indigitall topicsListWithOnSuccess:^(NSArray<INTopic *> * _Nonnull topics) {
        NSLog(@"TOPICS: %@",topics);
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

Manage subscription
To manage the device subscription to one or more groups, there are two methods: subscribe and unsubscribe.

Optionally, both receive a TopicsCallback object as the third parameter, which will return the list of all Topic in the project.

Indigitall.topicsSubscribe(withTopic: [Topic.code, Topic.code], onSuccess: { (topics) in
        self?.topics = topics
    }) { (error) in
        print(error.message)
    }

Indigitall.topicsUnSubscribe(withTopic: [Topic.code, Topic.code], onSuccess: { (topics) in
        self?.topics = topics
    }) { (error) in
        print(error.message)
    }
[Indigitall topicsSubscribeWithTopic:@[Topic[0], Topic[1]] onSuccess:^(NSArray<INTopic *> * _Nonnull topics) {
        topics = topics.self;
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];
[Indigitall topicsUnSubscribeWithTopic:@[Topic[0], Topic[1]] onSuccess:^(NSArray<INTopic *> * _Nonnull topics) {
        topics = topics.self;
    } onError:^(INError * _Nonnull error) {
        NSLog(@"ERROR: %@", error.message);
    }];

Collection of push data

In the event that you would like to obtain the push object of type json to carry out checks or actions that your application requires, we leave you this code that will help to obtain it:

@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
    Indigitall.handle(with: response ,withCompletionHandler: { (push, action) in
        print("Push object:", push)
        print("Push action app:", action.app)
    })
}

//@DEPRECATED
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
    print("Push notification received: \(userInfo)")
    let data = userInfo["data"]
    let push = INPush(data as! NSMutableDictionary)
    print("Push object : \(push)")
- (void) userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler{
    [Indigitall handleWithResponse:response withCompletionHandler:^(INPush * _Nonnull push, INPushAction * _Nonnull action) {
        NSLog(@"Push object: %@", push);
        NSLog(@"Push object app: %@", action.app);
    }];
}

//@DEPRECATED
- (void) application:(UIApplication *)application didReceiveRemoteNotification:(nonnull NSDictionary *)userInfo fetchCompletionHandler:(nonnull void (^)(UIBackgroundFetchResult))completionHandler{
    NSLog(@"Push notification received: %@", userInfo);
    NSMutableDictionary *data = userInfo[@"data"];
    INPush *push = [[INPush alloc]init:data];
    NSLog(@"Push object: %@",push);
}

Register statistics if the Push action is involved

If you decide to treat the action of the Push independently without going through our SDK, once the push has been collected as explained in the previous section, in the userNotificationCenter: didReceive method of the AppDelegate itself, in order to record the statistics you must add the next method.

Indigitall.registerStatistics(response)
[Indigitall registesStatistics: response];