Yes, you’re right Dayanthiny,
A canonical tag is a small piece of code embedded into the webpage that can help to the SE deal with multiple versions of the same page. It is supported to three of the most popular search engines and allows to the webmasters to specify a preferred address for content that might be duplicated.
The search engines and visitors need to know which version that you had preferred. Therefore you have to verify your all domain versions and to set a preferred domain, it impacts the crawling and indexing process.
If you are not set the preferred domain, Google treats the www and non-www versions of the domain as separate references to separate pages. To Avoid the conflict, we should follow above things.