Skip to content

Instantly share code, notes, and snippets.

@Gegam
Created December 5, 2016 10:10
Show Gist options
  • Select an option

  • Save Gegam/91626953fb11531f185ffc3f1ad2a032 to your computer and use it in GitHub Desktop.

Select an option

Save Gegam/91626953fb11531f185ffc3f1ad2a032 to your computer and use it in GitHub Desktop.
var ytVideo = document.getElementById('videoframe').contentWindow.document.querySelector('.html5-video-player'),
videoFrame = [
documument.querySelector('[src]="https://www.youtube.com/embed/O_WinR_5UTs"'),
documument.querySelector('[src]="https://www.youtube.com/embed/fATaXHdl8pk"'),
documument.querySelector('[src]="https://www.youtube.com/embed/uzo0hHvMSFc"'),
documument.querySelector('[src]="https://www.youtube.com/embed/LlwUzQyl9VQ"')
]
for (var i = 0; i < videoFrame.length; i++) {
videoFrame[i].addEventListener('click', function () {
if (ytVideo.classList.contains('playing-mode'))
ga('b.send', 'event', 'просмотр видео', 'видео ' + (i + 1))
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment