You need to add an attribute to your model.
If you are using the Impressionsit gem, you should use the built-in migration generator to add the correct scheme to your database.
Otherwise, if you are not planing to use this gem, you will need to create a migration like the following:
MyMigration < ActiveRecord::Migration
def change
add_column :pluralized_model_eg_users, :integer, default: 0
end
end
Then, on the actions you want to count, use the code :
unless request.env["HTTP_USER_AGENT"].match(/\(.*https?:\/\/.*\)/)
@model.update_attribute :impressions, @model + 1
end
It does not uses the list you gave even to avoid overhead. However, most robots have an url in his user agent to identify then, so using this should be safe.
Using the list from this site would need you to add a caching to that list, which might add uneeded complexity in your code if it aims to be a simple feature.