charlotte-ruby / impressionist

Rails Plugin that tracks impressions and page views
MIT License
1.53k stars 311 forks source link

How to change IP before save? #309

Open sirchuck opened 1 year ago

sirchuck commented 1 year ago

Because of some networking, impressionist can't pull the real IP. I have the IP I want to use, but I'm not sure how to overwrite impressionists incorrect ip.

How can I update the object before it pushes the impressionist data to the database?

Something like: impressionist( @ip_address => "123.123.123.0" )

sirchuck commented 1 year ago

Also, can you count with specifications? Like I have a field action_name in the impressions database and I only want to count hits where that equals a value.

a.impressionist_count( :filter=>:ip_address, :action_name => "public", :start_date => sta.days.ago, :end_date => 1.minute.ago )

Unfortunately intuitively adding, :action_name => "my value" didn't only pull where action name = public.