Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analytics fixes #3558

Merged
merged 1 commit into from
Jan 30, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions readthedocs/core/static-src/core/js/sponsorship.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module.exports = {
};

function Promo (id, text, link, image, theme, display_type, pixel) {
this.id = id;
this.id = id; // analytics id
this.text = text;
this.link = link;
this.image = image;
Expand All @@ -21,11 +21,11 @@ function Promo (id, text, link, image, theme, display_type, pixel) {
// This needs to handle both old style legacy analytics for previously built docs
// as well as the newer universal analytics
if (typeof ga !== 'undefined') {
ga('rtfd.send', 'event', 'Promo', 'Click', self.id);
ga('rtfd.send', 'event', 'Promo', 'Click', id);
} else if (typeof _gaq !== 'undefined') {
_gaq.push(
['rtfd._setAccount', 'UA-17997319-1'],
['rtfd._trackEvent', 'Promo', 'Click', self.id]
['rtfd._trackEvent', 'Promo', 'Click', id]
);
}
};
Expand Down Expand Up @@ -81,7 +81,7 @@ Promo.prototype.place_promo = function (selector, promo_class) {
.attr('class', 'rtd-pro-image-wrapper')
.attr('href', self.link)
.attr('target', '_blank')
.on('click', this.click_handler);
.on('click', self.click_handler);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually wasn't strictly a problem. It is more clear though.

var promo_image = $('<img />')
.attr('class', 'rtd-pro-image')
.attr('src', self.image)
Expand All @@ -97,7 +97,7 @@ Promo.prototype.place_promo = function (selector, promo_class) {
.attr('class', 'rtd-pro-link')
.attr('href', self.link)
.attr('target', '_blank')
.on('click', this.click_handler);
.on('click', self.click_handler);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a scoping problem as this in this context is DOM <a> element.

});
promo.append(promo_text);

Expand Down
Loading