Parse SDK iOS Analytics - ios

I am working with Parse SDK in my iOS Application. I have integrated Parse Facebook SDK with my Application. I just want to do an analytics based on Users not overall count like we can give read count or something. (e.g) I want to do know the current user's access count of modules which I am having in my application and overall How many users have visited the particular module in certian period of time.Please help me out on this.Thanks in advance

What you are looking for is the [PFAnalytics trackEvent: dimensions:] call. This allows you to track an event with a particular name as an NSString and provide dimensions as an NSDictionary.
Here's an example of what you could put in the loading code for each module:
NSDictionary *dimensions = #{
// Define the user via whatever unique ID you use
#"user": userId,
// Define the name of the module that is being loaded
#"module": #"moduleName",
};
// Send the dimensions to Parse along with the 'search' event
[PFAnalytics trackEvent:#"moduleLoad" dimensions:dimensions];
To get a total number of events, you will need to use the Parse.com dashboard. You may also need to download the events log and sum it via Excel.
Also, if you are looking for analytics tracking that is more robust at the user-level, I recommend http://www.mixpanel.com

Related

iOS: How to track firebase dynamic link

i have added UTM parameter using FIRDynamicLinkGoogleAnalyticsParameters
FIRDynamicLinkGoogleAnalyticsParameters *analyticsParams =
[FIRDynamicLinkGoogleAnalyticsParameters parametersWithSource:Source
medium:Medium
campaign:Campaign];
analyticsParams.term = Term;
analyticsParams.content = Content;
components.analyticsParameters = analyticsParams;
Now i want to track the dynamic link like this,
if i have shared on Facebook, any one tap on that link then it will go to application if there else it will go to App Store.
After i need to show message based upon it’s source i.e welcome from Facebook like message.
So can we track dynamic link and check from where the link has been tapped and show relevant message based upon i’t source.
Can anyone explain how to implement this:
https://firebase.google.com/docs/dynamic-links/analytics
By adding these tracking parameters to your Dynamic Links, Google
Analytics and iTunes Connect can treat them like any other campaign
it's measuring attribution reporting for, and you can view conversion
events not just by the ad campaigns responsible for bringing in those
users, but also by which Dynamic Links might have brought them in.
The following parameters are passed to Google Analytics: utm_source,
utm_medium, utm_campaign, utm_term, utm_content, gclid
The following parameters are passed to the App Store: at, ct, mt, pt
The same question was asked in this thread:
App link tracking with Firebase
Also I had posted this question on Firebase GitHub and got the reply:
https://github.com/firebase/firebase-ios-sdk/issues/4775
You can't track where the link was tapped from unless you create a
custom link (or add custom parameters) for each source, but even then
this will result in mismatches if a user ever copies a link and shares
it to a different source.

Google Analytics for iOS - Sending Custom Event Data using Dictionaries as createEventWithCategory allows only 4 parameters to be sent

I decided to use Google Analytics over Flurry, as Flurry stopped updating tracking Events and nobody from Flurry Support team replied to my query. My requirement is as follows:
"Whenever user clicks on tab I need to create an event which includes Tab Name, User ID, Time Stamp." A screenshot from Flurry Event log may describe it more clearly.
So, in Google Analytics Event Tracking function createEventWithCategory almost does the needful but it does not allow me to add my custom parameters like User ID, Time Stamp.
[tracker send:[[GAIDictionaryBuilder createEventWithCategory:#"ui_action" // Event category (required)
action:#"button_press" // Event action (required)
label:#"play" // Event label
value:nil] build]]; // Event value
I tried for two solutions and neither of them are upto my expectation which brings me with two questions regarding each approach I took:
Attempt 1: Custom Dimensions:
Documentation has a sample code like this :
// Set the custom dimension value on the tracker using its index.
tracker set:[GAIFields customDimensionForIndex:1]value:#"Premium user"]
[tracker set:kGAIScreenName value:#"Home screen"];
// Send the custom dimension value with a screen view.
// Note that the value only needs to be sent once, so it is set on the Map,
// not the tracker.
[tracker send:[[[GAIDictionaryBuilder createAppView] set:#"premium"
forKey:[GAIFields customDimensionForIndex:1]] build]];
[Custom dimension values can be sent with any Google Analytics hit type, including screen views, events, ecommerce transactions, user timings, and social interactions.]
So, I decided to use custom dimensions with createEventWithCategory method and ended up doing like as follows **which works but does not show data as Flurry showed. **
NSString *dimensionValue = #"USER_ID";
[tracker set:[GAIFields customDimensionForIndex:1] value:dimensionValue];
[tracker send:[[[GAIDictionaryBuilder createEventWithCategory:#"TAB_CLICK"
action:#"Tab Hit"
label:clickedTabName
value:nil]
set:currentUserEmail forKey:[GAIFields customDimensionForIndex:1]] build]];
Attempt 2: Setting and Sending Data using Dictionaries:
I followed the documentation and tried sending NSDictionary object to - (void)send:(NSDictionary *)parameters;method declared in GAITracker.h.
But I have no clue where this data will appear in dashboard. Neither in Behavior not in Real Time it shows any update.
id<GAITracker> tracker = [[GAI sharedInstance] trackerWithTrackingId:#"UA-XXXX-X"];
NSDictionary *dataToSendGoogleAnalytics = [NSDictionary dictionaryWithObjectsAndKeys:currentTime,#"TIME_STAMP",clickedTabName,#"TAB_NAME", currentUserEmail, #"USER_ID",nil];
[tracker send:dataToSendGoogleAnalytics];
Question: Can't I use something straightforward as Flurry which will give me result like in image and allow me to have event parameters like USER_EMAIL, Time_Stamp, TAB_NAME altogether with every event?:
Using simple function like this which accepts NSDictionary object?
[Flurry logEvent:#"TAB_CLICKED" withParameters:dataToSendFlurry timed:YES];
Any suggestions or hint would be appreciated. Thank you.
you can send custom data to google analytics by using custom dimension.
you need to add custom dimension from your dashboard
after adding that you will get the code..
Just integrate that in your project and follow below link to see the values.
http://www.lunametrics.com/blog/2013/09/10/access-custom-dimensions-google-analytics/#sr=g&m=o&cp=or&ct=-tmc&st=hpphmf%20dvtupn%20ejnfotjpo&ts=1384845402
I never used custom parameters with GA, anyway I think this can help you.
Open your Analytics in Behavior/Top Events.
Select any primary dimension and click over Secondary Dimension.
Click over Custom Variables to expand it.
Finally, select the variables your want to analise.
Now there is another solution for Google users.
There is another solution since Google set Firebase as a default for mobile application solution.
Firebase is Google's mobile app developer platform and helps developers incorporate Google's mobile app services quickly and easily – including Google Analytics.
Here is how Google Analytics changed the way of adding new property under Analytics admin page:
You can use Firebase send events like how in Flurry.
Try this method to send events:
[FIRAnalytics logEventWithName:kFIREventSelectContent
parameters:#{
kFIRParameterItemID:[NSString stringWithFormat:#"id-%#", self.title],
kFIRParameterItemName:self.title,
kFIRParameterContentType:#"image"
}];
There is no limit on the total volume of events your app logs.
View events in the dashboard
You can view aggregrated statistics about your Analytics events in the Firebase console dashboards. These dashboards update periodically throughout the day. For immediate testing, use the debug console output as described in the previous section.
You can access this data in the Firebase console as follows:
In the Firebase console, open your project.
Select Analytics from the menu to view the Analytics reporting dashboard.
The Events tab shows the event reports that are automatically created for each distinct type of Analytics event logged by your app. Read more about the Analytics reporting dashboard in the Firebase Help Center.
You can add Firebase using cocoapods. Add the dependency for Firebase to your Podfile:
pod 'Firebase/Core'
Run pod install and open the created .xcworkspace file.
Import the Firebase module in your UIApplicationDelegate subclass:
import Firebase
Configure a FIRApp shared instance, typically in your application's application:didFinishLaunchingWithOptions: method:
// Use Firebase library to configure APIs
FirebaseApp.configure()

How to integrate Facebook User's Newsfeed (or) Wall post in iOS App

I'm trying to integrate a custom view which shows a few post of the users Facebook news feed.
I'm looking for a good starting point. I don't want to use a UIWebView or something like this to grab the mobile site of Facebook instead I want to get data in JSON format or similar and display it in a custom fashion.
Can you give me any advice or links to tutorials how i can get the Facebook news feed data?
Edit: I want to update my requirements. I looked a bit into the Facebook Documentation and the SDK. There are some Sample Codes which are useful but I'm missing a straight forward tutorial or sample which does fetch the users newsfeed and displays it. This is why I made the bounty.
I will give the +100 Rep for somebody that creates a sample or tutorial which does get posts of the users newsfeed. Required would be: Get the name of the poster, message, timestamp and attached image. It would be nice if you also show them in a uiview but it is not required. If there is an existing framework feel free to link it.
I'm working myself on something similar and will publish it too. I think this could be tribute to the community.
I have created a sample starter project that gets the user's facebook newsfeed and displays it. It shows who did the post, the poster's profile picture, and when it was posted along with the message.
It is fairly rudimentary and could use some enhancement from other developers, i.e. endless scrolling, displaying any links, likes or recognizing URLs, etc.
https://github.com/AaronBratcher/UserFeed
I would integrate the Facebook API on my project, and then you can have access of many informations available on Facebook.
A good start point is read the documentation that you can find here:
https://developers.facebook.com
It's not hard to understand, but it has a lot of information!
Good luck.
At first, you need "read_stream" permission for your app.
Then read Facebook Query Language (FQL) Reference https://developers.facebook.com/docs/reference/fql/
To get the Newsfeed you can use the following code:
NSString *fqlString = #"SELECT * FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden=0 LIMIT <YOUR_LIMIT>";
[FBRequestConnection startWithGraphPath:#"/fql"
parameters: #{#"q": fqlString}
HTTPMethod:#"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
<ANALYZE RESPONSE>
}];
Facebook API / SDK Request Wrapper
News feed post class
Simple UI to test the code
Getting Started:
facebook-sdk-posting-to-user-news-feed
Sample App
To my knowledge you cannot obtain News Feed data in your application. stream table shows only the posts that have appeared on your wall. To create a News Feed for a user Facebook uses his own private algorithm (it was Facebook Edgerank, but read that recently they had changed this algorithm to a new one).
To my point of view, to achieve your goal you can crawl data of all your friends and try to create an algorithm that will range these posts similar to the way it is done by Facebook.

Track Facebook app installs through ads

We are looking for a way to track if the current user comes from a Facebook ad. Is there a way to achieve that?
We need to set this info in our database in order to make queries on these people (cohorts).
I found some similar questions :
Here
And here.
We are not looking for external services, we need to have this info in our database to create cohorts.
P.S: We are already tracking installs with [FBSettings publishInstall:FACEBOOK_APP_ID];
While reverse engineering some Tracking frameworks I found that most of them are getting the Facebook Attribute ID (Advertiser ID) from the pasteboard. It seems that Facebook is setting that after the ad is touched.
I couldn't find any documentation but the Facebook SDK has a class FBUtility with an attributionID class method.
+ (NSString *)attributionID
{
return [[UIPasteboard pasteboardWithName:#"fb_app_attribution" create:NO] string];
}

Using google analytics with hybrid mobile app

We are in the process of turning our native iPad app into a hybrid app. Some functionality and UI will remain in native code and other functionality will be implemented in HTML that will be served from our servers and will also be available offline.
The main issue I encounter now is with using Google Analytics:
The existing native code uses the GA SDK for IOS and I planned on using the web API for the web part, however I can't find how the data from both channels can be used together in GA as the data stores seem to be distinct.
Furthermore, I plan to use Google Analytics' Content Experiments for A/B testing the web part but conversion goals might be ones achieved in the native part.
Anyone have any experience with analytics on hybrid apps or alternative solutions.
Thanks
You really want to use the SDK. It has some features that will come handy for mobile apps like crashes, play store integration. It also sends data in batches to improve battery usage and also can queue hits while the app is offline to be sent when online. You won't be able to emulate that with the Javascript implementations.
So what you need to write is Javascript methods that send data from the WebView back to the Native Part of the App. This other Stack Overflow thread has more detail on how to do that.
So the javascript to track Google Analytics interactions could look something like this.
var _gaq = {};
_gaq.push = function(arr){
var i, hit;
hit = arr.slice(1).join('&');
location.href = 'analytics://'+arr[0]+'?'+arr;
};
Now this will work as a replacement for your ga.js file, you can still use the same API as you use on _gaq today on your Web App, and the adapter above will sends its data to te native part of the APP. And then you just need to write the native part that will intercept that HTTP request and use the native SDK to issue the Google Analytics functions.
A normal _gaq.push(['_trackPageview', '/homepage']); will become a uri like analytics://_trackPageview?/homepage, now you just need to intercept and parse that on the Native part.
- (BOOL)webView:(UIWebView*)webView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType {
NSURL *url = [request URL];
NSLog(#"Hit detected %#", url.absoluteString);
if ([[url scheme] isEqualToString:#"analytics"]) {
id<GAITracker> tracker = [[GAI sharedInstance] defaultTracker];
if ([url.host isEqualToString:#"_trackPageview"]) {
// Get the page from parameters and then track the native View.
// (...)
[tracker trackView:page];
}
else if ([url.host isEqualToString:#"_trackEvent"]) {
// Get the event parameters from url parameters and then track the native GA Event.
// (...)
[tracker trackEventWithCategory:cat
withAction:act
withLabel:lab
withValue:val];
}
// Check for all other analytics functions types
// (...)
// Cancel the request
return NO;
}
// Not an analytics: request.
return YES;
}
I hope it have given you a good starting point. Good luck.
Indeed a challenging configuration.
Have you looked into using analytics.js (Universal Analytics) for the web part ? Then you may be able to feed data into a single App profile
Else, you could send all the tracking calls from your backend, by using a server side implementation of the Measurement Protocol but you'll probably loose usage of Content Experiment !
I use http://www.flurry.com/ for my apps and Google Analytics for my other stuff. I never mixed both of them in the same app but I'm guessing it's doable. I'd sugest to check out flurry first. There's a good chance it will suffice also for an hybrid app.

Resources