PrimedTracker.h 3.92 KB
Newer Older
1 2
//
//  PrimedTracker.h
3
//  PrimedIO
4
//
5 6
//  Created by PrimedIO on 7/23/18.
//  Copyright © 2018 PrimedIO. All rights reserved.
7 8 9
//

#import <Foundation/Foundation.h>
Bosko Petreski's avatar
Bosko Petreski committed
10
#import "Primed.h"
Bosko Petreski's avatar
Bosko Petreski committed
11

Bosko Petreski's avatar
Bosko Petreski committed
12
@import CoreLocation;
Bosko Petreski's avatar
Bosko Petreski committed
13
@import SocketIO;
Bosko Petreski's avatar
Bosko Petreski committed
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28

typedef NS_ENUM(NSUInteger, InteractionType) {
    InteractionType_LEFT,
    InteractionType_RIGHT,
    InteractionType_MIDDLE,
    InteractionType_OTHER,
    InteractionType_LONGPRESS,
};
typedef NS_ENUM(NSUInteger, ScrollDirection) {
    ScrollDirection_UP,
    ScrollDirection_DOWN,
    ScrollDirection_LEFT,
    ScrollDirection_RIGHT
};

Bosko Petreski's avatar
Bosko Petreski committed
29
@interface PrimedTracker : Primed {
Bosko Petreski's avatar
Bosko Petreski committed
30
    NSInteger heartbeatIncrement;
Bosko Petreski's avatar
Bosko Petreski committed
31
    NSMutableArray *savedPayloads;
Bosko Petreski's avatar
Bosko Petreski committed
32
    NSString *sid;
33
    NSString *did;
34
    NSString *externalIPAddress;
Bosko Petreski's avatar
Bosko Petreski committed
35
}
36

37 38 39
@property (nonatomic,strong) NSString *trackingConnectionString;
@property (nonatomic,assign) NSInteger heartbeatInterval;
@property (nonatomic,assign) NSInteger eventQueueRetryInterval;
Bosko Petreski's avatar
Bosko Petreski committed
40 41
@property (nonatomic,strong) SocketIOClient *socket;
@property (nonatomic,strong) SocketManager *manager;
Bosko Petreski's avatar
Bosko Petreski committed
42
@property (nonatomic,strong) NSDictionary<NSString*,id> *customBasicProperties;
43

Bosko Petreski's avatar
Bosko Petreski committed
44 45 46 47 48
/**
 * Create instance of PrimedTracker class
 * @return PrimedTracker shared instance
 */
+(PrimedTracker *)sharedInstance;
49

50 51 52 53 54
/**
 * Create instance of PrimedTracker class
 * @param publicKey Public Key provided by PrimedIO
 * @param secretKey Secret Key provided by PrimedIO
 * @param connectionString URL to API for PrimedIO service
Bosko Petreski's avatar
Bosko Petreski committed
55
 * @param trackingConnectionString URL to API for Primed tracking service
56 57 58
 * @param heartbeatInterval need info
 * @param eventQueueRetryInterval need info
 */
Bosko Petreski's avatar
Bosko Petreski committed
59
-(void)initWithPublicKey:(NSString *)publicKey secretKey:(NSString *)secretKey connectionString:(NSString *)connectionString trackingConnectionString:(NSString *)trackingConnectionString heartbeatInterval:(NSInteger)heartbeatInterval eventQueueRetryInterval:(NSInteger)eventQueueRetryInterval;
60

Bosko Petreski's avatar
Bosko Petreski committed
61
/**
Bosko Petreski's avatar
Bosko Petreski committed
62 63 64 65 66
 * Track Clicks
 * @param x X Coordinate
 * @param y Y Coordinate
 * @param interactionType Enumeration click type
 */
Bosko Petreski's avatar
Bosko Petreski committed
67 68
-(void)trackClick:(NSInteger)x y:(NSInteger)y interactionType:(InteractionType)interactionType;
-(void)trackClick:(NSInteger)x y:(NSInteger)y;
Bosko Petreski's avatar
Bosko Petreski committed
69 70 71 72

/**
 * Track URI
 * @param uri URI Tracking
Bosko Petreski's avatar
Bosko Petreski committed
73
 * @param customProperties Custom NSDictionary property
Bosko Petreski's avatar
Bosko Petreski committed
74
 */
Bosko Petreski's avatar
Bosko Petreski committed
75
-(void)trackView:(NSString *)uri customProperties:(NSDictionary<NSString*,id> *)customProperties;
Bosko Petreski's avatar
Bosko Petreski committed
76
-(void)trackView:(NSString *)uri;
77

Bosko Petreski's avatar
Bosko Petreski committed
78 79 80 81 82 83 84
/**
 * Track Scrolling
 * @param scrollDirection Enumeration scroll type
 * @param distance Distance scrolling
 */
-(void)trackScroll:(ScrollDirection)scrollDirection distance:(NSInteger)distance;

Bosko Petreski's avatar
Bosko Petreski committed
85 86
/**
 * Track when enter to screen
Bosko Petreski's avatar
Bosko Petreski committed
87
 * @param customProperties Custom NSDictionary property
Bosko Petreski's avatar
Bosko Petreski committed
88
 */
Bosko Petreski's avatar
Bosko Petreski committed
89
-(void)trackEnterViewPort:(NSDictionary<NSString*,id> *)customProperties;
90

Bosko Petreski's avatar
Bosko Petreski committed
91 92
/**
 * Track when exit from screen
Bosko Petreski's avatar
Bosko Petreski committed
93
 * @param customProperties Custom NSDictionary property
Bosko Petreski's avatar
Bosko Petreski committed
94
 */
Bosko Petreski's avatar
Bosko Petreski committed
95
-(void)trackExitViewPort:(NSDictionary<NSString*,id> *)customProperties;
96

Bosko Petreski's avatar
Bosko Petreski committed
97 98 99 100 101 102 103 104 105
/**
 * Track position change
 * @param location CLLocation object from GPS
 */
-(void)trackPositionChange:(CLLocation *)location;

/**
 * Track when opening application
 * @param uri URI Tracking
Bosko Petreski's avatar
Bosko Petreski committed
106
 * @param customProperties Custom NSDictionary property
Bosko Petreski's avatar
Bosko Petreski committed
107
 */
Bosko Petreski's avatar
Bosko Petreski committed
108
-(void)trackStart:(NSString *)uri customProperties:(NSDictionary<NSString*,id> *)customProperties;
Bosko Petreski's avatar
Bosko Petreski committed
109 110 111 112 113 114 115
-(void)trackStart:(NSString *)uri;

/**
 * Track when exit from application
 */
-(void)trackEnd;

Bosko Petreski's avatar
Bosko Petreski committed
116
/**
Bosko Petreski's avatar
Bosko Petreski committed
117
 * Track custom event
Bosko Petreski's avatar
Bosko Petreski committed
118
 * @param eventType Type event type property
Bosko Petreski's avatar
Bosko Petreski committed
119
  * @param customProperties Custom JSON Data for event
Bosko Petreski's avatar
Bosko Petreski committed
120
 */
Bosko Petreski's avatar
Bosko Petreski committed
121
-(void)trackCustomEvent:(NSString *)eventType customProperties:(NSDictionary<NSString*,id> *)customProperties;
122

Bosko Petreski's avatar
Bosko Petreski committed
123 124 125 126
/**
 * Track personalise JSON respond from REST
 * @param data Personalise JSON Data for event
 */
Bosko Petreski's avatar
Bosko Petreski committed
127
-(void)trackPersonalise:(NSDictionary<NSString*,id> *)data;
Bosko Petreski's avatar
Bosko Petreski committed
128

Bosko Petreski's avatar
Bosko Petreski committed
129 130 131 132
/**
 * Track convert JSON respond from REST
 * @param data Convert JSON Data for event
 */
Bosko Petreski's avatar
Bosko Petreski committed
133
-(void)trackConvert:(NSDictionary<NSString*,id> *)data;
Bosko Petreski's avatar
Bosko Petreski committed
134

135 136 137 138
// Getters
-(NSString *)getDID;
-(NSString *)getSID;

139
@end