Code Monkey home page Code Monkey logo

leanplum-segment-ios's Introduction

Leanplum Segment Integration for iOS

Leanplum SDK integration for the Segment iOS SDK.

Installation

To install the Leanplum Segment integration, simply add this line to your CocoaPods Podfile:

pod 'LeanplumSegment', '~> 1.1.0'

That's it! Now you can use the Segment SDK and also the advanced features of the Leanplum SDK.

Usage

Import the LeanplumSegment integration:

#import <LeanplumSegment/SEGLeanplumIntegrationFactory.h>

Add the following lines to your AppDelegate:

NSString *const SEGMENT_WRITE_KEY = @" ... ";
SEGAnalyticsConfiguration *config =
    [SEGAnalyticsConfiguration configurationWithWriteKey:SEGMENT_WRITE_KEY];
[config use:[SEGLeanplumIntegrationFactory instance]];
[SEGAnalytics setupWithConfiguration:config];

Now you can use Segment as you are used to, e.g.:

[[SEGAnalytics sharedAnalytics] track:@" ... "];

Note: There is no need to explicitly call Leanplum.start, as it is called within the LeanplumIntegration.

In addition to that you can also use the advanced features of Leanplum. Once the Leanplum SDK is successfully registered, Segement posts a NSNotification, hence register to it:

- (BOOL)application:(UIApplication *)application
    didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[...]
  [[NSNotificationCenter defaultCenter]
      addObserver:self
         selector:@selector(segmentIntegrationDidStart)
             name:SEGAnalyticsIntegrationDidStart
           object:LPLeanplumSegmentKey];
}

- (void)segmentIntegrationDidStart {
  [Leanplum onVariablesChanged:^{
      [...]
  }];
}

Example

We have included a sample application.

  1. Install CocoaPods in Example Project: cd Example && pod install
  2. To run the sample app open LeanplumSegment.xcworkspace
  3. Choose & run target LeanplumSegment_Example

Tests

We have included unit tests for the integration.

  1. To run the unit tests open LeanplumSegment.xcworkspace
  2. Choose & test target LeanplumSegment_Tests

Install Specific Version of SDK's

By default this integration pulls in the latest versions of the Leanplum SDK and the Segment SDK. If you rather want to use a specific version, simply specify the required versions in your podfile directly.

pod 'Analytics', '3.0.1'
pod 'Leanplum-iOS-SDK', '1.2.23'

Deploy to CocoaPods

  1. Update Version in LeanplumSegment.podspec
s.version          = "1.1.0"
  1. Commit & Push Latest Changes, then mark latest release by tag:
git tag 1.0.0
git push --tags
  1. Validate Library:
pod lib lint --use-libraries --verbose
pod spec lint --use-libraries --verbose
  1. Publish to CocoaPods (Caution, once published cannot be undone!)
pod trunk push --use-libraries

License

See LICENSE file.

leanplum-segment-ios's People

Contributors

benmarten avatar milos1290 avatar wanelo-pair avatar

Watchers

Felix Clack avatar James Cloos avatar Alwin Daniel avatar Gary avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.