Permalink
Browse files

Bug 821016: Fix download click tracking for GA.

  • Loading branch information...
1 parent 080b3cb commit 1e4e8d6e2b9567acf4c6f99d43ed27a4daff4a85 @pmac pmac committed Dec 21, 2012
Showing with 22 additions and 8 deletions.
  1. +4 −2 apps/firefox/templates/firefox/new-b.html
  2. +11 −3 media/js/firefox/new.js
  3. +7 −3 media/js/global.js
@@ -1,4 +1,4 @@
-{% extends "/firefox/base-resp.html" %}
+{% extends "firefox/base-resp.html" %}
{% block page_title %}Free Download{% endblock %}
{% block body_id %}firefox-new{% endblock %}
@@ -8,6 +8,8 @@
<h2><a href="{{ url('mozorg.home') }}"><img src="/media/img/firefox/new/header-firefox.png" alt="{{_('Firefox for desktop')}}" /></a></h2>
{% endblock %}
+{% block webtrends %}{% endblock %}
+
{% block site_css %}
{{ css('firefox_new_test') }}
{% endblock %}
@@ -106,4 +108,4 @@ <h1 class="large">{{_('Different <span>by design</span>')}}</h1>
{% block js %}
{{ js('firefox_new') }}
-{% endblock %}
+{% endblock %}
View
@@ -28,13 +28,15 @@
var $scene2 = $('#scene2');
var $stage = $('#stage-firefox');
var $thankYou = $('.thankyou');
- $('.download-firefox').on('click', function() {
+ $('.download-firefox').on('click', function(e) {
+ // cancel natural event
+ e.preventDefault();
+
// track download click
if (_gaq) {
_gaq.push(['_trackPageview',
'/en-US/products/download.html?referrer=new-b']);
}
-
if (!Modernizr.csstransitions) {
$scene2.css('visibility', 'visible');
$stage.animate({
@@ -51,6 +53,12 @@
$thankYou.focus();
}, 500);
}
+
+ // delay natural event
+ var that = this;
+ setTimeout(function() {
+ window.location.href = $(that).attr('href');
+ }, 300);
});
});
-})(window.jQuery, window.Modernizr, window._gaq, window.site);
+})(window.jQuery, window.Modernizr, window._gaq, window.site);
View
@@ -5,6 +5,10 @@
// download buttons
+if (typeof(dcsMultiTrack) === 'undefined') {
+ dcsMultiTrack = function(){};
+}
+
/**
* A special function for IE. Without this hack there is no prompt to download after they click. sigh.
* bug 393263
@@ -70,14 +74,14 @@ $(document).ready(function() {
function getFirefoxMasterVersion()
{
var version = 0;
-
+
var matches = /Firefox\/([0-9]+).[0-9]+(?:.[0-9]+)?/.exec(
navigator.userAgent
);
-
+
if (matches !== null && matches.length > 0) {
version = parseInt(matches[1], 10);
}
-
+
return version;
}

0 comments on commit 1e4e8d6

Please sign in to comment.