All,
I’ve got a rails application that allows people to publish audio files.
The
files are stored on Amazon S3.
I would like to publish statistics on the number of listens … and have
those statistics close to real time.
I’m wondering if I should use a URL redirect WITHIN rails to redirect a
RAILS URL to an S3 audio URL … then I could save the hit to the
database
(through RAILS) … or I could just scour the log files (I’d need to
scour
both S3 log files and Rails log files).
Scouring the log files is going to be messy … but having a URL
redirect
(within RAILS) that logs the hit is going to be perhaps expensive …
… does anyone have any ideas/thoughts/recommendations.
Etienne
e deleflie wrote:
All,
I’ve got a rails application that allows people to publish audio files.
The
files are stored on Amazon S3.
I would like to publish statistics on the number of listens … and have
those statistics close to real time.
I’m wondering if I should use a URL redirect WITHIN rails to redirect a
RAILS URL to an S3 audio URL … then I could save the hit to the
database
(through RAILS) … or I could just scour the log files (I’d need to
scour
both S3 log files and Rails log files).
Scouring the log files is going to be messy … but having a URL
redirect
(within RAILS) that logs the hit is going to be perhaps expensive …
… does anyone have any ideas/thoughts/recommendations.
Etienne
Directing to an action on your app first would be much easier than
logging.
Depending on how much info you want you could either create a new model
called LinkClick and create a new record each time a link is clicked.
This way you could store dates and times, ip_addresses etc. - info that
may be useful in future if not atm.
Otherwise, id just add an extra column the table you use for your audio
files called clicks, default it to 0 and create a model method called
add_click.
def add_click
increment clicks
end
Then you simply have to call add_click from your controller before
redirecting to amazon.
Gavin