Skip to content

Commit d87c554

Browse files
author
Cory Price
committed
[fix bug 1127120] Add GA events for download/update buttons
1 parent a3b0bdd commit d87c554

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

media/js/firefox/hello/index.js

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,21 @@
8585
$('#try-hello-footer').css('display', 'block');
8686
};
8787

88+
var addLinkEvent = function (linkSelector, eventName) {
89+
$(linkSelector).on('click', function(e) {
90+
var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
91+
var href = this.href;
92+
if (newTab) {
93+
w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', eventName]);
94+
} else {
95+
e.preventDefault();
96+
w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', eventName], function() {
97+
w.location = href;
98+
});
99+
}
100+
});
101+
};
102+
88103
if (w.isFirefox()) {
89104
// if Fx, hide all footer messaging
90105
// (correct messaging to display determined below)
@@ -140,32 +155,24 @@
140155
} else {
141156
// if Hello is not in toolbar/menu, change footer button to link
142157
// to a SUMO article and do some GA tracking
143-
$('#try-hello-footer').on('click', function(e) {
144-
var newTab = (this.target === '_blank' || e.metaKey || e.ctrlKey);
145-
var href = this.href;
146-
147-
if (newTab) {
148-
w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleClick']);
149-
} else {
150-
e.preventDefault();
151-
w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleClick'], function() {
152-
w.location = href;
153-
});
154-
}
155-
});
158+
addLinkEvent('#try-hello-footer', 'IneligibleClick');
156159

157160
w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleView']);
158161
}
159162
});
160163
} else {
161164
// if Fx is version 34 or lower (no Hello support) display update messaging in footer
162165
$('#ctacopy-oldfx').show();
166+
167+
addLinkEvent('.download-link', 'ClickUpgrade');
163168
}
164169
} else {
165170
// for non-Fx users, show get Fx feature & remove node to maintain nth-child margin rules
166171
// (we wont need this node/copy for non-Fx users)
167172
$('#feature-account').remove();
168173
$('#feature-getfx').show();
174+
175+
addLinkEvent('.download-link', 'ClickDownload');
169176
}
170177

171178
$videoLink.on('click', function(e) {

0 commit comments

Comments
 (0)