|
85 | 85 | $('#try-hello-footer').css('display', 'block'); |
86 | 86 | }; |
87 | 87 |
|
| 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 | + |
88 | 103 | if (w.isFirefox()) { |
89 | 104 | // if Fx, hide all footer messaging |
90 | 105 | // (correct messaging to display determined below) |
|
140 | 155 | } else { |
141 | 156 | // if Hello is not in toolbar/menu, change footer button to link |
142 | 157 | // 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'); |
156 | 159 |
|
157 | 160 | w.gaTrack(['_trackEvent', '/hello interactions', 'productPage', 'IneligibleView']); |
158 | 161 | } |
159 | 162 | }); |
160 | 163 | } else { |
161 | 164 | // if Fx is version 34 or lower (no Hello support) display update messaging in footer |
162 | 165 | $('#ctacopy-oldfx').show(); |
| 166 | + |
| 167 | + addLinkEvent('.download-link', 'ClickUpgrade'); |
163 | 168 | } |
164 | 169 | } else { |
165 | 170 | // for non-Fx users, show get Fx feature & remove node to maintain nth-child margin rules |
166 | 171 | // (we wont need this node/copy for non-Fx users) |
167 | 172 | $('#feature-account').remove(); |
168 | 173 | $('#feature-getfx').show(); |
| 174 | + |
| 175 | + addLinkEvent('.download-link', 'ClickDownload'); |
169 | 176 | } |
170 | 177 |
|
171 | 178 | $videoLink.on('click', function(e) { |
|
0 commit comments