While doing SEO you have to consider both on page and off page. Why because if you only one part you can get completed result. In off page you may have social media, directory submission, blog posts and many more. In on page you have title, keywords, description. So both are important to get top ranking in the search result.