#2 Impressionist


A lightweight plugin that logs impressions per action or manually per model
view analytics rails 5:50


Gemfile     gem 'impressionist'
bash    bundle install
    rails g impressionist
    rake db:migrate
blogs_controller.rb    BlogsController < ApplicationController
      impressionist :actions=>[:show,:index]

    def show
      @blog = Blog.find
      impressionist(@blog, "message...") # 2nd argument is optional
blog.rb    class Blog < ActiveRecord::Base
index.html.erb    @blog.impressionist_count
Schwad said almost 2 years ago:

This is really handy! I had been using all sorts of mixpanel configurations, etc to try and track impressions on a site where all my visitors were anonymous, *not* users, and after watching this I think I'm going to have to give impressionist a go! Great screencast!

[email protected] said almost 2 years ago:

It seems that this gem is not really maintained anymore.

You can refer to this issue on Github to get more info.

[email protected] said over 1 year ago:

Awesome episode!

Login to Comment
there were a term for a passenger in hand and less and less what it is that this will only answer will daily entries an hour to be able to keep track of how many users as read each one i'm lying countries so on a call with a counter the two shows in overtime caesar is gone into the show action on this blog entry to do this we could create a new attribute for counter or the block model however this may not be the best route sometimes if you have many different models anyone to keep his car in the eyes of tracking for each page so what we can do is we can use your precious gems depression is jim is a light would plug in that box impression spur action or manually per model so we can track when the user can store page and then displayed the counter here so was concerned with is the first thing that we need to do is to add the impressionists gym and torture borrow and then we need to ah wrong bottle to install it once we install the gym need to run a migration so and this will create the database entries so rails cheek impressions and it creates or database entries from here we can migrate our database then we can dance or not or rails applications and you'll see that creates about one table with several different homes in there isn't a lot of different poly morbid associations so listen up our application and let's get started adding it into our program so so going to war that controller then what's going to or blocks control or whatever blocks controller and we want to bomb at a in the impressionist for the actions show so brusquely the south of the oh that is taken directly from their documentation so this would only good for the show action of this works great we do we're into an issue where the precious gem will not work properly if you're using friendly i'd be so instead of using it up here before we get into our actions that actually need to go down into your shell action and then set the impressionist here we're going to call this or her blog and you put a e chi special message here if you want to buy it it's a optional entry so this will create a impression or that outlaw country where retirement it the show action and the blog is being said from people for action here are the sept longer just finds the block so when a user friendly at the in this case however if we were then we would have fully want to not make sure we're setting up like that at the second set that we have to do is going to war blog model there we need to add in is impressionable by adding the impressionable hear it creates the necessary associations to the table that we created so now we're all done with the back in set up the skillet or friend and set out to a kid where we can do a count of all are patriots so which is creating new header called abuse and laying down here were torn to just call ah i can for ration this count and by doing that we will they get a accurate count on barack com they choose so common that your list refresher page so we as your views are we going to show this would have hit the database created a new record us go back to work on now we have the one view of the going again go back we have to use can we have three teams so i really recommend checking out the documentation and hi there are so lazy to filter it to only get maybe the last several days ah but you want to show that these four or maybe you want to create a filter or a search for it to see how one specific days are putting it on certain days and you get filtered by a ip address so you're not getting ah multiple page views on the same user would rather it's going to just display the unique addresses mom you can also the body session hatch so you may not want to bomb if you have one single person uses go on alter your application on a certain section then you want to make sure the only counting it worked hard for each for your blog entries however ah oh what's a lockout lot like india would create another page he said check out the documentation in oz also has some information about adding a chance encounter cash to your model which could be on the radio for for performance if you have a blowtorch a database of them i read through the documentation is for a fairly self explanatory i'm just adding another record year i'm in our case the plot model than setting up some on camera catches specify the combat want to assign it to sell this offer the santa sent to you for watching