Skip to content

Commit 760db1a

Browse files
committed
Fix promo click logic
1 parent 8e6f7ac commit 760db1a

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

readthedocs/core/static-src/core/js/sponsorship.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,23 @@ Promo.prototype.create = function () {
3434
.appendTo(promo_about_link);
3535
promo_about.appendTo(promo);
3636

37+
// On Click handler
38+
function promo_click() {
39+
if (_gaq) {
40+
_gaq.push(
41+
['rtfd._setAccount', 'UA-17997319-1'],
42+
['rtfd._trackEvent', 'Promo', 'Click', self.id]
43+
);
44+
}
45+
}
46+
3747
// Promo image
3848
if (self.image) {
3949
var promo_image_link = $('<a />')
4050
.attr('class', 'rst-pro-image-wrapper')
41-
.attr('href', self.link);
51+
.attr('href', self.link)
52+
.attr('target', '_blank')
53+
.on('click', promo_click);
4254
var promo_image = $('<img />')
4355
.attr('class', 'rst-pro-image')
4456
.attr('src', self.image)
@@ -54,14 +66,7 @@ Promo.prototype.create = function () {
5466
.attr('class', 'rst-pro-link')
5567
.attr('href', self.link)
5668
.attr('target', '_blank')
57-
.on('click', function (ev) {
58-
if (_gaq) {
59-
_gaq.push(
60-
['rtfd._setAccount', 'UA-17997319-1'],
61-
['rtfd._trackEvent', 'Promo', 'Click', self.id]
62-
);
63-
}
64-
});
69+
.on('click', promo_click);
6570
});
6671
promo.append(promo_text);
6772

readthedocs/core/static/core/js/readthedocs-doc-embed.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)