Best way to go about creating in-house analytics for my Rails 3 app? - ruby-on-rails

I have a Rails 3 app that I'm looking to create in-house analytics for. The items I need to track are impressions (and unique impressions), clicks that come from those impressions, and conversions that come from those clicks. And these are all user-specific so each user can see how many impressions, clicks, and conversions they've received.
What is the best way to go about this? Should I create a separate rails app and call it with pixels? Or should I include all the analytics code in the same app?
Also, are there any analytics platforms already out there that I can customize to meet my needs?
Thanks!
Tim

Before you start re-inventing the wheel, Google Analytics provide a developer API (via OAuth, among other choices) that may provide you with the ability to do what you need (provide each user with a view of their own data).
http://code.google.com/apis/analytics/docs/gdata/home.html
Building your own, while it may seem like an initially basic thing to do, could have serious performance implications further down the line, and Google provide a very detailed view of the the data.
If you really want to write your own, I would strongly urge you not to hit the database for each request you want to track. Keep the data in Redis, or one of the alternatives and periodically persist it to the database via a background task.

If, however, you don't want to put your data into the clutches of our Google Overlord :) then you might indeed consider rolling your own. I have twice before - and I'm doing it again right now: better this time, of course!
If your traffic is not very high and you're running on any decent server platform then adding a tracking system is not going to tax your Rails app noticeably (I know that depends on what 'decent server platform' means but this stuff is pretty cheap these days). Writing to a database is typically very fast - you'd have to have shedloads of clicks to not want to do this straightaway. You can probably bypass most if not all of your before_filters and so on to get a lightning response. One app that runs 2.3.9 uses Metal to do this, for example.
In my new tracking system I have an STI table that goes with models derived from an Activity model; in here you can record both impressions and clicks. Impressions are recorded as the page is built and clicks are recorded using AJAX.
I'm not going to bother with fancy graphs and so on - I'm happy with raw numbers - but these could be added, of course.
At the moment my system is just in the usual app/ folder but I'll probably move it to an engine so I can re-use it more easily.
Hope that helps!
BTW I use Google Analytics as well for a range of sites and it's OK - I just like to do this bit myself.

Depending on how you are going to associate Google Analytics data with a specific user then you might need to double-check the privacy implications. Google doesn't allow their data to be associated with any identifying information about the users being tracked.
If there is a problem then you could try out Piwik as it's open source and you can do what you like with it. It's written in PHP, not Ruby so that might be an issue. As #d11wtq mentions, tracking systems can have performance issues if not built in the right way so you'd be better off starting from something that's already proven to work if possible.

Related

A/B testing(show new feature only for 50% of users)

I'am creating a new feature for my iOS app. After I publish the app I wants to show the new feature only for 50% of the users, so I can do some testing which version makes more orders. I have no idea how to do it without using some third parties like Optimizely.
Also is it possible to do this using Google Tag Manager(GTM).
So can someone please help me to figure this out.
Thank you very much for your time.:)
It’s hard to do it on your own, though not impossible of course: Optimizelys of the world are just programs. You’ll need to solve these problems:
Targeting: Some algorithm that will assign user session to either control or (one of) treatment(s). This has to be random, of course, or you may as well stop there.
Routing: Send sessios to the targeted experience.
Logging: You’ll need to intelligently log events from sessions as they traverse their targeted experience. These may be many, so be careful not to add latency to your app path. Your statistical analysis will be based on these.
Experience stability: how do you ensure (if you do) that a returning user sees the same experience he’s already seen.
Note as well, that Optimizely will only help you if all your changes are on the device and not on the server. If you need to instrument server changes as well, you’ll have to look into Sitespect or Variant.
I finally figured out how to do the A/B testing with 'Google Tag Manager'(GTM).
In GTM you can create a variable called 'Google Analytics Content Experiment'. With this variable you can select how many percentage of users going to see each Variation(your experiments). You can create up to 10 variations for single experiment.
GTM is so cool and powerful. GTM contains so many features that could save lot of time and I totally recommend it for anyone who is going to do A/B testing.

IOS swift - Tracking used apps

I'm currently looking for a way to track user activity. I'm working on an IOS app using swift and i need stats of apps usage. basically I want to get-make a tracking of the used apps. Data like opened apps, start time and shut down time... I know that for get all stats, maybe is necessary run a backgroud service, but, this is another problem that i think to solve after. for now i want to know if it's posible, if there is some way to get stats for used apps. I know that the UIApplication class call the UIApplicationMain function when an app is launched. Maybe, from my app, there is a way for access this info?... Thanks, i have been a long time reading but really, i can't see some clear option.
If (as David has interpreted your question in the comments) you are trying to track usage of other apps that aren't yours, he's right; you can only track your own app's usage.
If you are needing to track events in your own app, there are a good number of analytic frameworks available to do exactly what you are needing to do.
Flurry is one I've used in the past with success, and is one of the more well know solutions. I've also utilized Google's analytics framework. Both are pretty straightforward to integrate into your app and to track the sort of fine grained events you are looking to capture. You can't go wrong with either one of those.
Here is a (slightly old) list of additional tracking/analytics options beyond Flurry and Google's offerings.
You can record your feedback and user experiences, and bug reports with lookback.io

Mobile iOS usage tracking

I'm currently looking for a way to track basic user data for mobile iOS application:
how many times the app was launched
what was the average/by session time spent in total while using app
what was the average/by session time spent on particular screen
Additionally, I'd like the solution to:
display a heatmaps or click/tap/maps (clickstreams), to show how users tried to interact with the interface
generate visit graphs (user started from this screen, then went to this screen, etc.)
The most important requirement is that this is for internal application testing (nothing malicious), and we want to categorize data by user logged in (so that we can gather data per user, not some general average).
Can anyone recommend a suitable tool? Price or paid, doesn't matter. Is Google Analytics up for the job, or do we need something else?
Youve got several options to track the user behavior in the app. You can use frameworks like :
Flurry (http://www.flurry.com/)
Mixpanel (http://mixpanel.com/)
Localytics (http://www.localytics.com/)
Google analytics
Im pretty sure there are more. Flurry is free (for now but you have some special paid features) and it´s broadly used. It´s the framework I use the most for my apps in these moments but it will depend of the client and the information you want to track. You can track events, events with information, see the stats of use, how the user has used the application, find dead holes in your app and broadly speaking, have a general idea about how your application has been used. The other frameworks are not free and you have to pay for the services but you can always use a trial version to see if this is what you want or not. Ive used localytics and its nice.
Ive tried all of them, and there are pros and cons, but to get a general idea about your application, everyone serves. Regarding heatmaps, Im not sure about that, I mean if some of the frameworks offer a solution like that, but you can always build your reports with the provided information (I know it´s not a straightforward thing or a 5 minutes thing).
Take a look, compare and decide which one can fit the best for you.
Well these days app analysis is very important and are of great help. There are large number of analytics tools available. Some of them are free some of them are paid.
below are some of them
Flurry
Google Analytics
Heatmaps
These are few which are used most. For most list visit this link
Hope this will help you. happy coding :)

How to track conversions for iphone apps?

Is there any way to track which visitors end up installing our iphone apps?
Basically conversion tracking for apps?
(I know linkshare is a possibility - but they're US only. I need it to be worldwide because 50%+ of our installs are from outside the US)
I bet a bunch of other developers are wondering too. Thanks for listening.
We just went through the same thing and we still haven't found a good solution. The most promising company we talked to was http://www.appsflyer.com/. We considered linkshare.com also but the solution is hacky to act as your own affiliate and they don't track free app conversions.
Take a look at Flurry.com they have a great tracking product. You can keep track of events within the app (like what buttons were clicked, which ViewControllers were shown... etc).
google mobile analytics
flurry analytics
both are useful products in usage tracking. flurry supports many platforms and google analytics has great interface.
http://www.positionapp.com/
used to be pretty good last time I used it.
Recently they deliver much slower responses, check them out anyways.
Flurry also has conversions to install tracking (outside the app).
Appsflyer and Mobileapptracking are also good solutions.
I have used distimo and I like their tracking system. You can also create campaigns with unique url and they will tell you, how many users did that particular campaign bring in.

Is there any way to "backdate" requests to google server-side analytics?

I have an iOS app which can be used offline. I need to do anonymous page view tracking, so our customers can tell which pages people are most interested in (to drive future investments). So when the user is offline, we save a timestamped page view list, and if the user happens to be online when they use the app, we send these historic records up, and also do real-time tracking.
I'm keeping some summary statistics in my GAE app, so I can report the page views with historic accuracy. However, I'm also feeding these views into google analytics, using some python code I ported from google's server-side samples.
That all works great (except for language tracking, which I may have solved thanks to a separate question here on SO). However, I'd love for google analytics to be able to understand the historical hits in context. Right now, if I connect up after looking at several pages offline, GA thinks I just popped through a bunch of pages over the course of a couple seconds.
There is no documented utm variable for timestamping. The google analytics SDK for iOS (which I'm not using) has this ominous note:
Known Issues
Possible inaccurate timestamps: timestamps are recorded at the time the application dispatches to Google Analytics, so if a user experiences long periods of offline use, the timestamps may not be 100% accurate.
That seems like a bit of an understatement. Wouldn't offline timestamps be 100% inaccurate?
Anyway, the fact that the SDK doesn't handle this right makes me think I'm not going to be able to solve this. But I figured some SO wizard might have an idea...
In fact, timestamp is a "relative" (client side) information used by Analytics to compute things like "time on page".
When the page is view in "absolute" (date and time) is always the time you send the request.

Resources