If you have a Vimeo video on your site then you would want to know, how many people are watching it and the video being tracked in real time.The problem is that these videos are hosted on another website, so technically you are just seeing your embedded video through a hole in your site with the video behind it.This means that you cannot track videos unless you have a script that communicates with Vimeo API. Luckily, Sander Heilbron has created a script that communicates with Vimeo API, so in this guide, I will walk you through this whole process.
This File URL will be used in the script mentioned in step 2 to call the code.
Track Vimeo Videos with Google Analytics- Step by Step Process
1.Download Sander Heilbron script page and upload it to your site:
You can get the file from the link below.The javascript is minified to load as fast as possible:https://github.com/sanderheilbron/vimeo.ga.js/releases/download/0.5.1/vimeo.ga.min.jsIf you are using a WordPress file then simply click ‘Media‘ from the left menu of your dashboard, then click Add New. You will get directed to file upload page where you can upload the downloaded Sander Heilbron script page from your computer. Once you upload the file, you will see the File URL.Solution for Non-Wordpress Sites
If you are not using WordPress then there is another simpler way to upload the file without using the plugin.Upload the file on your website root directory in your hosting Account. You should see a file manager in your Cpanel where you can upload the file. Please make sure the path to the file is correct, otherwise, the script will not work.<script src=”http://www.example.com/folder-name/vimeo.ga.min.js”></script>
2.Call your code where your videos are embedded
Download ‘Header & Footer‘ plugin and then insert this code on all pages.<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script src="path/to/your/uploaded/file/vimeo.ga.min.js" type="text/javascript"></script>
3.Find a page where you have your Vimeo video.
Paste your standard Vimeo default code:<iframesrc="//player.vimeo.com/video/12345678"width="640"height="390" frameborder="0"webkitAllowFullScreenmozallowfullscreenallowFullScreen></iframe>Replace theVimeoVideo ID number: 122582838with your Vimeo video ID number.Now edit the “src=” code that will inform Vimeo that you want to get information from Vimeo API. The code will look like this:
<iframesrc="//player.vimeo.com/video/12345678?api=1&player_id=vimeo-player-1" id="vimeo-player-1"width="640"height="390"frameborder="0" data-progress="true"data-seek="true"data-bounce="true" webkitAllowFullScreenmozallowfullscreenallowFullScreen></iframe>