Google Analytics Event and Social Reporting on iOS - iphone

I'm using the latest version of Google analytics for iOS (up to this post date).
The pageViews are logged and reported correctly but the events and social events aren't. Here are some snippets of my code:
#interface RootViewController : GAITrackedViewController
All my ViewControllers inherit the GAITrackedViewController
[self.tracker sendEventWithCategory:#"Twitter" withAction:#"Tweet" withLabel:#"Tweet App Info" withValue:nil];
[self.tracker sendSocial:#"Twitter" withAction:#"Tweet App Info" withTarget:nil];
I call this from my view controller to log an event of sending a tweet, but when I check my Google analytics (Engagement->Events->OverView) no events are logged. This is not real time data, I'm talking about 3 days of testing without events reported.
I'm following this guide by Google Mobile App Analytics, but when using
[tracker sendEvent]
I get errors so I use
[self.tracker sendEvent]
and I think it uses the default tracker of the app.
Any help with this problem ?

for me, the [self.tracker ...] or [tracker ...] calls did not work. I ended up using the shared instance default tracker as follows:
[[GAI sharedInstance].defaultTracker sendEventWithCategory:#"TAC_Agree" withAction:#"buttonClick" withLabel:#"" withValue:[NSNumber numberWithInt:0]];
This definitely works for me.

Related

ios app rejected on using AWS cognito implementation from mobile hub

We recently got our ios app rejected because of the following:
We noticed that the user is taken to Safari to sign in or register for an account, which provides a poor user experience.
however, the bit that launches the safari window for facebook/Google login is part of the AWSMobileHubHelper framework so we can't modify that code.
Any ideas/solutions would be greatly appreciated.
So I found a workaround. I just grab the GIDSignIn instance and change the properties myself. In case any one else wants to know how, all you have to do is:
Add a bridge header and import #import <GoogleSignIn/GoogleSignIn.h>
Implement the presentViewController method for GIDSignInUIDelegate on your main login controller
func signIn(signIn: GIDSignIn!, presentViewController viewController: UIViewController!) {
presentViewController(viewController, animated: true, completion: nil)
}
Edit demo login code to be something like this:
func loginWithGoogle(delegate: GIDSignInUIDelegate!) {
let googleProvider = AWSGoogleSignInProvider.sharedInstance()
// It is important that these are initialized after
// AWSGoogleSignInProvider.sharedInstance() is called
GIDSignIn.sharedInstance().uiDelegate = delegate
GIDSignIn.sharedInstance().allowsSignInWithBrowser = false
GIDSignIn.sharedInstance().allowsSignInWithWebView = true
handleLoginWithSignInProvider(googleProvider, callback: callback)
}
As of iOS 9 using Facebook SDK, this is expected behavior per Facebook login. Mobile Hub quickstart app is just applying the Facebook SDK 3 and using the APIs as directed. Check out the brief description below and read through the comments to get a better insight. This was not a popular decision by Facebook and others have provided workarounds (to forcing user authentication via mobile browser) if you wish to experiment. As for the AWSMobileHubHelper framework, we are looking into making this available at some point but don't have a timeline for this.
"Logic that automatically defaults people to the optimum experience for iOS 9. This means that the SDK dialogs for Facebook Login, Sharing across Facebook and Messenger, App Invites, App Events, or Native Like will automatically determine the best experience for people based on their device."
Source:
https://developers.facebook.com/blog/post/2015/09/10/new-SDK-for-iOS9/

ios Add Event to google calendar

I have searching how to add event t users google calendar. In my project I have database with events(title,startDate,endDate etc). When user clicks sync button all this events should be add to users google calendar.
I downloaded api from here. But its for MAC OS. Since I never worked on MAC OS application I cant understand how to use it in IOS app.
Please help me and tell which view controller to use asking for username and password, then login to google calendar service and add event in it.
Thank you.
I got http://code.google.com/p/google-api-objectivec-client/. But its difficult to understand. It takes username and password from preferences. Then gets calendars and adds events, but to add we need ticket and some more things. This code did some things.
In their add event method I wrote my own event object and tried to add that, but its not working. Here is the code:
- (void)insertCalendarEvent:(GDataEntryCalendarEvent *)event toCalendar:(GDataEntryCalendar *)calendar
{
NSLog(#"adding event");
GDataDateTime *time = [GDataDateTime dateTimeWithDate:[NSDate date] timeZone:(NSTimeZone*)[NSTimeZone timeZoneForSecondsFromGMT:0]];
GDataEntryCalendarEvent *newEntry = [GDataEntryCalendarEvent calendarEvent];
[newEntry setTitleWithString:#"title"];
[newEntry addLocation:[GDataWhere whereWithString:#"pune"]];
[newEntry addTime:[GDataWhen whenWithStartTime:time endTime:time]];
[googleCalendarService fetchEntryByInsertingEntry:newEntry
forFeedURL:[[calendar alternateLink] URL]
delegate:self
didFinishSelector:#selector( insertTicket:finishedWithEntry:error: )];
}
My requirement is simple. I just want add my custom events to google calendar. Get calendar, get ticket, and in for loop add all my events.
Instead of using Google API and a new window where the user needs to be login again, you should use the EventKit, it's pretty easy stuff and you could sync to the Calendar where the user wants, not only Google cal.
I have the same requirement like yours to integrate google calendar and syncing events. I researched and found documentation from here but I didn't understand it clearly, so later I found another good tutorial for accessing google calendar API's. You can try this for your requirement.
As #Tuss Laszlo mentioned, the Google API Client library is your best option to add events only to a Google Calendar. Google has a calendar sample in their example code. See the example for the full implementation of adding calendar events.

Adding Flurry in the alertView

I have added a Flurry logevent when the ok button of the alertView is clicked.
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex;
{
if (buttonIndex == 1)
{
NSString *start = #"Start";
NSString* myLogEvent = [start stringByAppendingString:title.text];
NSLog(#"%#",myLogEvent);
[Flurry logEvent:myLogEvent];
}
}
I have logged the event like 2 hours ago. It is still not appearing in my Flurry Login Page. Did i do something wrong?
I know the analytics takes time to appear but the event name should appear in the login page after 45 minutes or so. Am i right? Worried I did something wrong..
Usage data from Flurry may take up to 7 hours to get reflected on the developer portal. First time Events may take slightly longer.
Edit: If you're using the simulator, please ensure that you press the home button before closing the app. This is required in order to complete the Flurry reporting lifecycle.
(Full disclosure: I work in the Support team at Flurry)
Flurry proved to work for me including events, so it should work for you, too. I'd check with the debugger that the Flurry session was started ([Flurry startSession:#"YOUR_API_KEY"]) and your event code got really executed. And that you have internet connection, otherwise all events will get saved locally and transfered to Flurry on the next occasion.
Than wait some more, it takes time at times for the analytics results to show...

Chartboost in iphone project / Chartboost usage in iOS

Integrated chartoost sdk in to iPhone game. (Landscape game)
#define CHARTBOOST_ID #"55c9f216f6cd4572f3975566"
#define CHARTBOOST_SIG #"9cc8122cfb05bfe0e171f46990180147e8b6f23c"
[Chartboost startWithAppId:CHARTBOOST_ID appSignature:CHARTBOOST_SIG delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
But it is not displaying any ads. Help me to find what's wrong with settings in Xcode or account in chart boost.
Notes_Warning :
Hi All, don't use Chartboost, instead try google Admob or other ads network. Because Chartboost - a cheater! I used Chartboost in my games, game got good ranking in Cambodia - reached #1 in Racing/games. Game got good downloads too...But Chartboost said we used many device in Cambodia and downloaded game...its not true...we are not from Cambodia...I tried to send message to Chartboost many times...but they didn't respond and suspended my account. They even didn't pay my 7463$. Really its a heart attack for us. Now we removed Chartboost and used Admob and earned our development cost from Admob easily. So avoid Chartboost avoid getting cheated!!! Truth always wins...Always do good.
Be a good person but don't try to prove it. Just go away from bad cheaters!!!!
Notes_Warning :
Hi All, don't use Chartboost, instead try google Admob or other ads network. Because Chartboost - a cheater! I used Chartboost in my games, game got good ranking in Cambodia - reached #1 in Racing/games. Game got good downloads too...But Chartboost said we used many device in Cambodia and downloaded game...its not true...we are not from Cambodia...I tried to send message to Chartboost many times...but they didn't respond and suspended my account. They even didn't pay my 7463$. Really its a heart attack for us. Now we removed Chartboost and used Admob and earned our development cost from Admob easily. So avoid Chartboost avoid getting cheated!!! Truth always wins...Always do good. Be a good person but don't try to prove it. Just go away from bad cheaters!!!!
Now its working fine. We need to add publishing campaign in our chartboost account. Here
UPDATES:
[Chartboost startWithAppId:CHARTBOOST_APP_ID appSignature:CHARTBOOST_APP_SIGNATURE delegate:self];
[Chartboost showInterstitial:CBLocationHomeScreen];
Some other way to see test Ads:
Add your device UDID in publishing campaign
Enable test mode in App settings.
Perhaps there has been an error in loading them. I would implement the delegate methods as described in the docs, particularly the didFail method:
// Called before requesting an interstitial from the back-end
- (BOOL)shouldRequestInterstitial:(NSString *)location;
// Called when an interstitial has been received, before it is presented on screen
// Return NO if showing an interstitial is currently inappropriate, for example if the user has entered the main game mode
- (BOOL)shouldDisplayInterstitial:(NSString *)location;
// Called when the user dismisses the interstitial
- (void)didDismissInterstitial:(NSString *)location;
// Same as above, but only called when dismissed for a close
- (void)didCloseInterstitial:(NSString *)location;
// Same as above, but only called when dismissed for a click
- (void)didClickInterstitial:(NSString *)location;
// Called when an interstitial has failed to come back from the server
// This may be due to network connection or that no interstitial is available for that user
- (void)didFailToLoadInterstitial:(NSString *)location;
It may also be because the Campaign is not filling adverts and you have not added the devices as test devices to force the adverts to be filled.
This is easily missed since at first adverts may be filled - only during testing they'll just stop mysteriously.
There is a setting in Chartboost:
Edit the Campaign you are using for testing
Under "Campaign Logic" click the "Show Test Devices" button.
Click "Add Test Device" to add each device.
Enable each device and Save the Campaign.
(Don't forget to un-tick them when live - since I assume that missing that will mean those devices keep seeing adverts but you probably want to see how the app really behaves)
You need to set
cb.delegate = self;

Disabling automatic message box on ShareKit on IOS

we trying to disable the automatic message box when we authenticate twitter on an Ios App. We click connect, once it's authenticated, it opens up a message box. We just want to connect, thats it without the box. Anyone came across this?
It is simple, just do not share, only authorize:
SHKTwitter *twSharer = [[SHKTwitter alloc] init];
[twSharer authorize];
[twSharer release];
If you wish to get authorised user info (in the form of dictionary in NSUserDefaults), such as username run
[SHKTwitter getUserInfo];
for more info see ShareKit 2.0 FAQ
Mentioned behaviour is corresponding with pre iOS 5 implementation. If you use iOS 5 everything is handled by native iOS Twitter framework