We introduce a new and general notion of canonical extension for algebras in the algebraic counterpart AlgS of any finitary and congruential logic S. This definition is logic-based rather than purely order-theoretic and is in general different from the definition of canonical extensions for monotone poset expansions, but the two definitions agree whenever the algebras in AlgS are based on lattices. As a case study on logics purely based on implication, we prove that the varieties of Hilbert and Tarski algebras are canonical in this new sense.