On-Page and Off-Page SEO
On-Page Search Engine Optimization consists of page code changes. For example, target keywords might be added to the title element, description tag, headers, bold text, written content, image names, and alternative content of the page.
Off-Page SEO consists of link-building and related activities. It's primarily about the number, type, and reputation of pages linking to your site, combined with the inbound link type, anchor content and positioning>. Related content on the inbound site may help as well. Other subtle elements like domain age, registration length, related social media accounts, etc. may also be off-page factors.
What's more important?
Both! If "widget" doesn't appear anywhere on a page, the page won't rank for a search on "widget." Conversely, if On-Page optimization for the Search term "Widget" is perfect, but the site has no inbound links, and has never been submitted to a search engine, it will never rank for the term "widget." For a very competitive search term, a site must have good On- and Off-Page factors to rank.
On-page optimization is easier to achieve, since it is entirely within the control of the site owners. Off-page factors can take time, and the cooperation of external entities.