[Tiny fix] Fix a couple small bugs from DisplayAd clean up (#14846)
* Clean up and fix DisplayAd click JS * Fix double use of variable
This commit is contained in:
parent
5678fb77f5
commit
647573dcad
2 changed files with 7 additions and 6 deletions
|
|
@ -143,10 +143,10 @@ function trackCustomImpressions() {
|
|||
&& windowBigEnough
|
||||
&& checkUserLoggedIn()) {
|
||||
var csrfToken = tokenMeta.getAttribute('content');
|
||||
[].forEach.call(displayAds, function(unit) {
|
||||
displayAds.forEach(unit => {
|
||||
trackAdImpression(csrfToken, unit);
|
||||
unit.removeEventListener('click', trackAdClick, false );
|
||||
unit.addEventListener('click', function(e) { trackAdClick(csrfToken, e) });
|
||||
unit.addEventListener('click', function(e) { trackAdClick(csrfToken, e.target) });
|
||||
});
|
||||
}
|
||||
}, 1800)
|
||||
|
|
@ -221,7 +221,8 @@ function trackAdImpression(token, adBox) {
|
|||
})
|
||||
}
|
||||
|
||||
function trackAdClick(token, adBox) {
|
||||
function trackAdClick(token, clickedElement) {
|
||||
var adBox = clickedElement.closest('[data-display-unit]');
|
||||
if (!adClicked) {
|
||||
var dataBody = {
|
||||
display_ad_event: {
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ module Html
|
|||
next if allowed_image_host?(src)
|
||||
|
||||
if synchronous_detail_detection && img
|
||||
width, height = image_width_height(img)
|
||||
img["width"] = width
|
||||
img["height"] = height
|
||||
attribute_width, attribute_height = image_width_height(img)
|
||||
img["width"] = attribute_width
|
||||
img["height"] = attribute_height
|
||||
end
|
||||
|
||||
img["loading"] = "lazy"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue