Hacker News new | ask | show | jobs
by josephg 444 days ago
That’s a classic technique to track click through rates. Google.com has done this forever. The technique is to make an actual link in HTML (<a href=…>) then add an event handler which cancels the link’s default behaviour when you click it - and replaces it with javascript, or a tracking link.

I understand why Google.com wants that data. But in an email client it’s extremely obnoxious.

3 comments

If it’s replaced with a tracking link, I think it might be just as effective to use the `ping` property on browsers that support it
Huh - I didn't know that existed. Its not supported in firefox or IE11 though - and probably will never be.

(IE11 probably isn't super relevant now - but it was almost certainly more relevant when that tracking code was written. You could use feature detection - but its much easier to just use their hacky javascript everywhere instead.)

https://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorE...

https://caniuse.com/ping

I hate it even more in Google calendar where they don’t even bother to use that JS. I’ll copy a zoom join link from an invitation to send to someone, and I get some sh**y Google redirect URL.
I thought Gmail didn't support js execution. Did Google make an exception for themselves?
It’s not JS in the message. It’s the JS of the GMail page.