|
Declared in: Discussion: For example: MedialetsEvent *myEvent = [[MedialetsEvent alloc] initWithKey:@"AppStorePurchase"]; [myEvent setString:@"Ammunition" forKey:@"Product"]; [myEvent setString:@"Ammo01" forKey:@"SKU"]; [myEvent setNumber:[NSNumber numberWithFloat:1.99 forKey:@"Price"]]; [myEvent addNumbersFromDictionary:[NSDictionary dictionaryWithObjectsAndKeys: [NSNumber numberWithFloat:3.5], @"Health", [NSNumber numberWithInt:10000], @"Bullets", [NSNumber numberWithInt:100], @"Missiles", [NSNumber numberWithInt:3], @"Nukes", nil]]; [myEvent setDuration:self.appStoreTime forKey:@"AppStoreResponseTime"]; [[MedialetsAnalyticsManager sharedInstance] trackEvent:myEvent]; [myEvent release]; Preparation: In your project tree:
Next, add the header #import statement for MedialetsEvent.h to any method where you'll be using the MedialetsEvent class: #import "MedialetsEvent.h" |
| MedialetsEvent | initWithKey:(NSString *)eventKey Returns an MedialetsEvent object initialized with the specified event key. |
| void | setString:(NSString *)string forKey:(NSString *)key Adds a given key-value pair to the receiver, where the value is an NSString value. |
| void | addStringsFromDictionary:(NSDictionary *)dictionary Adds to the receiver the entries from a dictionary. |
| void | setNumber:(NSNumber *)number forKey:(NSString *)key Adds a given key-value pair to the receiver, where the value is an NSNumber value. |
| void | addNumbersFromDictionary:(NSDictionary *)dictionary Adds to the receiver the entries from a dictionary. |
| void | incrementNumberForKey:(NSString *)key Helper method to implement a simple counter. Adds one number to the number stored with the specified key and then re-saves it within the event. |
| void | setDuration:(NSTimeInterval *)duration forKey:(NSString *)key Adds a given key-value pair to the receiver, where the value is an NSTimeInterval value. |
| void | addDurationsFromDictionary:(NSDictionary *)dictionary Adds to the receiver the entries from a dictionary. |
| void | startTimerForKey:(NSString *)key Starts a timer with the specified key. |
| NSTimeInterval | endTimerForKey:(NSString *)key Ends timing for the specified key and saves the duration to the receiver with the key. Also returns the duration. |
initWithKey:
- (id)initWithKey:(NSString *)eventKey
Returns an MedialetsEvent object initialized with the specified event key.
Returns:
An MedialetsEvent object initialized with the specified event key.
setString:forKey:
- (void)setString:(NSString *)string forKey:(NSString *)key
Adds a given key-value pair to the receiver, where the value is an NSString value.
addStringsFromDictionary:
- (void)addStringsFromDictionary:(NSDictionary *)dictionary
Adds to the receiver the entries from a dictionary.
Discussion:
Each value in the dictionary must be an NSString (or a subclass of NSString) object. Other object types will be discarded.
setNumber:
- (void)setNumber:(NSNumber *)number forKey:(NSString *)key
Adds a given key-value pair to the receiver, where the value is an NSNumber value.
addNumbersFromDictionary:
- (void)addNumbersFromDictionary:(NSDictionary *)dictionary
Adds to the receiver the entries from a dictionary.
Discussion:
Each value in the dictionary must be an NSNumber object. Other object types will be discarded.
incrementNumberForKey:
- (void)incrementNumberForKey:(NSString *)key
Helper method to implement a simple counter. Adds one number to the number stored with the specified key and then re-saves it within the event.
setDuration:forKey
- (void)setDuration:(NSTimeInterval *)duration forKey:(NSString *)key
Adds a given key-value pair to the receiver, where the value is an NSTimeInterval value.
addDurationFromDictionary:
- (void)addDurationsFromDictionary:(NSDictionary *)dictionary
Adds to the receiver the entries from a dictionary.
Discussion:
Each value in the dictionary must be an NSTimeInterval object. Other object types will be discarded.
startTimerForKey:
- (void)startTimerForKey:(NSString *)key
Starts a timer with the specified key.
Discussion:
Call -endTimerForKey: to get the elapsed time and save the duration to the event. Has no effect on the event unless matched with an -endTimerForKey: call.
endTimerForKey:
- (NSTimeInterval)endTimerForKey:(NSString *)key
Ends timing for the specified key and saves the duration to the receiver with the key. Also returns the duration.
Discussion:
Has no effect unless -startTimerForKey: was first called with a matching key.