D
D
Dmitry Tarasov2019-12-06 14:21:10
JavaScript
Dmitry Tarasov, 2019-12-06 14:21:10

Is it possible on youtube to track whether the user clicked the play button through the extension?

Is it possible to track on the youtube website whether the user clicked the play button through the extension, or by the button to find out if the channel is subscribed or liked?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Potapov, 2019-12-08
@fast-je

if(document.querySelector('.ytd-subscribe-button-renderer').textContent === 'Вы подписаны'){
console.log('Подписан');
}

And about tracking playback, you can try to hang a click event on the ytp-play-button class
var elem = document.querySelector('.ytp-play-button');
elem.addEventListener("click", function() {
    console.log('Нажал play');
  });

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question