Search code examples
htmlyoutubefrontendhrefanchor

Why Youtube's anchor tag href is redirecting instead of simply pointing to actual website address?


I'm new in the development world so excuse me if the title is confusing. I searched for a related question but I didn't find any.

So I have a question that bothers me up lately and I wanna know why youtube's tag's href attribute is like href="https://www.youtube.com/redirect?event=video_description&redir_token=/some sting here/&q=www.somesite.com" instead of the web site's real address like href="www.somesite.com"?

Is it for some security concerns or something like that?

Thanks


Solution

  • To collect data for analytics.

    This is a standard technique to track clicks on the link before sending the user to a third-party site.