This repository has been archived by the owner on Aug 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Showing
1 changed file
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,58 @@ | ||
# Localytics | ||
|
||
This is my fork of the [Localytics](http://www.localytics.com) iOS client. Mainly fixing warnings and such. | ||
|
||
## Integration | ||
|
||
* Download from http://www.localytics.com/docs/iphone-integration/ | ||
* Add files to your project | ||
* Disable ARC for those files if you're using ARC | ||
* Add libSqlite3 to your target | ||
|
||
``` objective-c | ||
#define ANALYTICS_ENABLED (!DEBUG && !TARGET_IPHONE_SIMULATOR) | ||
|
||
#if ANALYTICS_ENABLED | ||
#import "LocalyticsSession.h" | ||
#define LLStartSession(key) [[LocalyticsSession sharedLocalyticsSession] startSession:(key)]; | ||
#define LLLogEvent(name) [[LocalyticsSession sharedLocalyticsSession] tagEvent:(name)]; | ||
#define LLLogEventWithAttributes(name, parameters) [[LocalyticsSession sharedLocalyticsSession] tagEvent:(name) attributes:(parameters)]; | ||
#define LLLogScreen(screen) [[LocalyticsSession sharedLocalyticsSession] tagScreen:screen]; | ||
#else | ||
#define LLStartSession(...) | ||
#define LLLogEvent(...) | ||
#define LLLogEventWithAttributes(...) | ||
#define LLLogScreen(...) | ||
#endif | ||
``` | ||
|
||
App delegate: | ||
|
||
``` objective-c | ||
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { | ||
LLStartSession(@"YOUR_KEY"); | ||
|
||
// ... | ||
|
||
return YES; | ||
} | ||
|
||
|
||
#if ANALYTICS_ENABLED | ||
- (void)applicationWillEnterForeground:(UIApplication *)application { | ||
[[LocalyticsSession sharedLocalyticsSession] resume]; | ||
[[LocalyticsSession sharedLocalyticsSession] upload]; | ||
} | ||
|
||
|
||
- (void)applicationDidEnterBackground:(UIApplication *)application { | ||
[[LocalyticsSession sharedLocalyticsSession] close]; | ||
[[LocalyticsSession sharedLocalyticsSession] upload]; | ||
} | ||
|
||
|
||
- (void)applicationWillTerminate:(UIApplication *)application { | ||
[[LocalyticsSession sharedLocalyticsSession] close]; | ||
} | ||
#endif | ||
``` |