Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // Created by Danilo Priore on 20/02/13.
- // www.prioregroup.com
- //
- // CCLayer+GoogleAnalytics.h
- #import "CCLayer.h"
- @interface CCLayer (GoogleAnalytics)
- @end
- // CCLayer+GoogleAnalytics.m
- import "CCLayer+GoogleAnalytics.h"
- #import "GAI.h" // Google Analytics SDK
- @implementation CCLayer (GoogleAnalytics)
- // overwrite original method of CCLayer
- - (void)onEnterTransitionDidFinish {
- NSString *className = NSStringFromClass([self class]);
- // filter only for my classes (in this case the names start with "game")
- if (![[className substringToIndex:4] isEqualToString:@"Game"])
- return;
- #ifndef DEBUG
- // track of the specified view was displayed
- [[GAI sharedInstance].defaultTracker sendView:className];
- #else
- NSLog(@"Class Name: %@", className);
- #endif
- // original code of CCLayer
- #ifdef __CC_PLATFORM_IOS
- if( isAccelerometerEnabled_ )
- [[UIAccelerometer sharedAccelerometer] setDelegate:self];
- #endif
- [super onEnterTransitionDidFinish];
- }
- @end
Add Comment
Please, Sign In to add comment