vimeo.ga.js icon indicating copy to clipboard operation
vimeo.ga.js copied to clipboard

Uncaught TypeError: Cannot read property 'videoPlayed' of undefined

Open robonski opened this issue 10 years ago • 7 comments

Trying to implement vimeo.ga.js with Google Tag Manager on this page:

https://www.georgefox.edu/about/index.html

I'm getting console errors like these:

Uncaught TypeError: Cannot read property 'videoPlayed' of undefined Uncaught TypeError: Cannot set property 'timePercentComplete' of undefined Uncaught TypeError: Cannot read property 'timePercentComplete' of undefined

Not sure what I'm missing in my implementation. New to GitHub and Javascript, any help would be appreciated!

robonski avatar Aug 14 '15 23:08 robonski

Did you ever resolve this?

It might be helpful to review the JS API requirements on this page: https://developer.vimeo.com/player/js-api

You need to throw ?api=1 in order to enable the API to feedback the information that this script relies on, I had a quick look at your URL and couldn't spot that being used (but I appreciate it's been a couple of weeks so you might have worked around it!).

williamjulianvicary avatar Aug 28 '15 23:08 williamjulianvicary

Thanks, William! I didn't know that was necessary, but I'll give that a try!

robonski avatar Aug 31 '15 17:08 robonski

That didn't seem to help either, unfortunately, although that doesn't prove that I don't need it.

robonski avatar Sep 10 '15 22:09 robonski

Not sure if this is too late to help you, but I was getting the same error messages.

I tracked it back to a missing parameter pointing to the ID of the iframe. The full iframe code should include the URL to the video, the parameter to start the API, and the ID of the iframe using the API. See below:

<iframe src="https://player.vimeo.com/video/22439234?**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"**></iframe>

Also note, if you don't include the data variables, the script still tracks Play, Pause, & Resume, but it won't track progress watched (data-progress), if a user skips forward or backward (data-seek), or if they bounce from the video (data-bounce).

I hope this helps someone :-)

Stephen-WebGuy avatar Apr 08 '16 04:04 Stephen-WebGuy

Thanks! I'll take another look at it.

On Thu, Apr 7, 2016 at 9:10 PM, Stephen-WebGuy [email protected] wrote:

Not sure if this is too late to help you, but I was getting the same error messages.

I tracked it back to a missing parameter pointing to the ID of the iframe. The full iframe code should include the URL to the video, the parameter to start the API, and the ID of the iframe using the API. See below:

Also note, if you don't include the data variables, the script still tracks Play, Pause, & Resume, but it won't track progress watched (data-progress), if a user skips forward or backward (data-seek), or if they bounce from the video (data-bounce).

I hope this helps someone :-)

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/sanderheilbron/vimeo.ga.js/issues/36#issuecomment-207201356

robonski avatar Apr 09 '16 00:04 robonski

Thanks @Stephen-WebGuy I was having the same issue and your suggestion fixed it.

lukeheath avatar Aug 03 '16 20:08 lukeheath

This issue should be closed, as I believe the solution @Stephen-WebGuy offers is spot on.

lnpbk avatar Dec 06 '16 12:12 lnpbk