Right now I am doing the following with nginx to implement a global rule set for Google Analytics to load on pages.


sub_filter '</head>' '<script type="text/javascript">var _gaq = _gaq || [];_gaq.push(["_setAccount", "UA-99999999-9"]);_gaq.push(["_trackPageview"]);(function() {var ga = document.createElement("script"); ga.type = "text/javascript"; ga.async = true;ga.src = ("https:" == document.location.protocol ? "https://ssl" : "http://www") + ".google-analytics.com/ga.js";var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ga, s);})();</script></head>';

Replacing UA-99999999-9 with my UA ID

However in Google analytics this does not show what video people are watching. Just the page they are on. We are hosting video files in a subfolder with no index file just like this


Analytics just shows the user browsing example.com

How are we able to see what the .mp4 file each user is viewing?

  • What are you expecting to happen? That the video filename would be part of the page path, or something else? – Reve Jun 17 '19 at 16:52
  • Google analytics only tracks URLs on which the snippet can be included. That means HTML files only. It won't track video, images, scripts, or redirects. – Stephen Ostermiller Jun 17 '19 at 16:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.