1. Get TargetActClient singleton
    #import "TargetActClient/TargetActClient.h"
    TargetActClient *tac = [TargetActClient sharedInstance];
    Use the above lines anywhere in your code to get the singleton of TargetActClient which is required to call Gamooga API.
  2. Initialize TargetActClient
    TargetActClient *tac = [[TargetActClient alloc] init];
    This initializes the TargetActClient to send events and receive in-app/push notifications. Hence make sure to call it in your Appdelegate’s ‘(BOOL)application:didFinishLaunchingWithOptions:’
  3. Identify users
    - (void)identify:(NSString *)uniqId;
    When the app is installed a new visitor id is generated and stored on the app. When the user is identified, then the visitor id is changed to user’s visitor id if he is already identified from any other device(in which case all the events pushed until this point are lost) or the current visitor id is retained.
  4. Gamooga library can do the required APNs registration for you for receiving push notifications. Call the following method to initiate push registration in the background. Apple recommends you to call this method at all invocations of the app. Hence you can call it in ‘application:didFinishLaunchingWithOptions’ method of your Appdelegate.
    [tac doPushRegistration];
    If you are doing APNs registration on your own or using other 3rd party sdks you can skip the above step and just pass us the push registration id using the below API.
  5. Once the APNs registration is complete(through the above API call or 3rd party call), iOS calls the delegate method ‘application:didRegisterForRemoteNotificationsWithDeviceToken:’ with the token. Pass it on to us using the follwong method.
    [tac updatePushRegistrationId:<token>];
  6. Call the below method to get the push registration id:
    NSString *pr_id = [tc getPushRegistrationId];
  7. Call the below method to push events to Gamooga:
    - (void)pushEvent:(NSString *)ev withProperties:(NSDictionary *)props;
    ev is the name of the event to be pushed and props is the NSDictionary of the key-value pairs associated with the event. Any JSON-able value (string, int, float, boolean, etc) can be added to the map.
  8. Call the below method to push visitor properties to Gamooga:
    (void)pushProperty:(NSString *)prop withValue:(id)val;
    prop is the visitor’s property (email, mobile, etc) and val is any JSON-able value (string, int, float, boolean, etc)
  9. Call the below method to push visitor properties into a list:
    [tc addPropertyToList:prop withValue:val];
  10. Call the below method to push visitor properties into a list:
    [tc removePropertyFromList:prop withValue:val];
  11. Use the below snippet to get the events stored on Gamooga server:

    [tc getEvents:@"eventt" events_count:10 timestamp:0 withCompletion:^(NSData* result, NSInteger status) {

       NSString* str = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];

       NSLog(@"result: %@, status: %ld", str, (long)status);

  12. Callback for custom actions. Can be used to render sections on the fly on iOS screens:
    [tc registerCustomActionCallback:^(NSDictionary* result) {
       //Process result
    Data will be a json of the format {'ca_data': 'Data entered in the campaign journey builder', 'name': 'name entered'}
  13. If you need to push only campaign id and template id back to gamooga then these are the functions available for it.
    1. Push received event: [tac pushReceivedEvent:userInfo]
    2. Push received error event: [tac pushReceivedErrorEvent:userInfo]

    3. Push opened event: [tac pushOpenedEvent:userInfo]
    4. Push open error event: [tac pushOpenedErrorEvent:userInfo]
    5. If you need to pass extra properties like device type and app version then:
      1. if([self isGamoogaPush:userInfo] && [userInfo valueForKey:@"trig_id"]) {
        NSString *trig_id = [userInfo valueForKey:@"trig_id"];
        NSDictionary *m = [[NSDictionary alloc] initWithObjectsAndKeys:@"device",@"your device type", @"version", @"your app version", nil];
        Push received event: [tac pushEvent:[NSString stringWithFormat:@"%@ - %@", @"^push recved", trig_id] withProperties:m];
        Push received error event: [tac pushEvent:[NSString stringWithFormat:@"%@ - %@", @"^push recved error", trig_id] withProperties:m];
        Push open event: [tac pushEvent:[NSString stringWithFormat:@"%@ - %@", @"^push open", trig_id] withProperties:m];
        Push open error event: [tac pushEvent:[NSString stringWithFormat:@"%@ - %@", @"^push open error", trig_id] withProperties:m];
        } else {
        // Maybe push received error or open error event with identifyible error code to track errors