Answer the question
In order to leave comments, you need to log in
How to put google analytics target on iframe?
Hello.
You need to set goals for Yandex metrics (it turned out) and Google Analytics for the youtube video in the iframe.
I do it through the iframeTracker plugin
https://github.com/vincepare/iframeTracker-jquery/...
for Yandex it turned out, for Google I can’t understand what needs to be done
I did this:
in the header of the site
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/jquery.iframetracker.js"></script>
<script>
jQuery(document).ready(function($){
$('.youtubevideo iframe').iframeTracker({
blurCallback: function(){
yaCounterXXXXXXX.reachGoal('videoclick');
alert('тест');
}
});
});
</script>
<div class="youtubevideo" itemprop="embedHTML"><iframe width="560" height="315"
src="ссылка на видео" frameborder="0" allowfullscreen></iframe></div>
jQuery(document).ready(function($){
$('.youtubevideo iframe').iframeTracker({
blurCallback: function(){
yaCounterXXXXXXX.reachGoal('videoclick');
dataLayer.push({
'event':'videoyoutube',
'eventCategory':'video',
'eventAction':'clickvideo',
'eventLabel':'videoevent'
});
}
});
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question