FR STAR
FR STAR

Reputation: 702

How to track Mobile site video events in Google Analytics?

In our desktop site we're including MP4 videos with mediaelement js player. We're currently tracking video events using Google Analytics plugin but we're confused how this will work with our jQuery mobile site, because In mobile when we click on a video it will load on a native video player application instead of playing through mediaelement js player?

If our videos played on native application are we unable to track Google Analytics events on the video ?

Could anyone please let me know how can we overcome this problem ?

Upvotes: 2

Views: 604

Answers (1)

Offbeatmammal
Offbeatmammal

Reputation: 8228

While I've not used it specifically for tracking video this script - https://code.google.com/p/google-analytics-js/ - has been very helpful in tracking 3rd party usage of a JS library.

In the same way that I'm calling it within the JS library you could hook a call to gaTrack('UA-123456', 'yoursite.com', '/assets/videoname.mp4'); into where you launch the video in jQuery.

Note that this will only let you track the launch, you'll be limited in which events you can track when it's running in the native player (some are better than others in feeding pause/seek etc events back to the player but you'd need to test that something like https://gist.github.com/Offbeatmammal/3718414)

Essentially what the script does is manually construct a call to the GA tracking gif with correct parameters. You could also construct your own virtual push for virtual pageviews but that requires a bit more work https://developers.google.com/analytics/devguides/collection/gajs/asyncMigrationExamples#VirtualPageviews

Upvotes: 1

Related Questions