Permalink
Browse files

[fix bug 1127120] Add GA events for download/update buttons

  • Loading branch information...
1 parent a3b0bdd commit d87c5541380db112bba8bbc66ae7994879082135 @ckprice ckprice committed Jan 29, 2015
Showing with 20 additions and 13 deletions.
  1. +20 −13 media/js/firefox/hello/index.js
@@ -85,6 +85,21 @@
$('#try-hello-footer').css('display', 'block');
};
+ var addLinkEvent = function (linkSelector, eventName) {
+ $(linkSelector).on('click', function(e) {
+ var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
+ var href = this.href;
+ if (newTab) {
+ w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', eventName]);
+ } else {
+ e.preventDefault();
+ w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', eventName], function() {
+ w.location = href;
+ });
+ }
+ });
+ };
+
if (w.isFirefox()) {
// if Fx, hide all footer messaging
// (correct messaging to display determined below)
@@ -140,32 +155,24 @@
} else {
// if Hello is not in toolbar/menu, change footer button to link
// to a SUMO article and do some GA tracking
- $('#try-hello-footer').on('click', function(e) {
- var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
- var href = this.href;
-
- if (newTab) {
- w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleClick']);
- } else {
- e.preventDefault();
- w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleClick'], function() {
- w.location = href;
- });
- }
- });
+ addLinkEvent('#try-hello-footer', 'IneligibleClick');
w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleView']);
}
});
} else {
// if Fx is version 34 or lower (no Hello support) display update messaging in footer
$('#ctacopy-oldfx').show();
+
+ addLinkEvent('.download-link', 'ClickUpgrade');
}
} else {
// for non-Fx users, show get Fx feature & remove node to maintain nth-child margin rules
// (we wont need this node/copy for non-Fx users)
$('#feature-account').remove();
$('#feature-getfx').show();
+
+ addLinkEvent('.download-link', 'ClickDownload');
}
$videoLink.on('click', function(e) {

0 comments on commit d87c554

Please sign in to comment.