Skip to content
This repository has been archived by the owner on Aug 24, 2019. It is now read-only.

Commit

Permalink
Add integration instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
soffes committed Mar 19, 2012
1 parent ed314bc commit 3583ece
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Readme.markdown
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
```

0 comments on commit 3583ece

Please sign in to comment.