1

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

/etc/nginx/conf.d/analytics.conf

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

example.com/video1.mp4
example.com/video2.mp4

Analytics just shows the user browsing example.com

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

2
  • What are you expecting to happen? That the video filename would be part of the page path, or something else?
    – Reve
    Jun 17, 2019 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. Jun 17, 2019 at 16:56

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.