-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Benjamin Herzog
committed
Jun 23, 2016
1 parent
33687a9
commit 5749ed3
Showing
8 changed files
with
81 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#import "ARAnalyticalProvider.h" | ||
|
||
/** | ||
* Use this provider to track events to Appboy. | ||
* | ||
* NOTE: You still need to setup Appboy in your AppDelegate (needs application and launchOptions)! | ||
* Use [Appboy startWithApiKey:@"YOUR-API-KEY" inApplication:application withLaunchOptions:launchOptions]; for this. | ||
*/ | ||
@interface AppboyProvider : ARAnalyticalProvider | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#import "AppboyProvider.h" | ||
#import "ARAnalyticsProviders.h" | ||
#import <Appboy-iOS-SDK/AppboyKit.h> | ||
|
||
@implementation AppboyProvider | ||
#ifdef AR_APPBOY_EXISTS | ||
|
||
- (void)identifyUserWithID:(NSString *)userID andEmailAddress:(NSString *)email { | ||
NSAssert([Appboy sharedInstance], @"You need to call [Appboy startWithApiKey:inApplication:withLaunchOptions:] before setting the user id!"); | ||
[[Appboy sharedInstance] changeUser:userID]; | ||
} | ||
|
||
- (void)setUserProperty:(NSString *)property toValue:(id)value { | ||
|
||
NSAssert([Appboy sharedInstance], @"You need to call [Appboy startWithApiKey:inApplication:withLaunchOptions:] before setting user properties!"); | ||
|
||
if ([value isKindOfClass:[NSString class]]) { | ||
[[Appboy sharedInstance].user setCustomAttributeWithKey:property andStringValue:value]; | ||
} | ||
else if ([value isKindOfClass:[NSNumber class]]) { | ||
[[Appboy sharedInstance].user setCustomAttributeWithKey:property andDoubleValue:[value doubleValue]]; | ||
} | ||
else if ([value isKindOfClass:[NSDate class]]) { | ||
[[Appboy sharedInstance].user setCustomAttributeWithKey:property andDateValue:value]; | ||
} | ||
else { | ||
NSLog(@"Appboy is not able to track user properties that are not strings, numbers or dates."); | ||
} | ||
} | ||
|
||
- (void)event:(NSString *)event withProperties:(NSDictionary *)properties { | ||
NSAssert([Appboy sharedInstance], @"You need to call [Appboy startWithApiKey:inApplication:withLaunchOptions:] before setting user properties!"); | ||
[[Appboy sharedInstance] logCustomEvent:event withProperties:properties]; | ||
} | ||
|
||
- (void)didShowNewPageView:(NSString *)pageTitle { | ||
[self didShowNewPageView:pageTitle withProperties:nil]; | ||
} | ||
|
||
- (void)didShowNewPageView:(NSString *)pageTitle withProperties:(NSDictionary *)properties { | ||
|
||
// Appboy does not use pageViews, so a pageView is just another custom event | ||
[self event:pageTitle withProperties:properties]; | ||
} | ||
|
||
- (void)incrementUserProperty:(NSString *)counterName byInt:(NSNumber *)amount { | ||
|
||
[[Appboy sharedInstance].user incrementCustomUserAttribute:counterName by:amount.integerValue]; | ||
} | ||
|
||
#endif | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters