diff --git a/iphone/Maps/Classes/MapViewController.mm b/iphone/Maps/Classes/MapViewController.mm index a609a26f28..5e3b3ff756 100644 --- a/iphone/Maps/Classes/MapViewController.mm +++ b/iphone/Maps/Classes/MapViewController.mm @@ -16,6 +16,7 @@ #import "CountryTreeVC.h" #import "Reachability.h" #import "MWMAlertViewController.h" +#import "../../../3party/Alohalytics/src/alohalytics_objc.h" #import "../../Common/CustomAlertView.h" @@ -42,6 +43,8 @@ #define FACEBOOK_URL @"http://www.facebook.com/MapsWithMe" #define FACEBOOK_SCHEME @"fb://profile/111923085594432" +extern NSString * const kAlohalyticsTapEventKey = @"$onClick"; + @interface NSValueWrapper : NSObject -(NSValue *)getInnerValue; @@ -279,11 +282,13 @@ - (IBAction)zoomInPressed:(id)sender { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"+"]; GetFramework().Scale(2.0); } - (IBAction)zoomOutPressed:(id)sender { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"-"]; GetFramework().Scale(0.5); } @@ -1027,16 +1032,25 @@ - (void)toolbar:(ToolbarView *)toolbar didPressItemWithName:(NSString *)itemName { if ([itemName isEqualToString:@"Location"]) + { [self onMyPositionClicked:nil]; + } else if ([itemName isEqualToString:@"Search"]) + { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"search"]; [self.searchView setState:SearchViewStateFullscreen animated:YES withCallback:YES]; + } else if ([itemName isEqualToString:@"Bookmarks"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"bookmarks"]; BookmarksRootVC * vc = [[BookmarksRootVC alloc] init]; [self.navigationController pushViewController:vc animated:YES]; } else if ([itemName isEqualToString:@"Menu"]) + { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"menu"]; [self.bottomMenu setMenuHidden:NO animated:YES]; + } } #pragma mark - Routing @@ -1142,16 +1156,19 @@ { if ([itemName isEqualToString:@"Maps"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"downloader"]; CountryTreeVC * vc = [[CountryTreeVC alloc] initWithNodePosition:-1]; [self.navigationController pushViewController:vc animated:YES]; } else if ([itemName isEqualToString:@"Settings"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"settingsAndMore"]; SettingsAndMoreVC * vc = [[SettingsAndMoreVC alloc] initWithStyle:UITableViewStyleGrouped]; [self.navigationController pushViewController:vc animated:YES]; } else if ([itemName isEqualToString:@"Share"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"share@"]; CLLocation * location = [MapsAppDelegate theApp].m_locationManager.lastLocation; if (location) { diff --git a/iphone/Maps/CommunityVC.m b/iphone/Maps/CommunityVC.m index 2c45b68b2a..0592e66124 100644 --- a/iphone/Maps/CommunityVC.m +++ b/iphone/Maps/CommunityVC.m @@ -3,6 +3,9 @@ #import "UIViewController+Navigation.h" #import "UIKitCategories.h" #import +#import "../../3party/Alohalytics/src/alohalytics_objc.h" + +extern NSString * const kAlohalyticsTapEventKey; @interface CommunityVC () @@ -65,18 +68,22 @@ NSString * itemId = self.items[indexPath.section][@"Items"][indexPath.row][@"Id"]; if ([itemId isEqualToString:@"Facebook"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"likeOnFb"]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://facebook.com/MapsWithMe"]]; } else if ([itemId isEqualToString:@"Twitter"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"followOnTwitter"]; [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://twitter.com/MAPS_ME"]]; } else if ([itemId isEqualToString:@"Contact"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"contactUs"]; [self contact]; } else if ([itemId isEqualToString:@"Subscribe"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"subscribeToNews"]; [self subscribe]; } [tableView deselectRowAtIndexPath:indexPath animated:YES]; diff --git a/iphone/Maps/SettingsAndMoreVC.mm b/iphone/Maps/SettingsAndMoreVC.mm index 220dfd38c7..8d25a27cc8 100644 --- a/iphone/Maps/SettingsAndMoreVC.mm +++ b/iphone/Maps/SettingsAndMoreVC.mm @@ -10,6 +10,9 @@ #import "WebViewController.h" #import "CommunityVC.h" #import "RichTextVC.h" +#import "../../3party/Alohalytics/src/alohalytics_objc.h" + +extern NSString * const kAlohalyticsTapEventKey; @interface SettingsAndMoreVC () @@ -125,34 +128,41 @@ NSString * itemId = self.items[indexPath.section][@"Items"][indexPath.row][@"Id"]; if ([itemId isEqualToString:@"About"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"about"]; [self about]; } else if ([itemId isEqualToString:@"Community"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"community"]; CommunityVC * vc = [[CommunityVC alloc] initWithStyle:UITableViewStyleGrouped]; [self.navigationController pushViewController:vc animated:YES]; } else if ([itemId isEqualToString:@"RateApp"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"rate"]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; [self rateApp]; } else if ([itemId isEqualToString:@"Settings"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"settingsMiles"]; SettingsViewController * vc = [self.mainStoryboard instantiateViewControllerWithIdentifier:[SettingsViewController className]]; [self.navigationController pushViewController:vc animated:YES]; } else if ([itemId isEqualToString:@"ReportBug"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"reportABug"]; [tableView deselectRowAtIndexPath:indexPath animated:YES]; [self reportBug]; } else if ([itemId isEqualToString:@"Help"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"help"]; [self help]; } else if ([itemId isEqualToString:@"Copyright"]) { + [Alohalytics logEvent:kAlohalyticsTapEventKey withValue:@"copyright"]; [self copyright]; } } diff --git a/map/location_state.cpp b/map/location_state.cpp index dea8915593..674636959f 100644 --- a/map/location_state.cpp +++ b/map/location_state.cpp @@ -24,6 +24,7 @@ #include "../geometry/rect2d.hpp" #include "../geometry/transformations.hpp" +#include "../../3party/Alohalytics/src/alohalytics.h" namespace location @@ -306,23 +307,29 @@ bool State::IsModeHasPosition() const void State::SwitchToNextMode() { + string const kAlohalyticsClickEvent = "$onClick"; Mode currentMode = GetMode(); Mode newMode = currentMode; + if (!IsInRouting()) { switch (currentMode) { case UnknownPosition: + alohalytics::LogEvent(kAlohalyticsClickEvent, "@UnknownPosition"); newMode = PendingPosition; break; case PendingPosition: + alohalytics::LogEvent(kAlohalyticsClickEvent, "@PendingPosition"); newMode = UnknownPosition; m_afterPendingMode = Follow; break; case NotFollow: + alohalytics::LogEvent(kAlohalyticsClickEvent, "@NotFollow"); newMode = Follow; break; case Follow: + alohalytics::LogEvent(kAlohalyticsClickEvent, "@Follow"); if (IsRotationActive()) newMode = RotateAndFollow; else @@ -332,11 +339,10 @@ void State::SwitchToNextMode() } break; case RotateAndFollow: - { - newMode = UnknownPosition; - m_afterPendingMode = Follow; - break; - } + alohalytics::LogEvent(kAlohalyticsClickEvent, "@RotateAndFollow"); + newMode = UnknownPosition; + m_afterPendingMode = Follow; + break; } } else