Imho the easiest way for you is to go with https://github.com/charlotte-ruby/impressionist gem as u mentioned above. If i were you i would do maybe separate controller with some simple actions to serve only images for carousel which you want to log.
CarouselController < ApplicationController
impressionist :actions=>[:show]
def show
# u can also play with params[:id] to serve many images depending on id
send_file Rails.root.join("public", "file.gif"), type: "image/gif", disposition: "inline"
end
end
after you set-up routes for this controller in you app, then on client/js code u can use routes helper path like carousel_path(1) or something similar to serve images from rails
Yes, the solution above will log when you load your page with carousel no matter if the picture will be on slide 3 or slide 1 and even show up. If you want to log this particular events then you need hook some callback with carousel(slide 3 show) if possible and then trigger some custom ajax call to rails to log. If you can't hook callback then u probably need some write some javascript code to check when element change on page(slide 3 show)..