What
We observed that the 3.0.3 snowplow js tracker is decorating the wrong elements.
How to reconstruct
In a situation like this
<a href="abc">
<img src.../>
</a>
the sp.js tracker would add an event listener to the a-Tag, if abc matches the crossDomainLinker criterion. Now if the image is clicked. The event listener receives and event e and decorates a.target.href, but it should decorate a.currentTarget.href. Thus, the links default action will follow an undecorated link. The responsible code is here:
|
let elt = evt.target as HTMLAnchorElement | HTMLAreaElement | null; |
In earlier versions of the sp.js tracker the event listener ignored the incoming event, i.e. like () => { decoration; }, and then decorate the href of this, which actually equals e.currentTarget.
Newer versions of the sp.js tracker are also impacted.
What
We observed that the 3.0.3 snowplow js tracker is decorating the wrong elements.
How to reconstruct
In a situation like this
the sp.js tracker would add an event listener to the a-Tag, if abc matches the crossDomainLinker criterion. Now if the image is clicked. The event listener receives and event
eand decoratesa.target.href, but it should decoratea.currentTarget.href. Thus, the links default action will follow an undecorated link. The responsible code is here:snowplow-javascript-tracker/libraries/browser-tracker-core/src/tracker/index.ts
Line 327 in c79a74e
In earlier versions of the sp.js tracker the event listener ignored the incoming event, i.e. like
() => { decoration; }, and then decorate the href ofthis, which actually equalse.currentTarget.Newer versions of the sp.js tracker are also impacted.