How to use canonical to improve your website SEO

Search engines will grab all pages you have on your site, but you have probably experienced variants of your website appearing in forms you do not want. If you use any analytic tools, such as Google Analytics, you might have experienced pages of your website being treated as different pages, when it should be treated as same page
Why does canonical matter?
Canonical is used to tell search engines and website analytic tools which url should be the default, if there exist more than one url for a given pageOn our website, if you click on the profile icon, you'll be re-directed to the login page. For the login page to know where to send you after login, the URL of when you clicked login will be attached as part of the URL and will be attached after /login/...
This means our website will have many unique URL's, that all lead to the same login pages and in your statistic or search engine results, you probably want this page to be treated as one page and only reference the page without anything extra behind /login
This is where canonical comes into play. By adding this to the header of your pages, you inform whatever bot that reads this page that the canonical url is what should be used, no matter what URL they used to reach that specific page