Gem to track User Activity [closed] - ruby-on-rails

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 6 years ago.
Improve this question
Is there a good gem to track/log user activities on the site? Like when they sign in, sign out, or perform an action that changes something on the site (non GET requests in general).

Yes there are. Here is one, paper trail. https://github.com/airblade/paper_trail
Its main prupose is to versioning models but I think its also good for your use case since it registers who made each version.
For more gems search at ruby toolbox. Here are the categoties that you should check in this case
https://www.ruby-toolbox.com/categories/Active_Record_User_Stamping
https://www.ruby-toolbox.com/categories/Active_Record_Versioning
Maybe Userstamp is actually better for your use case.

This is a follow up. I've been using a gem called public_activity. https://github.com/pokonski/public_activity. It's pretty simple to install and setup.

I briefly investigated several similar-purposed gems including: PaperTrail, Vestal versions, audited, Acts as versioned, Userstamp , and found that:
PaperTrail, Vestal versions and Acts as versioned are all very powerful versioning gem. Yes, you can also use it to audit/track users' activities , but it's not very straight forward because they are 'versioning tools', but not for the 'auditing purpose'
Userstamp and audited are for auditing purposing only. but Userstamp is for older Rails versions ( it's a plugin... which is not supported by Rails3(or 3.1, 3.2?) anymore )
so I think 'audited' is a better choice for auditing user activities purpose (not considering model versioning) for Rails3, this is enough for me. Further more, it supports associations and ActiveRecord/MongoMapper.
I hope this helps.

paper_trail is usually used to track changes in object.
If you want to track actions (like a movie, sign in, read a book etc) pfeed
is a good candidate

There is a ruby gem called Action Tracker. I built and use it and it should do exactly what you need (since you use Rails and Devise).
The link is https://github.com/appprova/action_tracker
There are some contribution from outside our core team too (people are using it). You are welcome to try and send feedback!

It depends on why you are looking for those informations. Papertrail or similar can track changes in models easily, see Siwei Shen:s answer for better infos. Also public_ativity type of gems can be used if you are looking on how to make a public feed based on user actions.
Then again if you wan't to do growth hacking or analyze otherwise what are the user flows. It's often easier just to do some custom logging. Create a long text field next to the model and add a line every time something interesting happens. Works well if you wan't occasionally to crunch some data on how users are using the service and how changes in the site affect long term usage.
See https://github.com/holli/referer_tracking for example of this type of approach.

Related

How to document AngularJS + Ruby on Rails app? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm using yard to generate my documentation for Rails apps from an rdoc file. There are AngularJS documentation generators, but how could they be connected to generate one coherent document for an AngularJS + Rails app?
In this case it is probably fine to have them separated, and indeed may make more sense to have them separated. Angular is going to be solely for your client-side stuff, and I'm assuming you're then using Rails as an API or perhaps a different piece of the app's functionality. Either way, they are fundamentally doing different things, so it would make sense to have them in different doc sections.
You could create a "landing page" for your documentation if you'd like: one button links to Angular docs and one to Rails docs, and that would solve the need to have them both "in one place". Actually figuring out a way to make them overlap in the same system is likely not worth the effort though, and may actually be a worse user experience.
As the previous answer stated, it would be good to use two different tools and link them together.
I would start with something like Apipie or just rdoc to document the ruby stuff. Additionally I would search for a good js documentation generator. This article compares a four different generators, while 'Docco' seems to have a ruby port with that is called 'Rocco', that may be even able to generate documentations for both, ruby and js. JSDoc on the other hand enables you to integrate custom pages into your docs (here you could place a link to the apipie generator).
In general I would probably just go for the rails API doc and have some conventions for commenting your angular code, as the angular stuff probably has no API that is accessible by another part of your system and therefore only needs some internal documentation.

Advantages of Ruby on Rails application that consumes REST API [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 8 years ago.
Improve this question
I see some old questions here and here
It is now 2014, and I also have a more specific question.
Another company has built a REST API. Now I want to build a web application that only needs controller and view. I was originally planning to build this with just PHP without the bloat of an MVC framework. Then I was thinking maybe doing it with ASP.NET with just simple code behind and .aspx approach (the non-MVC way). I was even considering using only JQuery and HTML. The reason I haven't really considered a full MVC framework is because I'm simply just sending data, getting data and printing data. I don't have to really implement business logic.
Right now I'm considering doing this in just the ruby language because it seems like such a clean and minimalist language. But is there any advantage to including the entire rails framework? If so, what features are worth considering in the rails framework for my purposes?
EDIT
It seems I got a close vote for opinion based. But I'm not looking for opinions. I'm looking for the advantages of rails framework for my purposes. In other words, what problems can the rails framework solve significantly faster than just using ruby+curl+print_line().
As example on how to answer the question objectively, you can state things like:
Scenario 1:
Rails makes CURL calls and displays in views like so.
Pure ruby make calls and outputs views like so.
Result: As can be seen, rails requires X fewer lines of code than pure ruby as it pertains to the OP's original question
Scenario 2:
Rails handles page caching like so.
Pure ruby page caching will need to be handled like so.
Result: As can be seen, rails require X fewer lines of code than pure ruby as it pertains to the OP's original question
By listing the problems the original rails authors hoped to achieve and solutions they hoped for us to utilize in the situation defined in the OP's original question, we can see quantitatively the advantages Rails has over pure ruby.
Rails is pretty big, and in my opinion you don't need the bloat of Rails for something this simple. Even though it's not an MVC framework, I would recommend something like Sinatra, especially since it doesn't force you to use a database at all. Sinatra is a very simple framework, and it's most useful when you just want a way to easily set up HTTP routing with basic view support. However, note that it is possible to create a model that doesn't use ActiveRecord with Rails.

What's the best Rails 4 ajax Push engine? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I'm busy with the creation of a collaborative application, where 2 users may edit the same data at the same time, without doing a full refresh of the HTML page (it is a huge table, as an excel sheet).
What is the best option in Rails 4 I have to push the modification from a user A to a user B ?
The ultimate goal should be to get an auto-update table like the one in google spreadsheet ! :-)
I didn't find a recent (>2012) answer to this question... Is there a gem or a plugin that starts an automatic process on the server side ? How the manage the user subscriptions to udpates ?
You should definitely use the websocket-rails gem, I am personnaly using it for a debate website which I'm creating from scratch.
It is using, as the name refers, Websockets. This technology is being more and more used, and is now compatible with most of the browsers, it has indeed an excellent compatibility.
websocket-rails has a lot of documentation, I also had some trouble using it for advanced usage, and got my happiness contacting their devs directly on their irc channel, they are very nice.
For your need, I think that Websockets are much more convenient than Ajax, for for your need, Ajax needs to ask the server each x second if there's something new to refresh. That will exhaust your server, but when using Websockets, the server will send you directly the new data that you need. You can find more info for this choice on this SO answer.
It handles private channels, if the data exchanged need not to be public as well, websocket-rails is definitely the way to go !
You can find it's repository here.
I will try to answer your question as simple as I can:
End of last year I created a web app that needed too many interactions and live updating on the client side.
Basically like the Facebook Wall with notification and live updates.
I achieved this through using Private_Pub which is a Gem created based on Faye, by Ryan Bates, the author of RailstCasts
There are tutorials and examples of using this for live updates.
However I don't advice you to use this, because you will end up doing so much dirty hacks and patches just to make sure the service is running and make sure connections are not closed and such.
My advice would be using a front-end JS on top of Rails Stack.
You can using Angular,Ember, Backbone and Meteor, all of them help you achieve that functionality on a safer side of things.
Check out the RailsCasts for those Frameworks from Ryan Bates:
http://railscasts.com/episodes/408-ember-part-1
http://railscasts.com/episodes/351-a-look-at-meteor
http://railscasts.com/episodes/405-angularjs
http://railscasts.com/episodes/323-backbone-on-rails-part-1

How to create a "guided tour" in Rails app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I'm looking for ideas, best practices, gems (if such exist) that would allow me to easily create a guided tour for an existing Rails 4 web application.
I would like any new user that signs up to be greeted with a welcome message that explains some of the site's features. When they click "Next", they should go to another page (say, projects list) where another explanatory message appears. Next step would be yet another page (e.g. tasks list) with message and so on... I'd like the explanatory messages to be as unobtrusive as possible, similar to flash messages.
The possibility to skip or hide the guided tour and start it over later would be, of course, very nice to have.
I know that I could create it "by hand" using cookies and some additional controller logic (flash messages) but wouldn't like to pollute all of the controllers with additional logic for guided tour.
I've been using Shepherd.js for the last several months in my Rails apps. I found it handles itself best of all the JavaScript tour libraries in a responsive webapp, as the mobile experience is an important part of our product. Plus, its provided themes were easy to integrate into our existing look-and-feel. (You can install the Shepherd.js rails-assets gem for easier use in the asset pipeline.)
I've since wrapped Shepherd.js into a Rails gem called Abraham to make it easier to configure tour content, track which users have seen each tour, and allow users to skip a tour for now.
Another option is IntroJs http://usablica.github.io/intro.js/, both this and Baldrick's answer are great options.
You could use the jQuery plugin Joyride for this.
I would create a controller dedicated to the guided tour that renders some of your existing views (for example '/tour/1', '/tour/2', 'tour/3', ...), but add inside the hidden html ol used by Joyride (see the doc). At the end of the tour on each page, use the Joyride callback postRideCallback to redirect user to the next page of the tour.

Anyone got SEO tips for Ruby on Rails [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 8 years ago.
Improve this question
Can anyone recommend some RoR plugins and/or general sage that will help me with SEO?
I myself was searching for some guide on SEO for ruby on rails, surprisingly there was no updated/recent article on the web (this post ranks #1 in google and this is also 3 years old) as that link seoonrails is dead and other articles are written in 2010 so I went ahead and wrote a complete SEO for rails guide http://www.inboundio.com/blog/seo-for-ruby-on-rails-complete-guide/. It took me 3 days to write it (including the infographic) and I have tried to link back to railscasts and other sources where ever possible to make it more helpful.
To answer OPs questions, following gems can be used as starting point -
Friendly ID - https://github.com/FriendlyId/friendly_id
Meta Tags - https://github.com/kpumuk/meta-tags
MetaMagic - https://github.com/lassebunk/metamagic
Sitemap - http://rubygems.org/gems/sitemap or http://rubygems.org/gems/xml-sitemap
Breadcrumbs - https://github.com/lassebunk/gretel
You can further refine your rails app with following gems
Rack cache (for caching) - http://rubygems.org/gems/rack-cache
GeoCoder (for geotargeting) - https://github.com/alexreisner/geocoder
Geokit (for geotargeting) - https://github.com/geokit/geokit
Mobile fu (for better Mobile Optimization) - https://github.com/brendanlim/mobile-fu
SEO is a field by itself. But for a rails app you could use the following gems to make you site more search engine friendly.
Metamagic http://github.com/lassebunk/metamagic
Headliner https://github.com/mokolabs/headliner
Gretel for breadcrumbs http://github.com/lassebunk/gretel
FriendlyID for SEO friendly urls http://github.com/norman/friendly_id
DynamicSitemaps for generating stiemaps http://github.com/lassebunk/dynamic_sitemaps
Finally all these and a small description on how to use them could be found on this blog post http://lassebunk.dk/2011/03/09/rails-seo-pack/ by Lasse Bunk
Sorry to resurrect such an old question, but it's been on my mind too, I'll share what I came up with.
As you probably know, SEO is pretty blurry in general. But these are a few of the core things that I've discovered from my reading. But I'm no SEO whiz.
A good strong name.
Every page's title attribute should somehow be titled for its content specifically. It's also not a bad idea to ensure that it has near 60 characters. As far as getting the title to change depending up on the page, you could do something like this:
http://railscasts.com/episodes/30-pretty-page-title (the railscast is a bit dated, maybe there's a newer way to get this done?)
Rails 3 - Ideal way to set title of pages (I kind of like the look of this one.)
Create a robots.txt file
You just throw it in your public folder with something like this, assuming you want all of your pages indexed:
User-agent: *
Disallow:
Create a Sitemap and submit it to Google Web Developer Tools
I just checked this one out, and it did what I wanted.
https://github.com/kjvarga/sitemap_generator
You might look at rails powered meta tags using the following gem, though, I've not used it:
https://github.com/parndt/seo_meta
And, I think that really wraps it up for rails specific things. There are so many other SEO resources out there, and so many of them are just things that you manipulate the view to accomplish, so they're not really rails questions at that point.
A few other things to think about as well, but they're not really rails specific, and mostly in your views.
Make sure your code is W3C valid
Title attributes for image tags.
Using header tags appropriately.
Don't put text in images, that's what text is for. If you want to use a pretty font, use google fonts.
Make sure you have outbound links to resources that make sense for the context of your page.
Create a printable stylesheet.
I believe the most important ingredients to SEO are:
good content and
good inbound links.
None of these can be achieved using any plugin.
See also SEO: Where do I start?

Resources