Skip to content

Instantly share code, notes, and snippets.

@grantmiller
grantmiller / lp-mobile-conversion.js
Last active December 21, 2015 03:29
LP Mobile Conversion sample
/**
* Reports custom events to the LivePerson Agent Console and reporting system.
* @param {string} name of the event
* @param {Object} mixed data associated with the event
*/
/**
* Predefined event name constants
*/
LPMobile.LP_EVENT_CONVERSION;
LIOLookIOManager *lookIO = [LIOLookIOManager sharedLookIOManager];
[lookIO clearCustomVariables];
LIOLookIOManager *lookIO = [LIOLookIOManager sharedLookIOManager];
NSString* customerId = [lookIO customVariableForKey:@"customer_id"];
LIOLookIOManager *lookIO = [LIOLookIOManager sharedLookIOManager];
[lookIO setCustomVariable:@"654321" forKey:@"customer_id"];
LIOLookIOManager *lookIO = [LIOLookIOManager sharedLookIOManager];
[lookIO addCustomVariables:[NSDictionary dictionaryWithObjectsAndKeys:
@"[email protected]", @"email_address",
@"123456", @"customer_id",
nil];
// Use the following to report an event.
- (void)reportEvent:(NSString *)anEvent;
- (void)reportEvent:(NSString *)anEvent withData:(id<NSObject>)someData;
// Use the following constants for reporting common events.
NSString *kLPEventConversion;
NSString *kLPEventPageView;
NSString *kLPEventSignUp;
NSString *kLPEventSignIn;
NSString *kLPEventAddedToCart;
@interface MyNavigationController : UINavigationController
@end
@implementation MyNavigationController
-(BOOL)shouldAutorotate {
LIOLookIOManager* lookIOManager = [LIOLookIOManager sharedLookIOManager];
if ([lookIOManager shouldLockInterfaceOrientation])
return NO;
// For apps supporting iOS 6.0 and above
-(BOOL)shouldAutorotate {
LIOLookIOManager* lookIOManager = [LIOLookIOManager sharedLookIOManager];
if ([lookIOManager shouldLockInterfaceOrientation])
return NO;
return YES;
}
// For apps supporting iOS < 6.0
-(UInt32)lookIOManagerEnabledCollaborationComponents:(LIOLookIOManager *)aManager {
return kLPCollaborationComponentPhoto;
}
-(void)viewWillAppear:(BOOL)animated
{
[[LIOLookIOManager sharedLookIOManager] setSkill:@"YOUR NEW SKILL"];
// YOUR CODE
}