PXSDK 0.2.16

PXSDK 0.2.16

TestsTested
LangLanguage Obj-CObjective C
License Custom
ReleasedLast Release Aug 2015

Maintained by mitusha, Ankudinov macmini, Vova Zgonik.



PXSDK 0.2.16

  • By
  • Sid sid99

SDK integration instructions

PXSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "PXSDK"

Import "PXTracker.h" to your AppDelegate.m file, and init PXTracker with your game API key in didFinishLaunchingWithOptions delegate passing YES param if you want to use APNS for tracking:

[PXTracker initializeWithGameKey:@"Testgame01" enableDeviceToken:NO];

If you want to enable device token just perform method setupUserPredictionsForToken in didRegisterForRemoteNotificationsWithDeviceToken:

- (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
  [PXTracker setupUserPredictionsForToken:[deviceToken description]];
}

To show APNS rewards as UIAlerView you should add

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  .....
  if ([launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]) {
    [PXTracker processLaunchOptions:launchOptions];
  }


  return YES;
}

- (void)application:(UIApplication )application didReceiveRemoteNotification:(NSDictionary )userInfo {
    [PXTracker processPushNotification:userInfo];
 }

To handle virtual currency from rewards your class should conforms to protocol PXTrackerProtocol and responds to selector:

  • (void)addVirtualCurrency:(NSNumber *)virtualCurrency;

Import "PXTracker.h" in all the files where you want to track events.

Add that requirements frameworks to your project:

  • MobileCoreServices.framework
  • SystemConfiguration.framework
  • CFNetwork.framework

List of tracking events and offer availability

  • sendEvent - eventName, parameters dictonary
  • levelChange - timeStamp, fromLevel, toLevel, currency
  • tutorialChange - timeStamp, fromStep, toStep
  • transactionEvent - timeStamp, withName, buyVirtualCurrenct, receivingAmount, usingRealCurrency, spendingAmount
  • userHasIAPOffer - no parameters, return YES if IAPOffer is avaible

Custom event

Level change event consists of two fields that you can use to describe a users level change in your app:

  • NSString eventName
  • NSDictionary custom parametersList
[PXTracker sendEvent:@"myCustomEvent" withParams:@{@"paramName":@"paramValue"}];

Level change event

Level change event consists of two fields that you can use to describe a users level change in your app:

  • NSNumber fromLevel
  • NSNumber toLevel
[PXTracker recordLevelChangeEventFromLevel:@0 toLevel:@2 andCurrency:@20];

Tutorial step change event

Tutorial step change event consists of two fields that you can use to describe a users level change in your app:

  • NSNumber fromStep
  • NSNumber toStep
[PXTracker recordTutorialChangeEventFromStep:@0 toStep:@3];

Transaction event

Transaction event consists of five fields that you can use to describe a users level change in your app:

  • NSString WithName
  • NSString buyVirtualCurrency
  • NSNumber receivingAmount
  • NSString usingRealCurrency
  • NSNumber spendingAmount
[PXTracker recordTransactionEventWithName:@"test" buyVirtualCurrency:@"coins" receivingAmount:@21 usingRealCurrency:@"usd" spendingAmount:@3];

Availability of IAPOffer

Return YES BOOL value if IAPOffer enabled for the moment:

BOOL offerPresent = [PXTracker userHasIAPOffer];

Author

Sid99

License

PXSDK is available under the MIT license. See the LICENSE file for more info.