After working through Firebase's Analytics tutorial to add Analytics I'm able to see the sample code working after adding it to my app. To test it out, I added the analytics event to an IBAction method for when a specific button is tapped. The problem is that when I look at the console with Debug options turned for analytics, it shows the event firing multiple times. Why could this be happening?
Here is the debug console log:
2017-02-22 13:47:12.010901 NotKarltonBanks[1537:425489] <FIRAnalytics/DEBUG> Logging event: origin, name, params: app, select_content, {
"_o" = app;
"_sc" = MoreViewController;
"_si" = "-3358907490504482271";
"content_type" = button;
"item_id" = "id-1";
"item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
2017-02-22 13:47:12.012 NotKarltonBanks[1537:] <FIRAnalytics/DEBUG> Logging event: origin, name, params: app, select_content, {
"_o" = app;
"_sc" = MoreViewController;
"_si" = "-3358907490504482271";
"content_type" = button;
"item_id" = "id-1";
"item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
2017-02-22 13:47:12.019693 NotKarltonBanks[1537:425489] <FIRAnalytics/DEBUG> Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: select_content, {
"_dbg" = 1;
"_o" = app;
"_r" = 1;
"_sc" = MoreViewController;
"_si" = "-3358907490504482271";
"content_type" = button;
"item_id" = "id-1";
"item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
2017-02-22 13:47:12.021 NotKarltonBanks[1537:] <FIRAnalytics/DEBUG> Debug mode is enabled. Marking event as debug and real-time. Event name, parameters: select_content, {
"_dbg" = 1;
"_o" = app;
"_r" = 1;
"_sc" = MoreViewController;
"_si" = "-3358907490504482271";
"content_type" = button;
"item_id" = "id-1";
"item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
2017-02-22 13:47:12.048798 NotKarltonBanks[1537:425305] current page 0
2017-02-22 13:47:12.054340 NotKarltonBanks[1537:425305] current page 0
2017-02-22 13:47:12.101634 NotKarltonBanks[1537:425489] <FIRAnalytics/DEBUG> Event logged. Event name, event params: select_content, {
"_dbg" = 1;
"_o" = app;
"_r" = 1;
"_sc" = MoreViewController;
"_si" = "-3358907490504482271";
"content_type" = button;
"item_id" = "id-1";
"item_name" = "Tapped Not Karlton Keyboard Tutorial Button";
}
Here is my code:
- (IBAction)aboutURL:(id)sender {
[FIRAnalytics logEventWithName:kFIREventSelectContent
parameters:@{
kFIRParameterItemID:[NSString stringWithFormat:@"id-1"],
kFIRParameterItemName:@"Tapped Not Karlton Keyboard Tutorial Button",
kFIRParameterContentType:@"button"
}];
KeyboardTutorialViewController *keyboardTutorialViewController = [[KeyboardTutorialViewController alloc] init];
[self.navigationController pushViewController:keyboardTutorialViewController animated:YES];
}