0

We've been using Matomo for analytics tracking but have had tons of issues with their HTTP Tracking API and specifically the Media Analytics plugin. Their forums were no help and we received no help from the support email even though the Media Analytics plugin is expensive.

I decided to replace the Matomo functionality with Ahoy and so far it's been wonderful. My only question is how do I track a single event over time? Can I update an old event?

Here's my use case:

I want to track analytics of media watched. So when a user loads a video page we'll know that the page was loaded, when they started playing the media, whether they paused the video, seeked through the video, if/when they finished it etc.

I was thinking it may be easy if I could just update the initial event any time something changes but if that's not possible there has to be another way to combine this data easily. I'm just not seeing it.

Brandon Cordell
  • 1,308
  • 1
  • 9
  • 24

1 Answers1

1

My only question is how do I track a single event over time? Can I update an old event?

Yes, but you have to add codes manually.

Based on your use case, it may not be a good choose to use Ahoy or any other visits tracking tools, as they should track every visits naturally except for few exceptions. And the analytics result will be messed.

The better way is create a new model to do this, like User has_one UserStatus.

If you have to do it with Ahoy, you could work around like the pseudo code:

# ahoy.rb
Ahoy.exclude_method = lambda do |controller, _request|
  user = controller.current_user

  if (ahoy_visit = find_by_user_id)
    update ahoy_visit
    return true # Skip tricking
  end
end
eux
  • 3,072
  • 5
  • 14
  • Thank you @eux. The reason I chose Ahoy is because I DO want to track all normal movements. I care about the referring site, location, utm_* attributes, etc. I just want to track media consumption differently so that I can logically list all media events on a single view as one event, e.g. (Guest User 1 loaded Video 1, started the video 2 seconds after it was load, paused it twice, rewound the video to the 10 second mark twice, and finished after 5 minutes) if that makes sense? – Brandon Cordell Feb 02 '21 at 17:25
  • @BrandonCordell I see, it's a little bit anti-pattern, but you could try it to see if that works well. – eux Feb 03 '21 at 01:35