Main menu

youtube

How to: Integrate Youtube IFrame API and Youtube field in Drupal 7

Published by dnovikov on Wed, 09/03/2014 - 12:20

If you are using Youtube module to display videos at your site, you may want to add some reactions on the Youtube player events. For instance, I did so for Google Analytics tracking capabilities.

To enable usage of the Youtube IFrame API, you need to add some Javascript code. Please remember: do not put it in Drupal behaviors wrapper!

The code is like this:

// Load YouTube IFrame API.
var tag = document.createElement('script');