зеркало из https://github.com/mozilla/bedrock.git
Video tracking tweak, GA experiment added. Bug 865433.
- Avoid pause tracking when video ends. - GA experiment code added to base /firstrun page.
This commit is contained in:
Родитель
19456a376f
Коммит
4aa88f3dc9
|
@ -14,6 +14,24 @@
|
|||
{% block site_header_nav %}{% endblock %}
|
||||
{% block site_header_logo %}{% endblock %}
|
||||
|
||||
{% block extrahead %}
|
||||
{# GA experiment. Remove when experiment is over. #}
|
||||
<!-- Google Analytics Content Experiment code -->
|
||||
<script>function utmx_section(){}function utmx(){}(function(){var
|
||||
k='71153379-20',d=document,l=d.location,c=d.cookie;
|
||||
if(l.search.indexOf('utm_expid='+k)>0)return;
|
||||
function f(n){if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.
|
||||
indexOf(';',i);return escape(c.substring(i+n.length+1,j<0?c.
|
||||
length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;d.write(
|
||||
'<sc'+'ript src="'+'http'+(l.protocol=='https:'?'s://ssl':
|
||||
'://www')+'.google-analytics.com/ga_exp.js?'+'utmxkey='+k+
|
||||
'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='+new Date().
|
||||
valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
|
||||
'" type="text/javascript" charset="utf-8"><\/sc'+'ript>')})();
|
||||
</script><script>utmx('url','A/B');</script>
|
||||
<!-- End of Google Analytics Content Experiment code -->
|
||||
{% endblock %}
|
||||
|
||||
{% block site_css %}
|
||||
{{ css('firefox_firstrun') }}
|
||||
{% endblock %}
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
{% block site_header_logo %}{% endblock %}
|
||||
|
||||
{% block extrahead %}
|
||||
{# GA experiment code here #}
|
||||
<link rel="canonical" href="https://www.mozilla.org/en-US/firefox/21.0/firstrun/" />
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
{% block site_header_logo %}{% endblock %}
|
||||
|
||||
{% block extrahead %}
|
||||
{# GA experiment code here #}
|
||||
<link rel="canonical" href="https://www.mozilla.org/en-US/firefox/21.0/firstrun/" />
|
||||
{% endblock %}
|
||||
|
||||
|
|
|
@ -61,6 +61,8 @@
|
|||
|
||||
Mozilla.Modal.create_modal(this, $video_content, position_video, reattach_video);
|
||||
|
||||
video_closing = false;
|
||||
|
||||
gaq_track('first run interaction', 'open video', 'Pinned Tabs Video');
|
||||
});
|
||||
|
||||
|
@ -81,11 +83,15 @@
|
|||
// video pause event is fired when modal closes
|
||||
// do not track this particular pause event
|
||||
if (!video_closing) {
|
||||
gaq_track("first run interaction", "pause", "Pinned Tabs Video");
|
||||
// is video over?
|
||||
// 'pause' event fires just before 'ended', so
|
||||
// using 'ended' results in extra pause tracking.
|
||||
var action = ($video[0].currentTime === $video[0].duration) ? 'finish' : 'pause';
|
||||
|
||||
gaq_track("first run interaction", action, "Pinned Tabs Video");
|
||||
|
||||
video_closing = false;
|
||||
}
|
||||
}).on('ended', function() {
|
||||
gaq_track("first run interaction", "finish", "Pinned Tabs Video");
|
||||
});
|
||||
|
||||
$('#footer_email_submit').on('click', function(e) {
|
||||
|
|
|
@ -1,17 +1,22 @@
|
|||
;(function($) {
|
||||
'use strict';
|
||||
|
||||
var $video = $('#firstrun-video');
|
||||
|
||||
var gaq_track = function(action) {
|
||||
if (window._gaq) {
|
||||
_gaq.push(['_trackEvent', "first run interaction", action, "First Run Video"]);
|
||||
}
|
||||
};
|
||||
|
||||
$('#firstrun-video').on('play', function() {
|
||||
$video.on('play', function() {
|
||||
gaq_track("play");
|
||||
}).on('pause', function() {
|
||||
gaq_track("pause");
|
||||
}).on('ended', function() {
|
||||
gaq_track("finish");
|
||||
// is video over?
|
||||
// 'pause' event fires just before 'ended', so
|
||||
// using 'ended' results in extra pause tracking.
|
||||
var action = ($video[0].currentTime === $video[0].duration) ? 'finish' : 'pause';
|
||||
|
||||
gaq_track(action);
|
||||
});
|
||||
})(window.jQuery);
|
Загрузка…
Ссылка в новой задаче